write-you-a-haskell/chapter9/happy
2015-12-13 17:30:02 -05:00
..
.gitignore Squashed commit of the following: 2015-01-18 21:04:01 -05:00
Eval.hs except handling for alex lexer 2015-12-13 17:30:02 -05:00
happyParser.cabal except handling for alex lexer 2015-12-13 17:30:02 -05:00
Lexer.x except handling for alex lexer 2015-12-13 17:30:02 -05:00
Main.hs fix partiality for evaluation 2015-12-13 16:57:50 -05:00
Makefile Squashed commit of the following: 2015-01-18 21:04:01 -05:00
Parser.y except handling for alex lexer 2015-12-13 17:30:02 -05:00
README.md fix partiality for evaluation 2015-12-13 16:57:50 -05:00
stack.yaml refine happy parser example 2015-12-13 13:58:00 -05:00
Syntax.hs Squashed commit of the following: 2015-01-18 21:04:01 -05:00

Happy

A simple example use of the Happy/Alex toolchain to generate parsers.

To compile and run:

$ cabal run

Usage:

Happy> 42
Tokens: [TokenNum 42]
Syntax: Right (Lit (LInt 42))
42

Happy> (\x -> x) 1
Tokens: [TokenLParen,TokenLambda,TokenSym "x",TokenArrow,TokenSym "x",TokenRParen,TokenNum 1]
Syntax: Right (App (Lam "x" (Var "x")) (Lit (LInt 1)))
1

License

Released under MIT license.