https://wiki.haskell.org/api.php?action=feedcontributions&user=Rossng&feedformat=atomHaskellWiki - User contributions [en]2020-09-22T21:21:08ZUser contributionsMediaWiki 1.27.4https://wiki.haskell.org/index.php?title=Applications_and_libraries/Compiler_tools&diff=60537Applications and libraries/Compiler tools2016-01-22T00:29:48Z<p>Rossng: Corrected Parsec link</p>
<hr />
<div>== Applications ==<br />
<br />
;[http://www.haskell.org/happy/ Happy]<br />
:[[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.<br />
<br />
;[[Frown]]<br />
:Frown is an LALR(k) parser generator for Haskell 98 written in Haskell 98.<br />
<br />
;[http://www.ki.informatik.uni-frankfurt.de/~klose/lucky.html Lucky]<br />
:A parser generator for Haskell using monadic parser combinators. It was developed to be compatible with Happy.<br />
<br />
;[http://www.cs.york.ac.uk/fp/cpphs/ cpphs]<br />
:cpphs is a liberalised re-implementation of cpp, the C pre-processor, in Haskell.<br />
<br />
== Libraries ==<br />
<br />
=== Compiler construction ===<br />
;[[GHC/As_a_library|GHC API]]<br />
:The GHC API is a library that exports much functionality from the [[GHC|Glasgow Haskell Compiler]].<br />
<br />
;[[Yhc/API| YHC API]]<br />
:The YHC API is a library that exports much functionality from the [[Yhc|York Haskell Compiler]].<br />
<br />
;[http://www.cse.unsw.edu.au/~chak/haskell/ctk/ Manuel Chakravarty's Compiler Toolkit]<br />
: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.<br />
<br />
;[http://www.cs.chalmers.se/~markus/BNFC The BNF Converter]<br />
:A High-Level Tool for Implementing Well-Behaved Programming Languages.<br />
<br />
;[http://www.cwi.nl/projects/MetaEnv/haterm/ ATerm Library]<br />
: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.<br />
<br />
;Attribute Grammar<br />
: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.<br />
<br />
=== Type checkers ===<br />
<br />
;[http://www.cse.ogi.edu/~mpj/thih/ Typing Haskell in Haskell]<br />
:A Haskell program that implements a Haskell typechecker, thus providing a mathematically rigorous specification in a notation that is familiar to Haskell users.<br />
<br />
;[http://www.cs.mu.oz.au/~bjpop/code.html Hatchet]<br />
:Hatchet is a type checking and inference tool for Haskell 98, written in (almost) Haskell 98.<br />
<br />
;[http://www.cs.uu.nl/wiki/Ehc/WebHome Ruler]<br />
: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://www.cs.uu.nl/wiki/bin/view/Ehc/RulerProgrammingTypeRules Paper])<br />
<br />
;[http://eecs.oregonstate.edu/~erwig/HaskellRules/ Haskell Rules: Embedding Rule Systems in Haskell]<br />
: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.<br />
<br />
=== Regular expressions ===<br />
<br />
There are many libraries for regular expressions available. By default<br />
GHC comes with:<br />
<br />
;[http://darcs.haskell.org/packages/regex-compat/ regex-compat]<br />
<br />
;[http://darcs.haskell.org/packages/regex-posix/ regex-posix]<br />
<br />
Providing String and ByteString interfaces to C's regex.h.<br />
<br />
Additional libraries are available for more efficient regular expression<br />
implementations:<br />
<br />
;[http://darcs.haskell.org/packages/regex-pcre/ regex-pcre: Perl pcre]<br />
:PCRE-based regexes<br />
<br />
;[http://darcs.haskell.org/packages/regex-tre/ regex-tre: TRE]<br />
:TRE-based regexes<br />
<br />
;[http://darcs.haskell.org/packages/regex-parsec/ regex-parsec]<br />
:Pure Haskell parsec regexes<br />
<br />
;[http://darcs.haskell.org/packages/regex-dfa/ regex-dfa]<br />
:Pure Haskell DFA for regexes<br />
<br />
;[http://www.di.uminho.pt/~jas/Research/HaLeX/HaLeX.html HaLex]<br />
:NDFA and DFA library and tool<br />
<br />
Other libraries include:<br />
<br />
;[http://www.haskell.org/ghc/docs/latest/html/libraries/base/Text-Regex-Posix.html Text.Regex.Posix]<br />
:Interface to the POSIX regular expression library.<br />
<br />
;[http://sourceforge.net/projects/lazy-regex Text.Regex.Lazy]<br />
: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.<br />
<br />
;[http://www.dcs.gla.ac.uk/~meurig/regexp/ Regular expression library]<br />
:Inspired by the Perl regular expression library, written purely in Haskell.<br />
<br />
;[http://repetae.net/john/computer/haskell/JRegex/ JRegex]<br />
:A library that interfaces to both PCRE and Posix regular expressions.<br />
<br />
;[http://www.cs.chalmers.se/~d00nibro/harp/ Haskell Regular Patterns]<br />
: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.<br />
<br />
=== Lexers and parsers ===<br />
<br />
;[https://github.com/aslatter/parsec Parsec]<br />
:A simple, well documented monadic parser combinator library for fast parsers with good error messages.<br />
<br />
;[http://www.cs.chalmers.se/Cs/Grundutb/Kurser/afp/code/week3/Parsek.hs Parsek]<br />
:An implementation of [http://www.cs.chalmers.se/~koen/pubs/entry-jfp04-parser.html parallel parsing processes], providing the same API as Parsec<br />
<br />
;[http://www.haskell.org/happy/ Happy]<br />
:[[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.<br />
<br />
;[http://www.informatik.uni-bonn.de/~ralf/frown/ Frown]<br />
:Frown is an LALR(k) parser generator for Haskell 98 written in Haskell 98.<br />
<br />
;[http://www.ki.informatik.uni-frankfurt.de/~klose/lucky.html Lucky]<br />
:A parser generator for Haskell using monadic parser combinators. It was developed to be compatible with Happy.<br />
<br />
;[http://www.cs.uu.nl/wiki/HUT/ParserCombinators Utrecht Parser Combinator Library]<br />
: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. <br />
<br />
;[http://pdos.csail.mit.edu/~baford/packrat/ The Packrat Parsing and Parsing Expression Grammars Page]<br />
:Written by [http://www.brynosaurus.com/ 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.<br />
<br />
;[http://www.cse.unsw.edu.au/~chak/haskell/ctk/ CTKlight]<br />
:Standalone distribution of the self-optimising lexer (i.e. regex) and parser combinators of the Compiler Toolkit (CTK).<br />
<br />
;[http://www.haskell.org/alex/ Alex: A Lexical Analyser Generator]<br />
:[[Alex]] 2.0 is a Lex-like package for generating Haskell scanners.<br />
<br />
;[http://www.nondot.org/sabre/Projects/HaskellLexer/ The Haskell Dynamic Lexer Engine]<br />
:This system is completely dynamic: the lexer may be modified at runtime, and string buffers may be lexed by different lexers at different times.<br />
<br />
;[http://asdl.sourceforge.net/ The Zephyr Abstract Syntax Description Lanuguage (ASDL)]<br />
: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.<br />
<br />
;[http://www.cs.chalmers.se/~d00nibro/haskell-src-exts/ HSX]<br />
:Haskell-Source with eXtensions (HSX) is an extension of the standard haskell-src package, and handles most common syntactic extensions to Haskell.<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haskell-src-exts HSE]<br />
:Haskell-Source with Extensions (HSE, haskell-src-exts) is an extension of the standard haskell-src package. To fetch it from the Darcs repository:<br />
::darcs get http://code.haskell.org/HSP/haskell-src-exts<br />
<br />
;[http://wiki.di.uminho.pt/wiki/bin/view/PURe/HaGLR HaGLR]<br />
:HaGLR provides support for Generalized LR parsing in Haskell.<br />
<br />
;[[Polyparse]]<br />
:A collection of alternative parser combinator libraries.<br />
<br />
;[http://uebb.cs.tu-berlin.de/~magr/projects/piggybackGHC/doc/ piggybackGHC]<br />
:This package provides simple wrapper modules for the [[GHC/As_a_library|GHC API]] for lexing and parsing Haskell modules.<br />
<br />
; [http://projects.haskell.org/grammar-combinators/ Grammar Combinators]<br />
: The grammar-combinators library is an experimental next-generation parser library written in Haskell. The library features much of the power of a parser generator like Happy or ANTLR, but with the library approach and most of the benefits of a parser combinator library.<br />
<br />
;[http://hackage.haskell.org/package/Grempa/ Grempa]<br />
: The Grempa library allows you to write language grammars in a BNF-like notation in Haskell and then generate efficient LALR(1) parsers for them without having to use any external tools. The parsers can either be generated at compile-time or at runtime.<br />
<br />
=== Pretty printing ===<br />
<br />
;[http://www.cs.uu.nl/wiki/HUT/PrettyPrintingCombinators uulib]<br />
:Utrecht's sophisticated parsing and pretty printing combinator library. The combinators in the pretty-printing library are optimal in the sense that they produce the layout with the smallest height possible within a given width. Special combinators allow the sepcification of alternative layouts<br />
<br />
;[http://www.haskell.org/ghc/docs/latest/html/libraries/base/Text-PrettyPrint.html Text.PrettyPrint]<br />
: Pretty-printing module included in the standard libraries.<br />
<br />
;[http://research.microsoft.com/~simonpj/downloads/pretty-printer/pretty.html Pretty printer library]<br />
: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].<br />
<br />
;[http://www.cs.uu.nl/~daan/pprint.html PPrint]<br />
: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.<br />
<br />
;[http://repetae.net/john/recent/out/Doc.html Doc]<br />
:A Pretty printing class using multiparameter type classes for maximal generality with some useful instances.<br />
<br />
;[http://sophos.berkeley.edu/macfarlane/pandoc/ PanDoc]<br />
:Library for converting from one markup format to another, and a command-line tool that uses this library. It can read markdown and (subsets of) reStructuredText, HTML, and LaTeX, and it can write markdown, reStructuredText, HTML, LaTeX, RTF, DocBook XML, and S5 HTML slide shows. Pandoc's version of markdown contains some enhancements, like footnotes and embedded LaTeX. <br />
<br />
=== Term rewriting ===<br />
<br />
;[http://www.dsic.upv.es/~slucas/csr/termination/muterm MU-TERM]<br />
:A tool for proving termination of rewriting with replacement restrictions<br />
<br />
;[http://www.dsic.upv.es/users/elp/ondemandOBJ OnDemandOBJ]<br />
:A Laboratory for Strategy Annotations<br />
<br />
<br />
== Hackage ==<br />
<br />
* [http://hackage.haskell.org/packages/archive/pkg-list.html#cat:Parsing Parsing libraries on Hackage]<br />
* [http://hackage.haskell.org/packages/archive/pkg-list.html#cat:Text Regex libs on Hackage]<br />
<br />
{{LibrariesPage}}</div>Rossng