[antlr-interest] XML island grammar

Matthieu Riou matthieu at offthelip.org
Sun Oct 7 22:34:42 PDT 2007


Hi,

I have a main grammar that can embed some pieces of XML. A bit like E4X in
Javascript if you're familiar with the language. I'd like to handle this
with an island grammar but I'm not so clear on how to do detect the XML
block. I've had a look at the javadoc island grammar example which gives me
a pretty good idea of how to delegate parsing. However detecting XML in the
middle of some code is not as simple as with Javadoc (you can assume /** to
be a uniquely used token but not <).

Here is a code snippet of what I'm trying to parse:

process ExternalCounter {
  receive(my_pl, start_op) (msg_in) {
    resp = <message><counter>0</counter></message>
    while(resp.counter < 10) {
      invoke(partner_pl, partner_start_op) (msg_in)
      resp = receive(partner_pl, partner_reply_op)
    }
    reply resp
  }
}

Any help, idea or pointer would be great. Thanks!

Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20071007/c1cf0734/attachment.html 


More information about the antlr-interest mailing list