[antlr-interest] Serialization of ANTLR tree

Rune Glerup rug at maconomy.com
Thu Mar 18 08:55:12 PDT 2010


We have a small language implemented with ANTLR 3.2.

We need to transmit a tree through RMI and therefore the tree
needs to be serializable. I am very curious to learn what the
best approach to serializing an ANTLR tree is.

I have noticed that BaseTree or CommonTree are does not
implement Serializable, while, in ANTLR2, BaseAST does implement
Serializable. - What is the rationale behind this?

- Is it "better" (in terms of performance and robustness) to:
  (a) rely on the default Java serialization mechanism that uses
      the internal representation of the AST nodes to serialize
      the AST, or
  (b) serialize to a text format and then use an ANTLR parser to
      parse that format upon deserialization, or
  (c) something clever I haven't thought of?

Thanks! :)

-- 
Rune Glerup



More information about the antlr-interest mailing list