[antlr-interest] Fast Token-Recognition (Possible in ANTLR?)

Timmy Turner timm.turn at gmail.com
Sat Feb 23 15:44:32 PST 2008


Hi,

I want to find occurences of certain strings in a rather large text.
Like finding {"sdf","foo","bar"} in "asdffoosomerandomtextbar".

Of course I could try myLongString.indexOf(myListOfKeywords.get(i))
but I was hoping to find a faster way. Then I found this here:
http://en.wikipedia.org/wiki/Trie were I couldn't help it but think of
ANTLR (and that chapter about the maze in Terence Parr's book).

So I thought of creating a grammar consiting just of tokens, and
letting ANTLR to generate a lexer for it which then I could use to
spot these strings.

The question remaining is just wther ANTLR really uses tries - or
maybe there's an even better approach?

Thanks!


More information about the antlr-interest mailing list