Applications and libraries/Compiler tools

From HaskellWiki
< Applications and libraries
Revision as of 14:44, 21 July 2023 by SamB (talk | contribs) (→‎Compiler construction: Fix some links for Attribute Grammar stuff)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.

Libraries

Compiler construction

GHC API
The GHC API is a library that exports much functionality from the Glasgow Haskell Compiler.
YHC API
The YHC API is a library that exports much functionality from the York Haskell Compiler.
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 Why Attribute Grammars Matter. 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.

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. (Paper)
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

There are many libraries for regular expressions available. By default GHC comes with:

regex-compat
regex-posix

Providing String and ByteString interfaces to C's regex.h.

Additional libraries are available for more efficient regular expression implementations:

regex-pcre: Perl pcre
PCRE-based regexes
regex-tre: TRE
TRE-based regexes
regex-parsec
Pure Haskell parsec regexes
regex-dfa
Pure Haskell DFA for regexes
HaLex
NDFA and DFA library and tool

Other libraries include:

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.

Lexers and parsers

Parsec
A simple, well documented monadic parser combinator library for fast parsers with good error messages.
Parsek
An implementation of parallel parsing processes, providing the same API as Parsec
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.
HSX
Haskell-Source with eXtensions (HSX) is an extension of the standard haskell-src package, and handles most common syntactic extensions to Haskell.
HSE
Haskell-Source with Extensions (HSE, haskell-src-exts) is an extension of the standard haskell-src package. To fetch it from the Darcs repository:
darcs get http://code.haskell.org/HSP/haskell-src-exts
HaGLR
HaGLR provides support for Generalized LR parsing in Haskell.
Polyparse
A collection of alternative parser combinator libraries.
piggybackGHC
This package provides simple wrapper modules for the GHC API for lexing and parsing Haskell modules.
Grammar Combinators
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.
Grempa
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.

Pretty printing

uulib
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
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.
PanDoc
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.

Term rewriting

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


Hackage

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