[antlr-interest] C++-Target - write AST as XML

Jost Baron Jost.Baron at gmx.de
Thu Aug 2 12:53:10 PDT 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Jimi,

I want some form of the input file in a XML representation. If its a
generic AST or something else, doesn't matter, its going to be
transformed by XSLT anyway.

My current problem is to get the AST generation running with the
Cpp-Target: On setting "output=AST;", a ton of error messages is
generated at compiletime. These error messages look like this:

error: TreeType doesn't name a type.
error: ‘struct myParser_timeStamp_return’ has no member named ‘tree’
(a follow up of #1)
error: ‘ADAPTOR’ was not declared in this scope
error: ‘INPUT’ was not declared in this scope
error: ‘EXCEPTION’ was not declared in this scope

Obviously, something is not included or a type not defined - any idea
how to solve this?

Jost

On 08/02/2012 06:27 PM, Jim Idle wrote:
> It isn't clear what you are trying to make in to XML. The input as
> a translation, or the AST itself?
> 
> Either way, this should be a fairly trivial set of methods that 
> recursively walk the AST manually just check what node they are
> seeing. Look at the source code for the dot transformer in the
> ANTLR runtime for a template.
> 
> Jim
> 
>> -----Original Message----- From: antlr-interest-bounces at antlr.org
>> [mailto:antlr-interest- bounces at antlr.org] On Behalf Of Jost
>> Baron Sent: Thursday, August 02, 2012 6:39 AM To:
>> antlr-interest at antlr.org Subject: [antlr-interest] C++-Target -
>> write AST as XML
>> 
> Hi!
> 
> I've successfully created a grammar for some DSL, and now want to
> print an AST the input into XML format. As the grammar is quite
> large (several hundred rules), doing this manually would be slow
> and error prone.
> 
> So my question is: Is there anything that could help me to at
> least partly automatize the xml generation?
> 
> Thanks, Jost
>> 
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest 
>> Unsubscribe:
>> http://www.antlr.org/mailman/options/antlr-interest/your- 
>> email-address
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest 
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJQGtqhAAoJEG6HPMAgWtVzJggQAJVCzY7nzMBTS4HxTDTAyfDT
jwk/vWW/mN4w8SRek31R/tjqhwO/DHKUiz48KNT50hc7dE2ciinkTqHBkNoX7/R7
tzAV3mwJOvYwo2M5KAA6W9iiPtS/x3Al5w1cqiJzWC9ES0cMPaduylEYy14+Ee5y
APp0OVzNwyoGcCdAdsrYsCoVAaeWfu8lCCjVTgGGF1/JIhtGtwm2aqjRUpA6rqly
cosoZoX/FFfbJ8LueA2eqhAwPqk3CC/ZKAfQo1rWCeJXdV3c28745KSjGY0uZs5+
a2uWz7Ao1Rxmag20av07m0zsUNNPXZ7LW5JIfbt98T+5+m+ivn0foaD/vFJb+Etf
lTHN2GbbOvxLMmf00lGxVCF2VS6aeZMHs4Ae3F9aclZ5TujfgCWt5dJcci5DuafE
koSezMWASAUXBJzwgdM6NYaB9lc1Ia3r76IpwsknObEUjIVtfZ34g4kecEP7uXJJ
3oyLJMI9B/dWskWjXGPhscNqM4BWYpRXVrjmHrRStg778JDTcFipmqHaMm+OJJVc
AFFEwzEV8HwNu7ChJY2QPqzdgx9V89G2FuPgh8+FBUSS4XUr+izNGwjg6bVYGdXB
+KsMtjpEa4WidLmaA2mOXk7r58uubtJ5KFc3pxkssYFNq65GHm2q3jzwxSRyO4IC
Vg94foGiloeosOjpZaLf
=2gAE
-----END PGP SIGNATURE-----


More information about the antlr-interest mailing list