I've recently started learning Antlr and downloading AntlrWorks 1.4 which supposedly includes Antlr 3.2. Now, 3.2 is supposed to support the rewrite rules grammars like '->' but I've not been able to get even the simplest case I could construct to work either based on Lexer or Parser rules:
grammar TestRewrite;
ab : a b -> a;
a : A;
b : B;
A : 'a';
B : 'b';
When I try to compile this, I get the error:
[11:26:29] error(100): TestRewrite.g:3:13: syntax error: antlr: TestRewrite.g:3:13: unexpected token: a
Why is this. The construction seems simple enough: ab should generate a tree where only the a node is captured. Isn't that how you do it? I can't get it to work with rooting ('^') or ignoring ('!') either. I've very confused.
options {output=AST;}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With