[antlr-interest] dfa-based lexers versus top-down antlr lexers

Terence Parr parrt at jguru.com
Wed Apr 30 09:19:58 PDT 2003


On Wednesday, April 30, 2003, at 07:33  AM, Andrew Deren wrote:

> I was going to build a hand coded lexer for my project, but couldn't 
> fine
> much info on it. Can you please send me one of your lexers to look at 
> so
> that I can figure how to do. If they are available of course and not
> commercial.

Here is a lexer that constantly returns INT:

public void INTConstantTone implements TokenStream {
	public Token nextToken() {
		return new CommonToken(INT);
	}
}

;)

Actually, you should check out my book draft on building translators by 
hand: this has lots of lexer stuff in there.

Terence
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Co-founder, http://www.peerscope.com link sharing, pure-n-simple
Lecturer in Comp. Sci., University of San Francisco


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list