[antlr-interest] "Tokens"

Steve Bennett stevagewp at gmail.com
Sun Nov 18 14:47:55 PST 2007


On 11/19/07, Johannes Luber <jaluber at gmx.de> wrote:
> Steve Bennett wrote:
> > On 11/18/07, Johannes Luber <jaluber at gmx.de> wrote:
> > Thanks for that explanation. I guess it would probably be preferable
> > to do something like this:
> >
> > minus: '-';
> > hyphen: '-';
>
> Not with the lowercase names though. ;)

Why not? I was under the impression that a given piece of text will be
labelled as exactly one kind of token, so this wouldn't work:

MINUS: '-';
HYPHEN: '-';

Every '-' would be a MINUS. Whereas by making minus/hyphen parser
rules, every '-' would just be a '-' at the lexer level, but could be
either a minus or a hyphen at the parser level?

(err, I see Gavin agrees with me - should have read first :))

> AFAIK, there is no way. Not that it would be usable for other targets
> than Java, thus limiting the usefulness - unless remote debugging would
> support it.

Pity, but thanks.

Steve


More information about the antlr-interest mailing list