[antlr-interest] Newbe lexer question

HC canterburry at gmail.com
Sun Nov 12 13:50:39 PST 2006


Hey all,

I am very new to Antlr and I am evaluating it for a project. To begin, I
have two quick lexer questions:

1. Can (an what would a pseudo lexer rule be) antlr handle the following
scenario easily:

Let's say my lexer needs to be able to tokenize the following strings:

a) "car"
b) "bus"
c) "bus car"

It is fairly easy to write a rule for antlr that is smart enough to
recognize the string "bus car" as token C and not as token B followed by
token A?

2. Can I pass strings to be tokenized into the lexer from outside the
grammar file?

Let's say I have lexer rule called WORD which may be any character sequence
which I specify externally. I am looking to maintain an external dictionary
of words which are valid WORD tokens which can be expanded and reduced by a
user without modifying the grammar file.

Am I using Antlr in the right context here?

Thanks
-HC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20061112/15db9482/attachment.html 


More information about the antlr-interest mailing list