Personal tools

Attribute grammar

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
(Including contents from Books and tutorials#Attribute grammars, with straightforward modifications (some links are updates))
 
m (Reverted edits by User f35a828c44350389 (Talk); changed back to last version by TomLokhorst)
 
(16 intermediate revisions by 4 users not shown)
Line 1: Line 1:
  +
__TOC__
  +
 
== Introduction ==
 
== Introduction ==
   
Especially for functional programmers (with Hasekell examples) -- see
+
Especially for functional programmers (with Haskell examples) -- see
Wouter Swierstra: [http://www.haskell.org/tmrwiki/WhyAttributeGrammarsMatter Why Attribute Grammars Matter] (published in [http://www.haskell.org/tmrwiki/IssueFour The Monad.Reader, Issue Four]).
+
Wouter Swierstra: [http://www.haskell.org/haskellwiki/The_Monad.Reader/Issue4/Why_Attribute_Grammars_Matter Why Attribute Grammars Matter] (published in [http://www.haskell.org/haskellwiki/The_Monad.Reader/Issue4 The Monad.Reader, Issue Four]).
  +
And also very deep connections with
  +
* catamorphisms, category theory
  +
* attribute grammars
  +
are described there.
  +
And there are links from that article to other materials providing deep insights in these powerful theories: attribute grammar tools and articles of the Essential Haskell Compiler project.
   
[http://en.wikipedia.org/wiki/Attribute_grammar Wikipedia article]
+
It is no wonder that it is exactly a compiler project homepage that provides good circular programming and attribute grammar tutorials
  +
* both on its [http://www.cs.uu.nl/wiki/Ehc/WebHome project page]
  +
* and on a separate [http://www.cs.uu.nl/wiki/HUT/AttributeGrammarSystem attribute grammar] page:
  +
the reason may be that a compiler project is complex enough to require good [[separation of concerns]], modularity, reuse (goals of Aspect Oriented Programming, too), and attribute grammars are powerful tools to achieve these goals.
  +
  +
* [http://en.wikipedia.org/wiki/Attribute_grammar Wikipedia article]
  +
* [http://www-rocq.inria.fr/oscar/www/fnc2/manual/node32.html A Tutorial Introduction to Attribute Grammars], contained in [http://www-rocq.inria.fr/oscar/www/fnc2/manual/manual.html The FNC-2 System User's Guide and Reference Manual], written by Martin JOURDAN and Didier PARIGOT
  +
* Also [http://www.haskell.org/happy/ Happy] contains AG-related capabilities, see [http://www.haskell.org/happy/doc/html/sec-AttributeGrammar.html Chapter 4. Attribute Grammars]
  +
  +
== Separation of concerns ==
  +
  +
Both Swiestra's article (mentioned above) and the Essential Haskell Compiler Project tool (mentioned below) remarks the connection of attribute grammars to the topic of [[separation of concerns]], a goal of aspect orinted programming. This goal can be achieved by multiple ways in functional programming, see the concepts [[monad]] and [[arrow]]). Swiestra'a article mentions analogies between
  +
* attribute grammars,
  +
* (Reader, Writer, State) [[monad]]s,
  +
* (fan-out operation of) [[arrow]]s.
   
 
== Portals or other rich resources ==
 
== Portals or other rich resources ==
Line 14: Line 16:
 
Utrecht University's [http://www.cs.uu.nl/wiki/HUT/AttributeGrammarSystem Attribute Grammar System] tools include also an attribute grammar compiler, UUAGC. The concept of attribute grammar was used in their [http://www.cs.uu.nl/wiki/Ehc/WebHome Essential Haskell Compiler] project, which gives us not only a working programming language, but also a good didactical material about using attribute grammars, e.g. in writing compilers.
 
Utrecht University's [http://www.cs.uu.nl/wiki/HUT/AttributeGrammarSystem Attribute Grammar System] tools include also an attribute grammar compiler, UUAGC. The concept of attribute grammar was used in their [http://www.cs.uu.nl/wiki/Ehc/WebHome Essential Haskell Compiler] project, which gives us not only a working programming language, but also a good didactical material about using attribute grammars, e.g. in writing compilers.
   
Albeits these materials are self-contained, they reveal that the theory of attribute grammars is related to these concepts:
+
Albeits these materials are self-contained, they reveal that the theory of attribute grammars is related to other concepts
* [[circular programming]]
+
([[circular programming]], catamorphism).
* catamorphism
+
  +
Robert Dockins has reported [http://haskell.org/communities/06-2006/html/report.html#happy-ag Attribute Grammar Support for Happy] in the Haskell Communities and Activities Report (10th edititon, June 2006)
  +
  +
== Related concepts ==
  +
  +
* [[Circular programming]]
  +
* Catamorphism, see [[Category theory]]
   
[[Category:theoretical foundations]]
+
[[Category:Theoretical foundations]]
  +
[[Category:Compiler tools]]

Latest revision as of 01:18, 7 January 2012

Contents


[edit] 1 Introduction

Especially for functional programmers (with Haskell examples) -- see Wouter Swierstra: Why Attribute Grammars Matter (published in The Monad.Reader, Issue Four). And also very deep connections with

  • catamorphisms, category theory
  • attribute grammars

are described there. And there are links from that article to other materials providing deep insights in these powerful theories: attribute grammar tools and articles of the Essential Haskell Compiler project.

It is no wonder that it is exactly a compiler project homepage that provides good circular programming and attribute grammar tutorials

the reason may be that a compiler project is complex enough to require good separation of concerns, modularity, reuse (goals of Aspect Oriented Programming, too), and attribute grammars are powerful tools to achieve these goals.

[edit] 2 Separation of concerns

Both Swiestra's article (mentioned above) and the Essential Haskell Compiler Project tool (mentioned below) remarks the connection of attribute grammars to the topic of separation of concerns, a goal of aspect orinted programming. This goal can be achieved by multiple ways in functional programming, see the concepts monad and arrow). Swiestra'a article mentions analogies between

  • attribute grammars,
  • (Reader, Writer, State) monads,
  • (fan-out operation of) arrows.

[edit] 3 Portals or other rich resources

Attribute Grammars Home Page

[edit] 4 Tools

Utrecht University's Attribute Grammar System tools include also an attribute grammar compiler, UUAGC. The concept of attribute grammar was used in their Essential Haskell Compiler project, which gives us not only a working programming language, but also a good didactical material about using attribute grammars, e.g. in writing compilers.

Albeits these materials are self-contained, they reveal that the theory of attribute grammars is related to other concepts (circular programming, catamorphism).

Robert Dockins has reported Attribute Grammar Support for Happy in the Haskell Communities and Activities Report (10th edititon, June 2006)

[edit] 5 Related concepts