AW: [antlr-interest] serialization and IOStreams
Murat Ozcan
murat.oezcan at isis-papyrus.com
Mon Dec 9 06:44:15 PST 2002
thank you for the quick answer- but i think i can't really follow you. is
the ANTLR_SUPPORT_XML a new feature- i am using currently version 2.7.1, and
it doesn't seem to have any of the features you mentioned (in C++ libraries
at least) the alpha version 2.7.2 on the other hand, doesn't seem to have
the C++ header files. i guess they are not yet updated or something.
i also looked for the methods you mentioned in ASTFactory- well, again in
the C++ version those methods simply don't exist. is there a newer version
than 2.7.2.a5 (which i also took a look at, but as mentioned this one
doesn't seem to have the C++ libraries, i.e. the header files and so on)
thank you in advance for your patience
murat
-----Ursprungliche Nachricht-----
Von: Ric Klaren [mailto:klaren at cs.utwente.nl]
Gesendet: Montag, 09. Dezember 2002 15:09
An: antlr-interest at yahoogroups.com
Betreff: Re: [antlr-interest] serialization and IOStreams
Hi,
On Mon, Dec 09, 2002 at 12:52:09PM -0000, gurkowsky2000
<murat.oezcan at isis-papyrus.com> wrote:
> i am currently developing a small language in C++, where the parser
> is generated by antlr, and the commands are my classes which are
> based on the BaseAST. since these are small programs in a distributed
> environment, i need to get the generated trees serialized. is there
> anybody who did something like this and would be ready to share
> experiences with me?
> i must add, that i am trying to avoid altering the base classes which
> are delivered with antlr. this would make it difficult for me to keep
> with the newer versions of antlr. perhaps this could be included in
> the base classes as an extension? at least the operators "<<"
> and ">>" could be overriden- perhaps the easiest way of enabling a
> generic serialization (?)
There's some rough-ish stuff to write out trees in XML in the classes.
Compile with ANTLR_SUPPORT_XML defined then in your derived classes
override the toStream methods to customize your output.
operator<< works by calling the derived classes toStream methods (pretty
common way to do these kindoff things).
operator>> is a bit of a different problem. Think it's not possible to
implement reading in the sense of a operator>> since things have to got
through the ASTFactory to work in the most general heterogenous AST case.
Look at ASTFactory::LoadAST and friends. In practice the XML stuff mostly
works but it still needs work/docu for the general case.
Cheers,
Ric
--
-----+++++*****************************************************+++++++++----
---
---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722 ----
-----+++++*****************************************************+++++++++----
---
"You know how to use that thing?" [pointing to the sword]
"Sure.. The pointy end goes into the other guy."
--- The Mask of Zorro
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list