[antlr-interest] ANTLR v3 Syntax Questions: !, [squareBrackets]; Tree Building
Randall R Schulz
rschulz at sonic.net
Mon Nov 20 09:15:46 PST 2006
Hi,
In reviewing the v3 examples I noticed this (from
the "examples-v3/simplecTreeParser/simplec.g" example):
stat: forStat
| expr ';'!
| block
| assignStat ';'!
| ';'!
;
What do the trailing exclamation points mean?
-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
In the slide show at
<http://www.antlr.org/workshop/ANTLR2005/presentations/ANTLR-v3.ppt>
there are some snippets of ANTLR v3 rules that look like this:
a[String s] returns [float y]
: id=ID f==field (ids+=ID)+
{$s, $y, $id, $id.text, $f.z; $ids.size();}
;
field returns [int x, int z] : ... ;
How are these rules (or fragments thereof) interpreted?
I'm also wondering how these features, which I gather have something to
do with the results or return value from a given rule activation,
relate to or interact with the tree-building constructs that are
specified using the "-> ..." notation. Are the constructs shown in the
example above allowed with the grammar option "output = AST;"?
Thanks.
Randall Schulz
More information about the antlr-interest
mailing list