It looks like just a simple change was needed to make this work. Other changes can be made to make the xml output prettier. And you can create xslt to make it compatible with other AST representations out there like JavaML or .NET CodeDom, or do things like transfer the AST XML back into boo code.
Changes:
- In boo.lang.compiler/ast/node.cs, add an [System.Xml.Serialization.XmlIgnore] above the Entity property (line 95). (otherwise you get an error because an interface type (IEntity) can't be serialized)
- Add this to boo.lang.compiler/ast/statement.cs
[System.Xml.Serialization.XmlInclude(typeof(MacroStatement))]
Optional to make the XML a little prettier:
- Insert this at line 255 in scripts/astgen.boo:
if field.Name == "Name":
writer.WriteLine("""
[System.Xml.Serialization.XmlAttribute]""")
- Add an [System.Xml.Serialization.XmlAttribute] or [System.Xml.Serialization.XmlIgnore] above the IsSynthetic property in Node.cs.
I'll post a note to boo-dev with a sample script and its output.
It looks like just a simple change was needed to make this work. Other changes can be made to make the xml output prettier. And you can create xslt to make it compatible with other AST representations out there like JavaML or .NET CodeDom, or do things like transfer the AST XML back into boo code.
Changes:
[System.Xml.Serialization.XmlInclude(typeof(MacroStatement))]
Optional to make the XML a little prettier:
if field.Name == "Name":
writer.WriteLine("""
[System.Xml.Serialization.XmlAttribute]""")
I'll post a note to boo-dev with a sample script and its output.