[antlr-interest] Multiple Language Lexers - Single Parser

Daniel Rippel drippel at yahoo.com
Thu Aug 25 06:00:15 PDT 2011



I have a situation where I would like multiple lexers to feed the same parser.
In particular I would like to have lexers that allow a user to write code in their native language.

For example, an English lexer would define
IF : 'if' ;

WHILE : 'while' ;

A German lexer might have (and this is just a babefish lookup)

IF : 'wenn';
WHILE : 'wahrend';

Ideally, these lexers should be able to feed the same parser.

I was wondering what the best approach would be in Antlr.  Any pointers or tips would be appreciated.


This may be a newby question but I could not find answer in the FAQs or recent mail archives.

Thanks,
Dan


More information about the antlr-interest mailing list