Last active
January 27, 2016 09:23
-
-
Save vilterp/0a5acbe2c23df0a1b899 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module AST where | |
import Dict exposing (Dict) | |
type alias Module = | |
{ name : List String | |
, exports : List Exposable | |
, imports : Import | |
, declarations : List Declaration | |
} | |
type alias Import = | |
{ moduleName : List String | |
, asName : String | |
, exposed : List Exposable | |
} | |
type Exposable | |
= BasicNameEx String | |
| TypeEx String (List String) | |
type alias TypeEnv = | |
Dict String TypeExpr | |
type Expr | |
= App Expr Expr | |
| ListLiteral (List Expr) | |
| IntLiteral Int | |
| StringLiteral String | |
| CharLiteral Char | |
| Tuple (List Expr) | |
| IfExpr Expr Expr Expr | |
| PatternMatch Expr (List (Pattern, Expr)) | |
| LetBinding (List (String, Expr)) Expr | |
| Variable (List String) | |
| RecordConstructor (List (String, Expr)) | |
| RecordUpdate | |
{ variable : String | |
, updates : List (String, Expr) | |
} | |
type Pattern | |
= StringLiteralPat String | |
| IntLiteralPat Int | |
| CharLiteralPat Char | |
| ConstructorPat (List String) (List Pattern) | |
| ListPat (List Pattern) | |
| RecordPat (List String) | |
type Declaration | |
= FunctionDecl | |
{ name : String | |
, typeDecl : TypeExpr | |
, params : String | |
, body : Expr | |
} | |
| TypeDecl TypeDecl | |
type TypeDecl | |
= UnionTypeDecl String (List String) (List ConstructorDecl) | |
| TypeAliasDecl String TypeExpr | |
type alias ConstructorDecl = | |
{ name : String | |
, args : List TypeExpr | |
} | |
type TypeExpr | |
= TypeApp TypeExpr TypeExpr | |
| RecordType (List String TypeExpr) | |
| TypeVar String | |
| NamedType (List String) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment