As Neil pointed out, I'd already added some rules to PrettyShow to handle the
Maps in CompState; this does the same for the Sets, which means it's pshow-able
again.
Neil spotted that I'd broken the C++CSP backend with these changes, and I
wasn't very happy with what I'd done anyway, so this is take 2. Now there's a
separate pass that runs before GenerateC which builds a set of functions used
in PARs.
Since the set of passes that runs now depends on several variables, there's now
an expression which builds a list of passes to run; this should be easier to
extend in the future.
This is the code that expands array and record assignments out into multiple
assignments. Having it done as a pass means it can do a better job -- this
fixes some problems with cgtest56 where the old version of the code couldn't
handle record assignments from literals.
This is the first pass that's had to add a replicator to the tree, so this also
introduces a helper function for generating new replicator counters.
This means that field names end up as "foo_u123" rather than "foo" in the
generated source -- which is a good thing, because some of the cgtests use
field names like "bool" and "int".
The occam parser is now a GenParser Token OccState, rather than a GenParser
Char OccState, and a lot of now-redundant code has been removed. The parser is
also somewhat faster, which wasn't intended but is nice anyway.
I've also modified the Rain parser to not rely on the old preprocessing code;
it wasn't appropriate for Rain's syntax anyway, so I assume Neil will be
replacing it eventually.
The parser now gets a stream of tokens, rather than needing to worry about
loading files itself.
This also reworks the lexer's idea of what constitutes a Token -- it's now a
pair (Meta, TokenType), so it's always easy to pull out/rewrite the metadata --
and adds proper support for lexing preprocessor directives, rather than just
treating them as reserved words.
The compiler itself is under the GPLv2+; the support code that gets built into
user programs is under the LGPLv2+. This matches the existing practice for the
KRoC project.
(As with Occade, I've used the new GPLv3-style license header in the source
files, though, since that avoids having to update the FSF's postal address.)
This does about the minimum necessary for assembly analysis to work. It assumes
that any function it hasn't been able to analyse itself needs 512 bytes (most
need far less); it doesn't do any flow analysis; it doesn't do a lot of sanity
checking. However, it produces sensible numbers, and works with the demos I've
tried so far.
I was originally going to make this a separate tool, but there are a number of
bits of the code can be nicely reused, so it's a separate "operating mode" in
the existing program (as is parse-only mode now).