RE: Compiler Design + feedback

"Quinn Tyler Jackson" <quinn_jackson2004@yahoo.ca>
Wed, 22 Apr 2009 06:59:20 -0700

          From comp.compilers

Related articles
Re: Compiler Design + feedback cfc@shell01.TheWorld.com (Chris F Clark) (2009-04-21)
RE: Compiler Design + feedback quinn_jackson2004@yahoo.ca (Quinn Tyler Jackson) (2009-04-22)
| List of all articles for this month |

From: "Quinn Tyler Jackson" <quinn_jackson2004@yahoo.ca>
Newsgroups: comp.compilers
Date: Wed, 22 Apr 2009 06:59:20 -0700
Organization: Compilers Central
References: 09-04-046
Keywords: design
Posted-Date: 24 Apr 2009 06:47:58 EDT

In reply to Philip Herron, Chris F Clark said:


> Running passes over an intermediate (often tree-like) representation
> of a source text, is such a powerful idea that it is formalized in
> attribute grammars and the visitor pattern and tree rewriting
> systems and probably a dozen other ways.


Meta-S grammars effect multiple passes via predicates:


grammar X {
      S::= a<b>;
      a::= c na;
      b::= an c;
      c::= '[a-z]+';
      na::= '[0-9]+[a-z]+';
      an::= '[a-z]+[0-9]+';
};




In the above, <b> is the predicate. Whatever is accepted by a is then
repassed by b. Two parse trees result:


      abc
            123def


and


      abc123
                  def


Using predicates, what gets passed over more than once is under strict
control, and thus it is possible in many cases to localize repassing and
keep the overall performance near linear in practice.


--
Quinn Tyler Jackson



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.