Personal tools

Happy

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
(Initial set up of page.)
 
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
 
==Happy==
 
==Happy==
[[Category:Compiler Tools]]
+
[[Category:Compiler tools]]
 
This is a parser generator in the general style of yacc. See http://www.haskell.org/happy for downloads and documentation.
 
This is a parser generator in the general style of yacc. See http://www.haskell.org/happy for downloads and documentation.
   
Line 12: Line 12:
 
* Grammar definition : The set of rules and actions
 
* Grammar definition : The set of rules and actions
 
* The module trailer (Optional) : More Haskell code that can be used in the actions.
 
* The module trailer (Optional) : More Haskell code that can be used in the actions.
  +
  +
  +
{{Template:Stub}}

Latest revision as of 20:37, 25 February 2006

[edit] 1 Happy

This is a parser generator in the general style of yacc. See http://www.haskell.org/happy for downloads and documentation.

[edit] 1.1 Usage

happy uses a language description file to create a Haskell module that will do the parsing. Typical usage in in the second stage of a compiler, where it will be used to generate an abstract syntax tree.

[edit] 1.2 Input File Structure

A happy file consists of four parts.

  • The module header (Optional) : This is where you may define the module name and import other Haskell modules
  • Various directives : This is used for definition of the tokens, the type of scanner to use, precedence setting.
  • Grammar definition : The set of rules and actions
  • The module trailer (Optional) : More Haskell code that can be used in the actions.


This article is a stub. You can help by expanding it.