RE: Quasi-Literals & XML Monty Zukowski (mzukowski@bco.com)
Fri, 12 May 2000 15:26:00 -0700

Just a note on this excerpt from your proposal:

Example: Defining DTD-Specific Grammars
The following grammar is written in a hypothetical variant of BYacc/Java or ANTLR in which the actions are XML quasi-literal strings as supported by Step 1 above. (We would probably create an ANTLR wrapper.)

expr:

      mult

| a:expr '+' b:mult { <apply><plus/>$a$b</apply> }
| a:expr '-' b:mult { <apply><minus/>$a$b</apply> }
;

mult:

      pow

| a:mult '*' b:pow { <apply><times/>$a$b</apply> }
| a:mult '/' b:pow { <apply><divide/>$a$b</apply> }
;

pow:

      prim

| a:prim '**' b:prim { <apply><power/>$a$b</apply> }
;

I know you have worked a lot on your quasi notation, but I found what might be another source of ideas. I recently stumbled across "bigwig" http://www.brics.dk/bigwig/ which has a really nice framework for filling in HTML templates with "gaps" -- the cool thing is that the html is embedded in the language which can do flow control analysis to make sure all the "gaps" are filled in before the document is sent back, and also make sure that the gaps are not filled in twice. The analysis isn't perfect but it is pretty cool. I haven't played with it much yet though. Not that this has anything to do with your proposal....

I like your proposal. As far as the ANTLR stuff is concerned, it breaks down into three parts:
making the tree grammar work
with xml
making the tree grammar generate code in E or E-accessible Java translating the actions into quasi notation code

Antlr itself has the ability to plug in new code generators, so you may not have to wrap antlr. Instead just implement a different code generator and action translator. Since E can use java classes, you can use the existing java support classes for streams and such.

I'll have to investigate DOM to see where there might be mismatch between it and ANTLR's tree model. I'd love to have this easy kind of tree transformation notation in ANTLR.

Monty