[antlr-interest] To match or not to match

Raphael Reitzig r_reitzi at cs.uni-kl.de
Fri Jun 20 05:52:52 PDT 2008


Hello!

I am quite a novice to ANTLR as well as language parsing at all, so perhaps
I dug in a bit to quickly (got The Book the day before yesterday). Anyway,
I try to build a grammar I need for a job at university and get some
strange results I do not understand. I hope file appendings work on the
list.

Using ANTLRWorks' Interpreter, I try to match the following sentence
against rule 'atom':

Min(4,3)=x

It works perfectly. It should match rule 'property' as well (last
alternative: 'property : ( atom ) => atom;'), but trying that yields
FailedPredicateException. (I (think I) need the predicates to help LL(*)
along with multiple '('s in a row.) Exactly why does the predicate become
false _if_ the checked sequence _is_ an atom?

Matching Min(4,3) alone against 'term' I expect to work, for it did,
matching the statement given above against 'atom'. However, it fails
without exception, aparently not recognizing ',' correctly.

I would not be surprised I if made a (simple?) systematic error. Can you
help me?

Greetings from Germany

Raphael Reitzig



More information about the antlr-interest mailing list