[antlr-interest] Just plain var or $var.value?

Olivier Lefevre lefevrol at yahoo.com
Thu Jan 31 09:42:07 PST 2008


Still reading the book. Comparing tour/tree/Eval.g
and tour/eval/Eval.g I was struck by the difference
between, say, "a+b" in the former vs. "$e.value" in
the latter. I tried changing accesses in the first
file from the "var" to "$var.$value" form and vice-
versa in the latter file and in both cases it seemed
to work.

This is a bit confusing. Is it a kind of syntactic sugar?
Clearly the two forms are not always equivalent since,
e.g, replacing "$e.value" by "e" in the latter file is
ok but if you replace "$expr.value" by "expr" antlr does
not complain (maybe it should?) but EvalParser will not
compile. What is going on here and in which section of
the manual is it fully spec'ed out?

Thanks,

-- O.L.



More information about the antlr-interest mailing list