Re: Planning Project to use YAPP - confused on AST Tree Walker
Martin Klang <[email protected]> Sun, 22 Apr 2007 21:36:12 +0100
| Newsgroups | gmane.text.xml.o-xml |
|---|---|
| Message-ID | <[email protected]> |
Hello, Interesting question, made me think about parsing issues again. Using XML for intermediary or cross-language formats indeed has massive advantages, and I think we'll see much more of such formats in the future. Antlr does have a strong treewalker component, though I've found it difficult to work with when generating XML (or xml-like) output. The idea with YAPP is that you feed a grammar (in XML format) as the input and you get a parser (an xsl stylesheet) as output. The example with the BNF parser is a bit like pulling oneself up by the straps of one's boots. The resulting BNF parser can parse text- based BNF grammars into the XML format that is used to drive the two main xsl's. Note that YAPP is more a proof of concept than a production-grade tool - ultimately XSLT is not the best language for writing high- performance parsers in. Another o:XML-related project you might want to check out is MLML [1], which aims to be an XML format for representing almost any programming language. It would work very well as the basis for a Javascript representation in XML. There are also some tools available for MLML already, for generating JavaDoc-style documentation in DocBook and HTML, and for producing XMI-format class diagrams. Writing an XSLT stylesheet that can generate valid ECMA Script code from a decent XML-based format should not be too difficult. There is also a framework for compiler construction based on MLML which was created for a commercial, production-grade compiler project - the GPL-licenced portion of the code is in CVS here [2]. I'd be very interested to hear how you progress with this project, so keep us updated! regards, /m [1] http://www.o-xml.org/projects/mlml.html [2] http://cvs.pingdynasty.com/viewcvs/mlml/ On 19 Apr 2007, at 0:53, Cefn Hoile wrote: > I've been seeking a suitable XML format and supporting toolset to > store both an abstract grammar and the mapping from an instance of > the grammar (abstract syntax tree) to executable programs in a > target language. ...