Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains a simple lambda calculus parser. This parser is not optimized for maximum
performance; instead it's written in a style which emulates the look and feel of conventional
monadic parsers. An optimized implementation would use low-level switch
expressions more often.
Synopsis
- type Name = ByteString
- data Tm
- ident :: Parser Name
- ident' :: Parser Name
- digit :: Parser Int
- int :: Parser Int
- atom :: Parser Tm
- atom' :: Parser Tm
- app' :: Parser Tm
- mul' :: Parser Tm
- add' :: Parser Tm
- eqLt' :: Parser Tm
- pLet :: Parser Tm
- lam :: Parser Tm
- pIf :: Parser Tm
- tm' :: Parser Tm
- src' :: Parser Tm
- p1 :: String
Documentation
type Name = ByteString Source #
A term in the language. The precedences of different constructs are the following, in decreasing order of strength:
- Identifiers, literals and parenthesized expressions
- Function application (left assoc)
- Multiplication (left assoc)
- Addition (left assoc)
- Equality, less-than (non-assoc)
lam
,let
,if
(right assoc)
Parse an identifier. This parser uses isKeyword
to check that an identifier is not a
keyword.