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

Loring Craymer lgcraymer at yahoo.com
Sat Feb 23 16:13:24 PST 2008


This is not a token recognition problem; it is a string search problem.  See http://en.wikipedia.org/wiki/String_search as a starting point.

--Loring

----- Original Message ----
> From: Timmy Turner <timm.turn at gmail.com>
> To: antlr-interest at antlr.org
> Sent: Saturday, February 23, 2008 3:44:32 PM
> Subject: [antlr-interest] Fast Token-Recognition (Possible in ANTLR?)
> 
> 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!
> 




      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping


More information about the antlr-interest mailing list