February 28th, 2004


writing a language and update

A few days ago I decided to write my own programing language, an interpreted one. There's no reason behind this. I just wanted to do one from scratch. There's only three data types so far: integer, string and stack. The latter being a LIFO stack able to push/pop any of the three types. For control statements I've got for/next, if...then/else/end, repeat/until, goto, on...goto implemented but no while yet. I haven't decided whether to do a switch/case method. I really should though. Today was spent getting procedures up and running. I had planned the language to be executed as it was being parsed but that got tricky when it came to doing anything with branches. I really didn't want to get into bytecodes so instead I do a quick initial parse looking specifically for control structures and procedures, and keeping track of the line numbers in indexed arrays so when executing the source branches can be done quickly. So far, the program is 1501 lines long. I definitely need to add two more data types: real/float and structures. The stack type can basically take the place of arrays if I add a method to reference the elements directly besides pushing & popping. I still haven't implemented functions just yet. I'm unsure how I want to handle assigning return values.

Edit: Whoops, I forgot there's a fourth data type: labels. Only used for targets of goto and on...goto statements therefore are not stack-able.

Nothing else too exciting to report. Did a bit of vacuuming and dusting. Then watched two DVDs: "Ghost in the Shell" and "Kung Pow! Enter the Fist".

I should pass this link to silliness along: photowar
  • Current Music
    Shane MacGowan and Sinead O'Connor - "Haunted"