I am trying to get the (singular ... theres only one, and its nearly 10
years old!) C++ grammar to work with JTB and JavaCC. It p***** through
JavaCC fine, but when you run it through JTB first, the resulting
grammar produces lots of errors, as many others on the NG have attested
to.
In particular it generates a lot of lines like
sc=n3=function_declarator(isTypedef)
which JavaCC chokes on. I have attempted to rectify these by changing
them to
{
n3=function_declarator(isTypedef);
sc=n3;
}
Doing so gets rid of the errors anyway ... However I am now stuck on a
new problem. I get 21 of these:
Error: Line 374, Column 7: Expansion within "(...)?" can be matched by
empty string.
The offending section is
....
|
LOOKAHEAD("enum" ( <ID> )? "{")
{ n5 = new NodeSequence(4); }
n6=enum_specifier()
{ n5.addNode(n6); }
*** (
n8=init_declarator_list(false)
{ n7.addNode(n8); }
)?
{ n5.addNode(n7); }
n10=";" { n9 = JTBToolkit.makeNodeToken(n10); }
{ n5.addNode(n9); }
{ n0 = new NodeChoice(n5, 1); }
|
....
(*** is line 374). The corrresponding section in the original grammar
is
....
|
LOOKAHEAD("enum" (<ID>)? "{")
enum_specifier() (init_declarator_list(false))? ";"
|
....
Can anyone tell me what I need to do to rectify this please?
Thanks,
Alan.


|