So... my latest attempt at writing a programming language, which I'm currently caling H2D2
is taking shape. I can build loops, assign numeric
variables and evaluate expressions. It is still only a subset of the syntax from my original DALIS language,
but I am able to write some simple programs now. You know what's coming don't you...? Here's a little something
that I've been working on, do you know what it is yet?
repeat if ((r*r)+(n*n)<4) & h>32
repeat if b<1
repeat if e>-1.2
Yup, it's the famous ASCII mandelbrot. You'll also notice that I've switched to lower case for
the keywords this time round. I got tired of feeling like I'm shouting when writing code. This version
also uses '&' to mean 'logical and', instead of the actual word 'and'.
This is the syntax tree that's created when I parse that code:
Well that's progress. It's not bad considering my C is still rusty, but it's coming back to me. I haven't timed
anything yet, but it certainly feels faster, on my laptop this program draws the mandelbrot set in about one second
I reckon. Of course, I can keep the syntax tree as a kind of compiled bytecode, meaning that the program can
be run without the need for the parser, which would make it faster still.