[antlr-interest] Island grammar implementation

Hiran Chaudhuri Hiran.Chaudhuri at web.de
Wed Jan 12 01:18:55 PST 2011


Hello, everybody. 
I've used ANTLR now for some simple cases, and it worked out quite well. But now I am facing files that can - between other items - contain regular expressions. These regular expressions are driving my lexer nuts as I cannot explain that the same characters mean different things within a regex as opposed to somewhere else in the file. As far as I understood such patterns can be addressed with (parser driven) Island Grammars, where the parser detects when a regex is expected and switches the lexer/parser combination until satisfied. 
However I am lacking a sample how to accomplish this. I looked at http://www.antlr.org/wiki/display/ANTLR3/Island+Grammars+Under+Parser+Control, but it seems like this code does not compile directly (I'm working on ANTLR 3.2), and if I make the necessary amendments, it seems to always run out of heap space. 
Is there another example for Island Grammars controlled through the parser that I could use? 
Best regards Hiran
___________________________________________________________
WEB.DE DSL Doppel-Flat ab 19,99 €/mtl.! Jetzt mit 
gratis Handy-Flat! http://produkte.web.de/go/DSL_Doppel_Flatrate/2


More information about the antlr-interest mailing list