[antlr-interest] On to the next issue: error(211)
Hendrik Maryns
qwizv9b02 at sneakemail.com
Mon Nov 10 03:33:08 PST 2008
HI,
Ok, so the ‘token file not found’ issue seems to be bogus, but here is
the next problem with my grammar:
error(211): fsqTreeParser.g:68:3: [fatal] rule body has non-LL(*)
decision due to recursive rule invocations reachable from alts 3,5.
Resolve by left-factoring or using syntactic predicates or using
backtrack=true option.
Strangely, the parser grammar contains the exact same rule, but does not
give this error message.
Here is the relevant rule:
body returns [Formula result]
: label { $result = $label.result; }
| atomic { $result = $atomic.result; }
| unary { $result = $unary.result; }
| binary { $result = $binary.result; }
| n_ary { $result = $n_ary.result; }
| quantor { $result = $quantor.result; }
;
Indeed, the unary, binary, n_ary and quantor rules (indirectly) refer to
formula:
formula returns [Formula result]
: ^(FORMULA body) { $result = $body.result; }
;
What would be the proper thing to do here? Adding backtrack=true does
fix it, but I am not sure whether that is a good idea?
You might notice that I am trying to implement a parser for some logic
here.
H.
--
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 257 bytes
Desc: OpenPGP digital signature
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20081110/abd4cd59/attachment.bin
More information about the antlr-interest
mailing list