[antlr-interest] Multi-level format parsing
Ivo.Spaleny at bsp.cz
Wed May 10 14:54:46 PDT 2006
How can I create a grammar for multi-level parsing in ANTLR?
For an example - encoded literal, quote escaped. I need to read and parse code in its value too.
CodeParam = "Var2 = ""text"""
where CodeParam includes another code:
Var = "text"
So the resulting tree is something like this:
(to avoid semigraphics experiments, I used XML-like tree)
I can define a grammar rule:
stmt_assign : LITERAL EQU QUOTEDLITERAL ;
And later, after 1st level parsing, I remove quotes from QUOTEDLITERAL and parse it again.
But I would like to add this code directly to ANTLR grammar.
Thank you for any suggestions,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the antlr-interest