I have added two helper functions, but since they are used in contexts that are already specific to C++CSP (i.e. the channel-ends have the ">>" and "<<" operators applied to them) I have not added them to the dictionary of functions.
This patch allows C++CSP to actually use the direction of channels to pass around channel-ends rather than channel pointers, just as C++CSP was designed for.
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 similar (but not identical) to the change Adam was doing at the same type for occam.
I think the main difference is that rather than returning () from parsing a reserved word,
I return Meta so that you can easily write rules like:
do { m <- sSemiColon ; return $ A.Skip m}
The tests have also been updated to use the new parser, and fail on either a lexing or a
parsing error.
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.
CompState now contains Sets and Maps, which aren't instances of Data and thus
break pshow. This could be fixed in the future by providing instance
definitions, assuming the GHC library maintainers don't beat us to it.
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".