I have built a parser that directly emitted XML. The XML was then passed to a XML treewalker.
Emitting XML from the parser instead of an Antlr common tree structure is quite simple to do. On 9/25/11 9:32 AM, "Jeremy Long" <[email protected]> wrote: >Mari, > >Did you ever get an answer to this? I agree a pointer or example on this >would be extremely helpful. I will be doing something similar very soon >for >a project where I will be generating different nodes/objects from the >input. > Which is the better approach? > >For my purposes I am planning on populating a Neo4J graph database and >I've >been trying to figure out the best way to do this. > >--Jeremy > >On Fri, Sep 23, 2011 at 5:33 AM, Mari Matinlassi ><[email protected]>wrote: > >> Hello, >> >> I want to build custom object trees from text. As a simplified example, >> parser input is >> >> Car Seat; >> Car Audi; >> Customer John; >> >> Parser output shall be an object tree where e.g. Car object is an >> instantiation of a class below (Respectively, Customer class would be >> something similar): >> >> public class Car >> { >> private string brand; >> public Car(string _brand) >> { >> this.brand = _brand; >> } >> public string Brand >> { >> get { return brand; } >> } >> } >> >> What is the best way to do this? Custom AST node and custom TreeAdaptor? >> Tree parser with actions embedded in rules? What about the problem that >>not >> all the nodes are similar? Could you please give me some hint to the >>right >> direction? >> >> Kind regards, >> >> Mari >> >> >> >> 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 List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
