antlr-haskell: A Haskell implementation of the ANTLR top-down parser generator

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.


Please see the README on Github at and

[Skip to ReadMe]


Dependenciesbase (>=4.11 && <5), containers (==0.6.*), deepseq (==1.4.*), hashable (==1.2.*), haskell-src-meta (==0.8.*), mtl (==2.2.*), template-haskell (==2.14.*), text (==1.2.*), th-lift (>=0.7.11 && <0.8), transformers (==0.5.*), unordered-containers (==0.2.*) [details]
AuthorKarl Cronburg & Matthew Ahrens
Home page
Bug tracker
Source repositoryhead: git clone
UploadedTue Nov 27 18:37:27 UTC 2018 by KarlCronburg




Maintainers' corner

For package maintainers and hackage trustees

Readme for antlr-haskell-

[back to package description]


A Haskell implementation of ANTLR.

In implementing ANTLR we referenced the behavior of the original Java version (ANTLR4): The definitive ANTLR4 Reference. However we have taken much liberty in the design of this library compared to the workflow of the original Java version. In particular in implementing ANTLR for Haskell we have followed the following principles:

Build instructions

The library can be built with:

stack build # stack version
stack test antlr-haskell:simpl

Or with cabal- like:

cabal configure
cabal install --only-dependencies --enable-tests
cabal build
cabal test sexpression

sample grammar for ALL(*)

S -> Ac | Ad

A -> aA | b

ALL(*) Input/output examples

*Test.AllStarTests> parse ['a', 'b', 'c'] (NT 'S') atnEnv
(Just True, Node 'S' [Node 'A' [Leaf 'a', Node 'A' [Leaf 'b']], Leaf 'c'])
*Test.AllStarTests> parse ['b', 'd'] (NT 'S') atnEnv
(Just True, Node 'S' [Node 'A' [Leaf 'b'], Leaf 'd'])
*Test.AllStarTests> parse ['a', 'a', 'a', 'a', 'b', 'c'] (NT 'S') atnEnv
(Just True, Node 'S' [Node 'A' [Leaf 'a', Node 'A' [Leaf 'a', Node 'A' [Leaf 'a', Node 'A' [Leaf 'a', Node 'A' [Leaf 'b']]]]], Leaf 'c'])