I have a complex grammar (900 lines) that parses incorrectly sometimes.
The grammar is basically just an Antlr transformation of the ETSI
defined TTCN3 BNF.

Here is a snippet from my grammar (modified for simplicity):

  assignment: ref '=' exp ';'? ;
  ref: ('a' .. 'z' | '_') ('.' ('a' .. 'z' | '_'))* ;
  exp: addExp ('+' addExp)* ;
  ... "a lot of math exps of different precedences"
  unaryExp: ('-' | '+')? primary ;
  primary: opCall | value | '(' exp ')' ;
  opCall: "this is a quite complex rule"
  value: INT | ref ;

Now if i parse:
  v_some_var = v_some_other_var;

I get:
  line x:y no viable alternative at input ';'

I suppose its because it expects '(' following a opCall-name or
something, though im not sure.

If i change the definition of primary to:
  primary: value | opCall | '(' exp ')' ;

It parses correctly.
I have backtrack and memoize set to true.

I just dont understand why Antlr wont even try the second option in
the 'primary' rule, before reporting an error, this seems wrong to me.
Could someone please shed some light on this for me?

Best Regards Gustaf

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to