repositories
/
cc1516.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of github.com:dopefishh/cc1516
[cc1516.git]
/
src
/
parse.dcl
diff --git
a/src/parse.dcl
b/src/parse.dcl
index
a5bc93a
..
62a0461
100644
(file)
--- a/
src/parse.dcl
+++ b/
src/parse.dcl
@@
-8,37
+8,39
@@
import lex
:: ParserOutput :== Either String AST
:: AST = AST [VarDecl] [FunDecl]
:: ParserOutput :== Either String AST
:: AST = AST [VarDecl] [FunDecl]
-:: VarDecl = VarDecl
String Type
Expr
+:: VarDecl = VarDecl
Type String
Expr
:: Type
:: Type
- = TupleType
Type Type
+ = TupleType
(Type, Type)
| ListType Type
| IdType String
| IntType
| BoolType
| CharType
| VarType
| ListType Type
| IdType String
| IntType
| BoolType
| CharType
| VarType
-
:: Expr
:: Expr
- = VarExpr
String (Maybe FieldSelector)
- | Op2Expr Expr Op2 Expr
//TODO, iets met associativiteit wat niet weet hoe
+ = VarExpr
VarDef
+ | Op2Expr Expr Op2 Expr
| Op1Expr Op1 Expr
| IntExpr Int
| CharExpr Char
| BoolExpr Bool
| Op1Expr Op1 Expr
| IntExpr Int
| CharExpr Char
| BoolExpr Bool
- | FunExpr
String [Expr]
+ | FunExpr
FunCall
| EmptyListExpr
| EmptyListExpr
- | TupleExpr
Expr Expr
-
+ | TupleExpr
(Expr, Expr)
+:: VarDef = VarDef String [FieldSelector]
:: FieldSelector = FieldHd | FieldTl | FieldFst | FieldSnd
:: Op1 = UnNegation | UnMinus
:: Op2 = BiPlus | BiMinus | BiTimes | BiDivide | BiMod | BiEquals | BiLesser |
BiGreater | BiLesserEq | BiGreaterEq | BiUnEqual | BiAnd | BiOr | BiCons
:: FieldSelector = FieldHd | FieldTl | FieldFst | FieldSnd
:: Op1 = UnNegation | UnMinus
:: Op2 = BiPlus | BiMinus | BiTimes | BiDivide | BiMod | BiEquals | BiLesser |
BiGreater | BiLesserEq | BiGreaterEq | BiUnEqual | BiAnd | BiOr | BiCons
-
-//TODO
-
:: FunDecl = FunDecl String [String] FunType [VarDecl] [Stmt]
:: FunDecl = FunDecl String [String] FunType [VarDecl] [Stmt]
-:: FunType = Stub
-:: Stmt = Stubbel
+:: FunType = FunType [Type] (Maybe Type)
+:: FunCall = FunCall String [Expr]
+:: Stmt
+ = IfStmt Expr [Stmt] [Stmt]
+ | WhileStmt Expr [Stmt]
+ | AssStmt VarDef Expr
+ | FunStmt FunCall
+ | ReturnStmt (Maybe Expr)
instance toString AST
instance toString AST