[antlr-interest] SableCC tree stuff (Was: Antlr 3.0 spaces between tokens)
Alexey Demakov
demakov at ispras.ru
Thu Nov 11 09:30:32 PST 2004
From: "Terence Parr" <parrt at cs.usfca.edu>
> Anyway, I'm off to Montreal to meet with Etienne Gagnon the SableCC
> guy; giving a talk tomorrow. Racing off to the airport in a few
> minutes so I'm afraid I won't be able to contribute much until I get
> back on Sunday. Damn, this discussion and the one on trees is getting
> interesting! You can be sure I'll be figuring out his tree visitor
> generation stuff (like TreeDL?).
I'm playing with SableCC tree, visitors and walkers and can't agree
that generation of tree from grammar is good idea. Even if it is heterogenous
strictly-typed SableCC tree.
I don't like tree node repetition because of grammar conflict resolving.
See java grammar example:
AForStatement
AForStatementNoShortIF
or simple C:
AIfElseStatement
AIfStatement
AIfThenElseStatement
These nodes are the same logically. And three almost identical visit methods
should be implemented instead of single one.
Another strange thing from simple C example:
ASignedCharSpecifier
ASignedCharTypeSpecifier
ASignedIntSignedIntSpecifier
ASignedIntTypeSpecifier
ASignedLongIntSignedLongSpecifier
ASignedLongSignedLongSpecifier
ASignedLongTypeSpecifier
ASignedShortIntSignedShortSpecifier
ASignedShortSignedShortSpecifier
ASignedShortTypeSpecifier
ASignedSignedIntSpecifier
All of these modifiers can be set of flags in one node!
May be I don't understand SableCC very well, but if my notion
is adequate, SableCC trees are not very useful.
TreeDL now provides tree structure description and generation of:
- tree node class
- visitor interface and some basic visitors implementations
- depth-first tree walker (implemented, but not released yet)
- new features that can be added as plugins very easy.
and the only drawback I see - manual tree construction in parser.
May be sometimes in the future if TreeDL will be used by community,
construction of TreeDL trees will be implemented in ANTLR :)
Regards,
Alexey
-----
Alexey Demakov
TreeDL: Tree Description Language: http://treedl.sourceforge.net
RedVerst Group: http://www.unitesk.com
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