[bitc-dev] Surface Syntax (again)
Jonathan S. Shapiro
shap at eros-os.com
Wed Feb 25 11:02:18 EST 2009
The BitC s-expression syntax is now showing a lot of strain. While
s-expressions make a great deal of sense as an expression syntax, they
aren't that great for declarations. The most recent example is that we
wanted to discriminator tag values in unions, and there doesn't seem to be
any graceful way to do it.
You all know that I've done some preliminary work toward a post-sexpr
surface syntax. Most of it looks straightforward. There are two issues that
I have run into:
1. I am having difficulty coming up with a sensible syntax for loops. The
statement-style syntax doesn't seem to lend itself to a functional
(non-stateful) loop idiom. I would appreciate suggestions on this.
2. I'm increasingly convinced (however reluctantly) that mixfix is important
in a non-sexpr surface syntax. The problem with this is that (a) there are
no parser generators that seem to support this and (b) writing a parser for
the non-sexpr syntax by hand is probably not the best way to coverge on a
syntax. Once the syntax is stable it's not a problem, but hand-written
parsers do not tend to be easily modified or easily validated.
Can anyone point me at a parser generator that can be made to handle mixfix,
or suggest some means by which an existing parser generator might be kludged
into service at the semantic actions level? As a concrete example, I have
considered a parse strategy in which the parser builds a list rather than a
tree and the semantic action pass decides how to recover a tree from the
result. Are there examples of this sort of thing being done successfully?
I'm prepared to build a parser generator; I would just prefer not to do one
that is excessively clever. :-)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the bitc-dev