[antlr-interest] "Contextual lexing": Ideas on "nested parsers" and "lexing parsers."
Vaclav Barta
vbar at comp.cz
Tue Nov 27 01:29:18 PST 2007
On Monday 26 November 2007 15:39:04 Harald Mueller wrote:
> runs are discarded; * Or you pass in some information from the outer
> language parser that you are at a place where the inner language should be
> parsed:
>
> cstmt
>
> : 'printf'
>
> '('
> s=STRING {
> // we are now in a printf statment -> parse inner language
> CPrintfLexer innerLexer = ...($s.getText());
> CPrintfParser innerParser = ...;
> ... result = innerParser.format();
> ...
> }
> ')'
>
> | ...
...
> It is straightforward to extend this to more than two nested languages -
> however, I yet have to see an example of a language nested in a language in
> a language ...
I see you aren't using Perl :-) - Perl regular expressions can contain Perl
code, which can contain regular expressions, etc...
Bye
Vasek
--
http://www.mangrove.cz/
Open Source integration
More information about the antlr-interest
mailing list