| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Parser.Ast
Description
Contains all AST elements, all of these produced by the Parser module.
Synopsis
- newtype Program = Program [Statement]
- data Statement
- data Declaration
- data Expression
- data Fun = Fun (NonEmpty (Identifier, Maybe Type)) (Maybe Type) Expression
Program
The head of the AST.
Statements
Statement.
Constructors
| StmtDecl Declaration | Declaration statement, see |
| StmtExpr Expression | Expression statement, see |
Declarations
data Declaration Source #
Declaration.
Constructors
| DeclVar (Identifier, Maybe Type) Expression | Variable declaration. let x = 5 |
| DeclFun Identifier IsRec Fun | Function declaration. let f x y = x + y let rec f x y = f x 1 + f 1 y |
Instances
| Show Declaration Source # | |
Defined in Parser.Ast Methods showsPrec :: Int -> Declaration -> ShowS # show :: Declaration -> String # showList :: [Declaration] -> ShowS # | |
| Eq Declaration Source # | |
Defined in Parser.Ast | |
Expressions
data Expression Source #
Expression.
Constructors
| ExprId Identifier | Identifier expression, see |
| ExprPrimVal PrimitiveValue | Primitive value expression, see |
| ExprBinOp BinaryOperator Expression Expression | Binary operation, see |
| ExprUnOp UnaryOperator Expression | Unary operation, see |
| ExprApp Expression Expression | Function application expression. f 6 (fun x y = x + y) 5 |
| ExprIte Expression Expression Expression | If-then-else expression. if x > 4 then x * 8 else x / 15 |
| ExprLetIn Declaration Expression | Let expression. let x = 4 in x * x let f x y = x + y in f 4 8 let rec f x y = f x 1 + f 1 y in f 4 8 |
| ExprFun Fun | Anonymous function, see |
Instances
| Show Expression Source # | |
Defined in Parser.Ast Methods showsPrec :: Int -> Expression -> ShowS # show :: Expression -> String # showList :: [Expression] -> ShowS # | |
| Eq Expression Source # | |
Defined in Parser.Ast | |
Function representation without the name.
It contains its parameters, returned type and body.
fun x -> true
fun x y -> x + y
Constructors
| Fun (NonEmpty (Identifier, Maybe Type)) (Maybe Type) Expression |