Tue May 21 10:04:00 EDT 2013
Gotten a bit depressed about the state of the C code generator. Maybe
it is time to realize that this is not a simple thing! It's actually
doing a lot of work translating high level concepts into low-level
code and data allocation.
EDIT: Cleaned it up a bit, following the idea that PASS1 builds global
node annotation dictionaries and a half-annotated program tree
containing "postponed" operations in the form of virtual primitives,
and PASS2 completes the annotation from the dictionary info. It seems
hard to factor it into smaller chunks since this requries the
definition of some intermediate language at each point.
Target mapping (-> C) is straightforward if the PASS2 output is
structurally C-like and fully type-annotated, and can be done in a
single pass (PASS3).