This is a compiler I wrote back in the days. It is actually in QBasic because I did not have anything else available (I only got hold of Linux 0.99 a while later.) The output were DOS .com files which have the most simple memory model available on DOS/Windows.
The most remarkable thing I remember is that I used a lisp s-expr style
representation for the parse tree; since basic data structures were lacking
(and because I wanted the short syntax of car(a)
and cdr(a)
) I used two
arrays car
and cdr
where the same place in both formed one cons cell;
positive numbers in the array referred to other cons cells, negative one