Personal tools

Applications and libraries/Compiler tools

From HaskellWiki

< Applications and libraries(Difference between revisions)
Jump to: navigation, search
(+rules)
(fmt)
Line 1: Line 1:
{{LibrariesPage}}
+
== Applications ==
   
== Compiler, parsing, lexing and regular expression tools ==
+
;[http://www.haskell.org/happy/ Happy]
  +
:[[Happy]] is a parser generator system for Haskell, similar to the tool `yacc' for C. Like `yacc', it takes a file containing an annotated BNF specification of a grammar and produces a Haskell module containing a parser for the grammar.
   
;[http://www.cse.unsw.edu.au/~chak/haskell/ctk/ Manuel Chakravarty's Compiler Toolkit]
+
;[http://www.informatik.uni-bonn.de/~ralf/frown/ Frown]
:There is a significant set of functionality that is required in each compiler like symbol table management, input-output operations, error management, and so on, which are good candidates for code reuse. The Compiler Toolkit is an attempt to provide an open collection of modules for these recurring tasks in Haskell.
+
:Frown is an LALR(k) parser generator for Haskell 98 written in Haskell 98.
   
;[http://www.cse.ogi.edu/~mpj/thih/ Typing Haskell in Haskell]
+
;[http://www.ki.informatik.uni-frankfurt.de/~klose/lucky.html Lucky]
:A Haskell program that implements a Haskell typechecker, thus providing a mathematically rigorous specification in a notation that is familiar to Haskell users.
+
:A parser generator for Haskell using monadic parser combinators. It was developed to be compatible with Happy.
   
;[http://www.cs.mu.oz.au/~bjpop/hatchet.html Hatchet]
+
;[http://www.cs.york.ac.uk/fp/cpphs/ cpphs]
:Hatchet is a type checking and inference tool for Haskell 98, written in (almost) Haskell 98.
+
:cpphs is a liberalised re-implementation of cpp, the C pre-processor, in Haskell.
  +
  +
== Libraries ==
  +
  +
=== Compiler construction ===
  +
  +
;[http://www.cse.unsw.edu.au/~chak/haskell/ctk/ Manuel Chakravarty's Compiler Toolkit]
  +
:There is a significant set of functionality that is required in each compiler like symbol table management, input-output operations, error management, and so on, which are good candidates for code reuse. The Compiler Toolkit is an attempt to provide an open collection of modules for these recurring tasks in Haskell.
   
 
;[http://www.cs.chalmers.se/~aarne/BNF/ The BNF Converter]
 
;[http://www.cs.chalmers.se/~aarne/BNF/ The BNF Converter]
Line 21: Line 21:
 
:How can attribute grammars help at the separation of concerns, at things related to the goals of aspect oriented programming? How do they relate to other concepts like monads and arrows? Why are they important for the functional programmer? See Wouter Swierstra's [http://www.haskell.org/tmrwiki/WhyAttributeGrammarsMatter WhyAttributeGrammarsMatter]. 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.
 
:How can attribute grammars help at the separation of concerns, at things related to the goals of aspect oriented programming? How do they relate to other concepts like monads and arrows? Why are they important for the functional programmer? See Wouter Swierstra's [http://www.haskell.org/tmrwiki/WhyAttributeGrammarsMatter WhyAttributeGrammarsMatter]. 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.
   
== Regular expression libraries ==
+
=== Type checkers ===
  +
  +
;[http://www.cse.ogi.edu/~mpj/thih/ Typing Haskell in Haskell]
  +
:A Haskell program that implements a Haskell typechecker, thus providing a mathematically rigorous specification in a notation that is familiar to Haskell users.
  +
  +
;[http://www.cs.mu.oz.au/~bjpop/hatchet.html Hatchet]
  +
:Hatchet is a type checking and inference tool for Haskell 98, written in (almost) Haskell 98.
  +
  +
;[http://www.cs.uu.nl/wiki/Ehc/WebHome Ruler]
  +
:The purpose of the Ruler system is to describe type rules in such a way that a partial Attribute Grammar implementation, and a pretty printed LaTeX can be generated from a description of type rules
  +
  +
;[http://eecs.oregonstate.edu/~erwig/HaskellRules/ Haskell Rules: Embedding Rule Systems in Haskell]
  +
:Haskell Rules is a domain-specific embedded language that allows semantic rules to be expressed as Haskell functions. This DSEL provides logical variables, unification, substitution, non-determinism, and backtracking. It also allows Haskell functions to be lifted to operate on logical variables. These functions are automatically delayed so that the substitutions can be applied. The rule DSEL allows various kinds of logical embedding, for example, including logical variables within a data structure or wrapping a data structure with a logical wrapper.
  +
  +
=== Regular expressions ===
   
 
;[http://www.haskell.org/ghc/docs/latest/html/libraries/base/Text-Regex-Posix.html Text.Regex.Posix]
 
;[http://www.haskell.org/ghc/docs/latest/html/libraries/base/Text-Regex-Posix.html Text.Regex.Posix]
Line 38: Line 38:
 
:HaRP is a Haskell extension that extends the normal pattern matching facility with the power of regular expressions. Regular expression patterns in HaRP work over ordinary Haskell lists ([]) of arbitrary type. HaRP is as a pre-processor to ordinary Haskell.
 
:HaRP is a Haskell extension that extends the normal pattern matching facility with the power of regular expressions. Regular expression patterns in HaRP work over ordinary Haskell lists ([]) of arbitrary type. HaRP is as a pre-processor to ordinary Haskell.
   
== Scanner and parser generators ==
+
== Lexers and parsers ==
  +
  +
;[http://www.cs.ruu.nl/~daan/parsec.html Parsec]
  +
:A simple, well documented monadic parser combinator library for fast parsers with good error messages.
   
 
;[http://www.haskell.org/happy/ Happy]
 
;[http://www.haskell.org/happy/ Happy]
Line 51: Line 51:
 
;[http://www.cs.uu.nl/wiki/Center/UtrechtParserCombinators Utrecht Parser Combinator Library]
 
;[http://www.cs.uu.nl/wiki/Center/UtrechtParserCombinators Utrecht Parser Combinator Library]
 
:The combinators in this library analyse the grammar on the fly and build parsers that are quite efficient. An interesting aspect is that parsing results become available on the fly without hanging on to the input. The parsers will give extensive error reports of erroneous situations, and wil proceed with parsing.
 
:The combinators in this library analyse the grammar on the fly and build parsers that are quite efficient. An interesting aspect is that parsing results become available on the fly without hanging on to the input. The parsers will give extensive error reports of erroneous situations, and wil proceed with parsing.
 
;[http://www.cs.ruu.nl/~daan/parsec.html Parsec]
 
:A simple, well documented monadic parser combinator library for fast parsers with good error messages.
 
   
 
;[http://pdos.csail.mit.edu/~baford/packrat/ The Packrat Parsing and Parsing Expression Grammars Page]
 
;[http://pdos.csail.mit.edu/~baford/packrat/ The Packrat Parsing and Parsing Expression Grammars Page]
Line 75: Line 72:
 
;[http://www.cs.chalmers.se/~d00nibro/haskell-src-exts/ HSX]
 
;[http://www.cs.chalmers.se/~d00nibro/haskell-src-exts/ HSX]
 
:Haskell-Source with eXtensions (HSX, haskell-src-exts) is an extension of the standard haskell-src package, and handles most common syntactic extensions to Haskell.
 
:Haskell-Source with eXtensions (HSX, haskell-src-exts) is an extension of the standard haskell-src package, and handles most common syntactic extensions to Haskell.
 
;[http://www.cs.york.ac.uk/fp/cpphs/ cpphs]
 
:cpphs is a liberalised re-implementation of cpp, the C pre-processor, in Haskell.
 
   
 
;[http://wiki.di.uminho.pt/wiki/bin/view/PURe/HaGLR HaGLR]
 
;[http://wiki.di.uminho.pt/wiki/bin/view/PURe/HaGLR HaGLR]
 
:HaGLR provides support for Generalized LR parsing in Haskell.
 
:HaGLR provides support for Generalized LR parsing in Haskell.
   
== Type systems ==
+
== Pretty printing ==
   
;[http://www.cs.uu.nl/wiki/Ehc/WebHome Ruler]
+
;[http://www.haskell.org/ghc/docs/latest/html/libraries/base/Text-PrettyPrint.html Text.PrettyPrint]
:The purpose of the Ruler system is to describe type rules in such a way that a partial Attribute Grammar implementation, and a pretty printed LaTeX can be generated from a description of type rules
+
: Pretty-printing module included in the standard libraries.
   
;[http://eecs.oregonstate.edu/~erwig/HaskellRules/ Haskell Rules: Embedding Rule Systems in Haskell]
+
;[http://research.microsoft.com/~simonpj/downloads/pretty-printer/pretty.html Pretty printer library]
:Haskell Rules is a domain-specific embedded language that allows semantic rules to be expressed as Haskell functions. This DSEL provides logical variables, unification, substitution, non-determinism, and backtracking. It also allows Haskell functions to be lifted to operate on logical variables. These functions are automatically delayed so that the substitutions can be applied. The rule DSEL allows various kinds of logical embedding, for example, including logical variables within a data structure or wrapping a data structure with a logical wrapper.
+
:Simon Peyton Jones made an "industrial strength" pretty printing library in Haskell, based on John Hughes's paper "The Design of a Pretty-printing Library" (in Advanced Functional Programming, Johan Jeuring and Erik Meijer (eds), LNCS 925). [http://www.md.chalmers.se/~rjmh/Software/NewPP.hs Original version by John Hughes].
  +
  +
;[http://www.cs.uu.nl/~daan/pprint.html PPrint]
  +
:PPrint is an implementation of the pretty printing combinators described by Philip Wadler. The PPrint library adds new primitives to describe commonly occuring layouts and works well in practice.
  +
  +
;[http://repetae.net/john/recent/out/Doc.html Doc]
  +
:A Pretty printing class using multiparameter type classes for maximal generality with some useful instances.
   
 
== Term rewriting ==
 
== Term rewriting ==
   
 
;[http://www.dsic.upv.es/~slucas/csr/termination/muterm MU-TERM]
 
;[http://www.dsic.upv.es/~slucas/csr/termination/muterm MU-TERM]
:a tool for proving termination of rewriting with replacement restrictions
+
:A tool for proving termination of rewriting with replacement restrictions
   
 
;[http://www.dsic.upv.es/users/elp/ondemandOBJ OnDemandOBJ]
 
;[http://www.dsic.upv.es/users/elp/ondemandOBJ OnDemandOBJ]
 
:A Laboratory for Strategy Annotations
 
:A Laboratory for Strategy Annotations
  +
  +
{{LibrariesPage}}

Revision as of 02:54, 6 December 2006

Contents

1 Applications

Happy
Happy is a parser generator system for Haskell, similar to the tool `yacc' for C. Like `yacc', it takes a file containing an annotated BNF specification of a grammar and produces a Haskell module containing a parser for the grammar.
Frown
Frown is an LALR(k) parser generator for Haskell 98 written in Haskell 98.
Lucky
A parser generator for Haskell using monadic parser combinators. It was developed to be compatible with Happy.
cpphs
cpphs is a liberalised re-implementation of cpp, the C pre-processor, in Haskell.

2 Libraries

2.1 Compiler construction

Manuel Chakravarty's Compiler Toolkit
There is a significant set of functionality that is required in each compiler like symbol table management, input-output operations, error management, and so on, which are good candidates for code reuse. The Compiler Toolkit is an attempt to provide an open collection of modules for these recurring tasks in Haskell.
The BNF Converter
A High-Level Tool for Implementing Well-Behaved Programming Languages.
ATerm Library
ATerms provide a generic format for representation and exchange of (annotated) terms. ATerms were developed in the context of the ASF+SDF Meta-Environment. They are also used by the rewriting language Stratego, by the transformation tool bundle XT, by the visitor generator JJForester, and by numerous other tools developed at CWI, Universiteit Utrecht, and elsewhere.
Attribute Grammar
How can attribute grammars help at the separation of concerns, at things related to the goals of aspect oriented programming? How do they relate to other concepts like monads and arrows? Why are they important for the functional programmer? See Wouter Swierstra's WhyAttributeGrammarsMatter. 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.

2.2 Type checkers

Typing Haskell in Haskell
A Haskell program that implements a Haskell typechecker, thus providing a mathematically rigorous specification in a notation that is familiar to Haskell users.
Hatchet
Hatchet is a type checking and inference tool for Haskell 98, written in (almost) Haskell 98.
Ruler
The purpose of the Ruler system is to describe type rules in such a way that a partial Attribute Grammar implementation, and a pretty printed LaTeX can be generated from a description of type rules
Haskell Rules: Embedding Rule Systems in Haskell
Haskell Rules is a domain-specific embedded language that allows semantic rules to be expressed as Haskell functions. This DSEL provides logical variables, unification, substitution, non-determinism, and backtracking. It also allows Haskell functions to be lifted to operate on logical variables. These functions are automatically delayed so that the substitutions can be applied. The rule DSEL allows various kinds of logical embedding, for example, including logical variables within a data structure or wrapping a data structure with a logical wrapper.

2.3 Regular expressions

Text.Regex.Posix
Interface to the POSIX regular expression library.
Text.Regex.Lazy
This is an alternative to Text.Regex along with some enhancements. GHC's Text.Regex marshals the data back and forth to c-arrays to call libc and this is far too slow (and strict). This module understands regular expression Strings via a Parsec parser and creates an internal data structure (Text.Regex.Lazy.Pattern). This is then transformed into a Parsec parser to process the input String, or into a DFA table for matching against the input String or FastPackedString. The input string is consumed lazily, so it may be an arbitrarily long or infinite source.
Regular expression library
Inspired by the Perl regular expression library, written purely in Haskell.
JRegex
A library that interfaces to both PCRE and Posix regular expressions.
Haskell Regular Patterns
HaRP is a Haskell extension that extends the normal pattern matching facility with the power of regular expressions. Regular expression patterns in HaRP work over ordinary Haskell lists ([]) of arbitrary type. HaRP is as a pre-processor to ordinary Haskell.

3 Lexers and parsers

Parsec
A simple, well documented monadic parser combinator library for fast parsers with good error messages.
Happy
Happy is a parser generator system for Haskell, similar to the tool `yacc' for C. Like `yacc', it takes a file containing an annotated BNF specification of a grammar and produces a Haskell module containing a parser for the grammar.
Frown
Frown is an LALR(k) parser generator for Haskell 98 written in Haskell 98.
Lucky
A parser generator for Haskell using monadic parser combinators. It was developed to be compatible with Happy.
Utrecht Parser Combinator Library
The combinators in this library analyse the grammar on the fly and build parsers that are quite efficient. An interesting aspect is that parsing results become available on the fly without hanging on to the input. The parsers will give extensive error reports of erroneous situations, and wil proceed with parsing.
The Packrat Parsing and Parsing Expression Grammars Page
Written by Bryan Ford parsing expression grammars (PEGs), an alternative to context free grammars for formally specifying syntax, and packrat parsers, or linear-time memoizing parsers for PEGs. Also a packrat parser generator in Haskell that generates Haskell parsers.
CTKlight
Standalone distribution of the self-optimising lexer (i.e. regex) and parser combinators of the Compiler Toolkit (CTK).
Alex: A Lexical Analyser Generator
Alex 2.0 is a Lex-like package for generating Haskell scanners.
The Haskell Dynamic Lexer Engine
This system is completely dynamic: the lexer may be modified at runtime, and string buffers may be lexed by different lexers at different times.
The Zephyr Abstract Syntax Description Lanuguage (ASDL)
ASDL is a language designed to describe the tree-like data structures in compilers. Its main goal is to provide a method for compiler components written in different languages to interoperate. ASDL makes it easier for applications written in a variety of programming languages to communicate complex recursive data structures. asdlGen is a tool that takes ASDL descriptions and produces implementations of those descriptions in C, C++, Java, Standard ML, and Haskell.
HParser (This link is dead. Fix it or remove it.)
A parser for Haskell written purely in Haskell (using the Happy parser generator).
HSX
Haskell-Source with eXtensions (HSX, haskell-src-exts) is an extension of the standard haskell-src package, and handles most common syntactic extensions to Haskell.
HaGLR
HaGLR provides support for Generalized LR parsing in Haskell.

4 Pretty printing

Text.PrettyPrint
Pretty-printing module included in the standard libraries.
Pretty printer library
Simon Peyton Jones made an "industrial strength" pretty printing library in Haskell, based on John Hughes's paper "The Design of a Pretty-printing Library" (in Advanced Functional Programming, Johan Jeuring and Erik Meijer (eds), LNCS 925). Original version by John Hughes.
PPrint
PPrint is an implementation of the pretty printing combinators described by Philip Wadler. The PPrint library adds new primitives to describe commonly occuring layouts and works well in practice.
Doc
A Pretty printing class using multiparameter type classes for maximal generality with some useful instances.

5 Term rewriting

MU-TERM
A tool for proving termination of rewriting with replacement restrictions
OnDemandOBJ
A Laboratory for Strategy Annotations

This page contains a list of libraries and tools in a certain category. For a comprehensive list of such pages, see Libraries and tools.