I finally put up the CongoCC repository here. At the moment, it's really just the last JavaCC21 with some various renaming and also, support for all the legacy JavaCC constructs (at least the ones that occurred to me!) is now GONE. So, now, both syntactic and token productions are terminated with a semicolon, not enclosed with braces. Not only do you not have to write: Options {....} at the top of the file. You cannot! You also cannot write:
=> Foo Bar Baz
You must write:
Foo Bar Baz =>||
You cannot write:
LOOKAHEAD(2) ...
You must write:
SCAN 2 ....
though up-to-here notation is usually preferable since it tends to be more robust to evolution and (at least IMHO) more readable.
In general, the syntax converter I announced recently should deal with such things and convert any older grammar to work with Congo. Well, there probably are some glitches but it surely does most of the work...
Congo does not come with the syntax converter, by the way, since Congo doesn't "know" how to parse the older constructs! So anybody who wants to convert the syntax, has to use the latest javacc-full.jar
. However, why would anybody want to convert the syntax if they weren't already using that? Well, they could be using legacy JavaCC, I grant, and jumping straight to Congo without passing via JavaCC21. That is possible, I guess. But, in the new magical land of Congo, we don't have the older syntax. It's all behind us and any docs we write for Congo will basically not mention it. Well, maybe at the footnote level, but maybe not even. Well, maybe one page somewhere that details the main conversion issues, and points people to using the syntax converter and that's that. But no new user should even know about the older syntax.
I changed the semantics of:
SCAN {condition()} => SomeExpansion
to mean that in addition to checking the condition, it looks ahead ONE token. In legacy JavaCC,
LOOKAHEAD ({condition()} SomeExpansion
checked the condition and nothing else. Zero tokens lookahead. You could get that by writing:
SCAN 0 {condition()} => Foo Bar Baz
On reflection, I thought that defaulting to a one-token lookahead if nothing is specified is more consistent. The way I had it before, that if you didn't specify anything else, it would do an indefinite scan to the end of the expansion, that this would end up with people writing potentially expensive indefinite lookaheads without intending to. You can of course write:
SCAN {condition()} => Foo Bar Baz =>||
and it will scan to the end, if you want, but that is your stated intention then. I put in a little warning, BTW, to warn people about this change in semantics.
The LEGACY_GLITCHY_LOOKAHEAD
setting can still be set but it is off by default.
Well, that's enough said for now. There are another couple of things I want to mention, but I'll bring them up separately. I have to run off to a restaurant to meet people for dinner.