[antlr-interest] TreeDL (was: AST specification and processing)

John D. Mitchell johnm-antlr at non.net
Thu Oct 14 09:28:02 PDT 2004


>>>>> "Alexey" == Alexey Demakov <demakov at ispras.ru> writes:
[...]

> How to split translator into subsystems, how to specify interfaces
> between them?  Natural decomposition of translator is around internal
> representation of input data, i.e. around AST: Parser checks syntax and
> builds AST, semantics checker verifies static semantics and adds
> additional information to AST.  After that AST can be transformed,
> processed in other way, output code can be generated.  All of these
> subsystems depends on AST format only, they are (theoretically)
> independent of each other.

But they aren't, a priori, independent of each other.  Transformations,
even while preserving the basic structure of the tree (i.e., adhering to
the same grammar) are often order dependent.  Also, many tree
walkings/manipulations accumulate and/or modify information stored outside
the trees.

> If there is separate AST specification (not in ANTLR parser), all of
> these subsystems (including parser) can be developed independently and at
> the same time. AST specification can be used as a contract between
> developers of different subsystems. According to my experience, it speeds
> up development and reduces number of errors.

Sure (modulo taking the points I made above into account).

> I propose the notation called TreeDL to describe tree-like structures,
> open-source tool that checks consistence of tree description and
> translates tree description to a set of classes (now in Java, C# will be
> added in near future). The TreeDL tool also can generate HTML
> cross-referenced version of tree description to be used as documentation.
> Tree nodes can be decorated by dynamic attributes to store additional
> information.  There is powerful template engine to generate code from
> tree.  Also there is framework for rapid tool development - library for
> error reporting, functionality extention by plugins - TreeDL tool itself
> uses tree description in TreeDL, mentioned template engine and framework,
> so source code can be used as an example.

So, are you saying that TreeDL is e.g., a replacement for Antlr tree
handling?  Basically, what's the real point of TreeDL?  I.e., what doesn't
Antlr's tree handling do that you want?

> Additional docs and downloads are at http://treedl.sourceforge.net
> Example tree description
> http://treedl.sourceforge.net/treedl/treedl/com/unitesk/atp/treedl/TreeDL.tdl-xref/index.html
> TreeDL BNF grammar
> http://treedl.sourceforge.net/treedl/bnf/TreeDL.bnf/index.html TreeDL
> language description http://treedl.sourceforge.net/treedl/treedl_en.html
> TreeDL tool description
> http://treedl.sourceforge.net/treedl/treedl_tool_end.html Template engine
> usage example
> http://treedl.sourceforge.net/treedl/xref/com/unitesk/atp/treedl/JavaNodeGenerator.html

Am I reading the docs correctly... Are you really using the visitor pattern
rather than generating a recursive descent parser?

Thanks,
	John


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list