Re: [antlr-interest] Character replacement in the lexer
> "Anna Winkler" <awinkler@...> writes:It sounds to me like you need to use a parser, rather than just the
> I'm trying to replace characters using a lexer. Example of
> <> becomes !=
> x[1,2,3] becomes x
> The problem I'm having now is that an array index can be a function
> call, and a function call can have expressions. At the moment I'm
> looking at copying my expression hierarchy into this lexer, is that my
> only option?
> Example of what I'm talking about:
> x[foo(1, 2*3), 3] becomes x[foo(1, 2*3)]
lexer. A parser can translate your source into tree form. A tree
walker would then translate the tree into a tree for the new
language. The new tree would then be translated back into text.