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

Jim Idle jimi at temporal-wave.com
Thu Aug 2 09:27:59 PDT 2012


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
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> 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
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQIcBAEBAgAGBQJQGoMHAAoJEG6HPMAgWtVzIjkQAIVC9EbzPHicbNobJIDCfrG/
> VGZf98X+9ljD5wrMH2OStQym9wt1TDJQC98RcqTNmhiL0LcQrIHGFZQkqQ+uuj9h
> Ei53bxhp4dAjnCIZTtnK+mUEmFpPjNFy4eLqr2QLiouEjfWItW4k63kEimGf2V0G
> x2ZjMEmRXBDe1C7t//5HxN0DMGmhL0tH7cLHFEBTDzic92LbkhaQHrqvKI2R2MSq
> lEPNN7ASlSPXQYifQP83Hyoq340hiyDdeg55I6l60Fdpx0QPURKHD3GVe5KzH2h9
> giNvpeDzXsTvo4aswDvsg+UU67K//91sxzVVFkcsS3OqVib3hJ7ancX0vmQEA4tT
> KbasRb4M6AA3WYvkNis7bnCpeV4hBeSeq/jmFSASuG6spqR/zFEIMCxo8QIDkwfC
> Do/U9iNoiDXo2WTQYMSEkTcTV9cmvixJfalSvDi23i05UehVYuN17YgT4VeYFjHU
> JZRoJFc1mXNrPzgK1Ivn5Ti0+F6yu/CFbz3eaINaY+fysD8yHQjHJlUkBq9RyP4h
> w5SGdW0S+z96+lMjcczKl6q/HrxOdHu7CBQorpRfVocD3V94QDHNGQdvJJOYjxYu
> tmjuBnJGwAPd3M1rA5f/zwcW+AP8g70cdaN343Shm90E/qMp7S0mpVU7djQiEXLA
> XDCH960jrNOOKXninVQX
> =DBwi
> -----END PGP SIGNATURE-----
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address


More information about the antlr-interest mailing list