A Language About Toilets

To tick off a learning outcome at uni, we were required to get a data set from somewhere and do some form of processing on it. I discovered, in the Australian government’s massive database of open databases, a set of all public toilets in Australia. I couldn’t resist using that. So I wrote up a quick program in D that would spit out kml placemarks for each toilet in the set. Given the ~17000 public toilets in the set, and given that each one of those had labels, Google Earth didn’t fare very well. I limited it to a couple thousand and that did the trick. Next I went through and set the descriptions of each placemark to be the set of features that the toilet had using a table. That worked out pretty well. At some point we were told that being able to query the data somehow would be a big plus. Things like using Query in google sheets were suggested, but being me I decided against it. I’d already started an assembly interpreter this weekend so I was in the mood to do some language parsing. Lo and behold I created the Toilet Query Language.TQLqueryIt’s not a very complex language, of course, but it allows a fair amount of flexibility in what the program spits out. The main features of the language are sorting and filtering based on postcode, distance from a coordinate, and based on toilet features and facilities. It also has style which essentially sets the colour of the placemark, and it has push and pop which are mainly there for styling specific parts of the set without actually modifying it. The query in the image above sorts by distance to a coordinate (it was my house but I removed a few digits for reasons) then limits the set to the first 1000 toilets. Then I style the set black, and restyle sections of the set based on their features/facilities. I also colour all toilets within 3km of the coordinate green. Finally I limit the set to 200. This is the output (with different coordinates)That is the result of one night’s work and a set of public toilet data. I’m pretty happy with that. I suppose while I’m at it, I’ll talk about the assembly interpreter I started. In about two days I managed to get a basic virtual architecture going. The assembly is kind of intel based, but very watered down. It is complete with four general purpose registers, a modifiable instruction pointer, and a stack pointer. The instruction set is essentially a mov, a jmp, simple arithmetic add, sub, div, mul, neg. binary operators and, or, xor, not, shl, shr,  + debug which dumps memory and the state of the registers, and print which just prints what ever you pass to it. The word size of my imaginary processor is (purely because I didn’t want to think as much about overflows) 64-bits. Under the hood everything is just a signed long long.

With my assembly and virtual machine, I managed to write a fibonacci sequence generator that stored each step of the sequence in a sequential cell in memory.asmfibcondAt the top of the screepcap is the program that generates the sequence + my instruction pointer/integer math hack for doing conditional jumps without conditional jmps. At the bottom is the state of the registers at the end of the simulation (A, B, C, D, SP, IP) and a dump of memory with the first 10 steps of the fibonacci sequence in the first 10 cells. I plan on doing something like this in a game one day. It’s a lot of fun to play with. Here’s the repo.

manpat

Hello, I’m Patrick Monaghan, a games programmer in training. The purpose of this blog is to track the progress of my various projects relating to game development and various experiments I decide to try.A little bit about myself, I'm fluent in c++. I'm familiar with a few other languages also. I have a working knowledge of blender and gimp, thus can pump out programmer art like it’s going out of style. I’m always willing to learn new things and I always welcome feedback if it means I can improve. Also, here's a youtube channel And my github And my soundcloud Also I'm @_manpat on twitter Finally here's a todo list that I'm putting here so I can't ignore it

Leave a Reply

Your email address will not be published. Required fields are marked *