[antlr-interest] Re: High level semantic analysis

lgcraymer lgc at mail1.jpl.nasa.gov
Mon May 19 21:48:40 PDT 2003


--- In antlr-interest at yahoogroups.com, "Tiller, Michael (M.M.)" 
<mtiller at f...> wrote:
 
> Modelica wasn't the reason I pointed out the paper.  I was more 
interested in highlighting the rule based semantic analysis 
facilitated by the RML language discussed in the later parts of the 
paper.
> 

The "rule based semantic analysis" (as far as I understand from the 
paper) appears to be fairly specific to this application domain.  
Interesting, but not obviously general.

ANTLR's approach to the general problem is syntax tree 
transformation (possibly multiple passes) followed by an "output" 
pass which might generate an internal form that might not be tree 
structured or might produce code.  Ter is working towards an "output 
template" approach for this final pass--details are still being 
worked out.  I think that their "rule based semantic analysis" could 
be effected through one or more transformation passes, one or more 
linking passes (tree walks which build links connecting AST nodes), 
and a resolution pass to "decorate the tree" (attribute grammar 
terminology).

> (BTW, the group that wrote that paper is now using ANTLR 2.7.x)
> 
> > As far as the theorem-proving part of this goes, most of 
> > these use the "resolution" approach found in any good computer 
logic text (an intro 
> > to Prolog would probably discuss this).
> 
> Maybe I'm not very enlightened about all this, but this seems like 
a pretty useful feature to incorporate into a compiler tool.  I 
agree that this is just applying rules and this is not novel.  But, 
just because it isn't novel doesn't mean it isn't useful.  It 
strikes me a bit like saying "ANTLR...that's just a recursive 
descent parser like you'd find described in any intro text on 
parsing".  Sure, the concept isn't "new" but that doesn't mean the 
implementation is trivial.

Resolution theorem proving is useful, and it would be nice to figure 
out how to use it as a generic capability.  I have no clue as to how 
to do that.

> > As far as better tree rewrite support goes, that is planned for 
ANTLR 3.
> 
> My point was not to bring up the topic of tree rewriting (useful 
as it is), but to bring up this topic of being able to incorporate 
semantic details with the same high-level approach that we handle 
lexing, parsing and tree walking.

Semantic analysis is spread across the parser grammar (which usually 
organized according to high-level semantics--declarations versus 
functions, etc.), tree transformation (which translates one high-
level semantics paradigm to another), tree walks to link related 
elements (builds a graph), and output (which instantiates low-level 
semantics).  We're still solving the output problem--I think that 
Ter is close with his output templates, but he still has a few 
details to work out.

--Loring

> > --Loring
> 
> --
> Mike


 

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




More information about the antlr-interest mailing list