[antlr-interest] treecc: AOP Approach to Writing Compilers

Alexey Demakov demakov at ispras.ru
Thu Nov 25 08:39:37 PST 2004


From: "Tiller, Michael (M.M.)" <mtiller at ford.com>
>   Thanks for posting this.  This is quite interesting.  Many of my ML
> friends gush about being able to do things like this in ML.  I suspect
> there is room to bring the sort of exhaustive pattern machine and
> high-level type descriptions of ML into a more mainstream environment
> like ANLTR.

Unfortunately, I'm not familiar with ML :(

>   Have you given any thought to implementing these kinds of pattern
> matching features in TreeDL?!  I'm already quite interested in TreeDL
> but pattern matching capabilities would be a fascinating addition.

Generally, yes. But I think it is more 'operation over subtree' than 
pattern matching. In my understanding, pattern matching proposes that you
specify more than just a node - may be children types or attribute values -
and some engine searches tree and executes your actions in context 
of matched pattern. I don't like such engine, because prefer 
to control order of tree walking.

When processing a tree, we need some natural way to specify actions over
tree as a whole or some subtree. Action, like usual method, have signature.
Because of heterogenous tree description we don't need to repeat 
full tree structure as in ANTLR tree grammars.
But action body should be defined for each inherited node type with ability 
to use super-implementation. Translation tool should check consistence 
of action definition.

>   I'm no compiler expert, but I can't help but see lots of related but
> not quite cohesive ideas floating around on this subject.  The recent
> thread on tree grammars (to use or not to use) plus the comments I've
> gotten from my ML friends along with my own experiences gives me the
> sense that perhaps there is a way to formulate these ideas in a more
> universal way.  Personally, I like the pattern matching approach in ML
> because it seems like something that can be analyzed more (e.g. for
> holes) than a tree grammar.  It also seems like it maps more to the
> compilation stages (type inference, constant folding, etc).  But I'll
> say it again "I'm no compiler expert".

Can you write some short review of ML features that can be useful for tree
processing? At least ideas. Or point me to existing document.
I'll try to read something about ML, but not sure can find time :(

> P.S. - I don't quite see the AOP part of Treecc.  It really just seems
> like a high-level data model language that supports code generation for
> the underlying data structures.  Of course, I still don't get AOP so
> maybe that is why I can't see it.

Well, every answer on my message contains similar statement.
Let it be on conscience of author of "Treecc: An Aspect-Oriented Approach to Writing Compilers" :)
May be it is not AOP in usual sence, but I see some similarity.

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