[antlr-interest] speaking of => etc...
mental at rydia.net
mental at rydia.net
Thu Dec 8 12:08:05 PST 2005
Quoting Terence Parr <parrt at cs.usfca.edu>:
> So, we have a syntax / notation problem for predicates now. I am
> proposing the following new notation:
>
> [...] optional subrule
> (...)? syntactic predicate
> a : (alt)? | ... ; syntactic predicate wrapping whole production
> {...}? _hoisting_ disambiguating semantic predicate
> {...}=> gated semantic predicate
> rule rule reference
> <rule(args)> rule reference with args
> ID token reference
> <ID(args)> token reference with options
>
> The blog shows my reasoning:
>
> http://www.antlr.org/blog/antlr3/lookahead.tml
Hmmm. Two thoughts:
1. If you're keeping (...)* and (...)+,
it'd be weird having(...)? do something totally
unrelated. I know I'd keep typing (...)? when I meant
[...] right next to a (...)* or something.
Maybe make them [...]* and [...]+ instead also?
That way, [] is consistently used for grouping where there
are optional occurrences.
Alternately, perhaps leave (...) alone, and give [...]? to
syntactic predicates?
2. If we've got <>, why also parens? It seems a bit
belt-and-suspenders.
<LCURLY type=BLOCK, text="BLOCK", line=n>
Would that introduce any ambiguities? It seems more
readible, but I don't know offhand what's allowed as
an argument value.
-mental
More information about the antlr-interest
mailing list