[antlr-interest] running a second lexer on unbounded input

Ernest Pasour Ernest.Pasour at sas.com
Thu Dec 4 07:09:32 PST 2008


Gavin,

Thanks for the suggestion.  The parser strategy may be too complicated for me, but at least I have some ideas about how it can be done now.

-Ernest

-----Original Message-----
From: Gavin Lambert [mailto:antlr at mirality.co.nz]
Sent: Tuesday, December 02, 2008 3:16 PM
To: Ernest Pasour; antlr-interest at antlr.org
Subject: Re: [antlr-interest] running a second lexer on unbounded input

At 08:52 3/12/2008, Ernest Pasour wrote:
 >I have been working with a grammar for ActionScript, which is a
 >rather freeform language.  One expression type that is allowed
in
 >the source code is raw xml.  For instance, the following code is

 >legal:
 >
 >var x:XML=<a>
 >   </a>;

If you can detect the use of XML purely at the lexer level, then
you can use a lexer "island grammar" -- see the ANTLR example
grammars for more info.

If you can't detect it until it reaches the parser, then things
get a lot more complicated, but have a look here:
   <<http://www.antlr.org/wiki/display/ANTLR3/Island+Grammars+Under+Parser+Control>http://www.antlr.org/wiki/display/ANTLR3/Island+Grammars+Under+Parser+Control>




More information about the antlr-interest mailing list