[antlr-interest] Using different tokens for the same grammar
Greg Lindholm
glindholm at yahoo.com
Thu Jun 6 17:05:59 PDT 2002
An easy way is to define both french and english tokens in the parser
then then put a filter on the TokenStream between the lexer and the
parser that maps the french tokens into english (or visvera).
If you want to be totally dynamic you would need to set
"testLiterals=false;" to turn off ALTLR's logic then write your own
"test literal" routine that does a "$setType(myType)" then you could
load them from a file or whatever.
Greg
--- dspiess_mk <dj at gamethingy.com> wrote:
> Hi,
> I've inhierted a project that uses antlr, and I am trying to localize
>
> the application. Is there an easy way to swap out what the valid
> tokens are, but keep the grammar the same?
>
> For example our application builds mathematical expressions for
> evaluation. The English version has a function called average(i,
> i2, ...) where the user specifies the function average and several
> parameters. In French, this needs to be moyenne(i, 12, ...). The
> parsing is the same, just the keyword is different.
>
> Is there a way to specify the tokens at runtime instead of compile
> time? I really don't want to have to support different compiles for
> each localized version of our java app.
>
> Thanks for any help!
>
> Daniel Spiess
>
>
>
>
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list