
I started writing a new parser in order to support the static binary translator suite -
my intention was for the SBTs to output the translated binaries as C source, and pipe
that C source through a source-to-source optimiser, in order to remove redundant loads
and dead stores, which arise primarily from machine code instructions setting flags
that are never tested in the condition code.

During this exercise I rediscovered my enthusiasm for writing parsers, and the SBT
filter for C grew into a project to write a complete parser system capable of compiling
not only C but other languages as well.  I tested the new parser using a grammar for
the Imp language because I was simultaneously working on a couple of projects related
to Imp compilers.

I've written several parser systems in the past but this one gets all the tricky
bits right and adds all the best features from the various different parser styles
in the one place.  Nevertheless this remains a standard Edinburgh-style top-down
recursive-decent parser with arbitrary lookahead, in the tradition that was started
by Tony Brooker with the Compiler Compiler and Atlas Autocode, his answer to the
shortcomings of Algol. (As was said at the time, AA was a language with 90% of the
power of Algol that required only 10% of the effort to write the compiler).

Anyway, since this project is no longer just SBT related, I've moved the parser to
a more appropriate location: https://gtoal.com/compilers101/edinburgh-parser/

The project to convert the Imp77 compiler from Imp to C in order to have a fututre-proof
bootstrap is at https://gtoal.com/imp77-in-C/

The SBT project remains in the parent directory of this note, i.e. https://gtoal.com/SBTPROJECT/6809sbt/

The other Imp-related project is an Imp to C translator.  The Imp77 compiler mentioned
above was translated into C with the help of an earlier version of Imp to C, which you'll
find in gtoal.com/src/imp2c (in particular https://gtoal.com/src/imp2c/imp2c.e.html ),
plus a lot of hand tweaking after the initial rough conversion.

I'll be re-implementing Imp to C with the new parser shortly, and expect it to be
able to fully convert an Imp source to C without needing manual tweaking.

Graham Toal. 2022/02/18
