[antlr-interest] Syntactic and semantic predicates don't work in ANTLRWork's "interpreter"?

Steve Bennett stevagewp at gmail.com
Sat Nov 17 07:52:31 PST 2007


Hi all,
  (First post!) I'm enjoying playing with ANTLRWorks but seem to have just
hit a gotcha. I spent hours trying to work out how to use syntactic and
semantic predicates, and finally it seems that the problem is just that the
Interpreter doesn't support them. Is that true? Perhaps it could just say so
rather than make the user tear their hair out...

Here's my grammar, just in case I'm missing something:
---
grammar magicword;

f : t ('|' option)*;
option : (magicword '|') => magicword
| t;

t : LETTER;

magicword
: 'magicword';

LETTER : ('a'..'z' | 'A'..'Z')+;
---

I honestly thought I just hadn't understand syntactic predicates for ages,
then on a whim tried the debugger...and it actually worked.

Anyway, hi, everyone! Looking forward to learning ANTLR a lot better and
making sure I get my head around all these constructs. Apart from the book
and the wiki, are there any other good resources that would help answer
questions like "I need to parse X, what's the best way to do it?"

Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20071118/d62ccf08/attachment.html 


More information about the antlr-interest mailing list