X-Git-Url: https://git.xandkar.net/?p=tiger.ml.git;a=blobdiff_plain;f=compiler%2Fsrc%2Flib%2Ftiger%2Ftiger_absyn.mli;h=662f637c77a046d115d91c3df0647eaa4247c07f;hp=12dc6a86ee2a17893dd0d4fe0335c5df577ed22c;hb=5597e56d8f5d880cfdd425f4a5d2ae6d2637df70;hpb=cda83e5ec171672a59966d2bd9cd28bd7a8fe083 diff --git a/compiler/src/lib/tiger/tiger_absyn.mli b/compiler/src/lib/tiger/tiger_absyn.mli index 12dc6a8..662f637 100644 --- a/compiler/src/lib/tiger/tiger_absyn.mli +++ b/compiler/src/lib/tiger/tiger_absyn.mli @@ -1,7 +1,3 @@ -type pos = Tiger_position.t - -type symbol = Tiger_symbol.t - type oper = | PlusOp | MinusOp @@ -15,128 +11,128 @@ type oper = | GeOp type exp = - | VarExp of - var | NilExp | IntExp of int | StringExp of { string : string - ; pos : pos + ; pos : Tiger_position.t } | CallExp of - { func : symbol + { func : Tiger_symbol.t ; args : exp list - ; pos : pos + ; pos : Tiger_position.t } | OpExp of { left : exp ; oper : oper ; right : exp - ; pos : pos + ; pos : Tiger_position.t } | RecordExp of - { fields : (symbol * exp * pos) list - ; typ : symbol - ; pos : pos + { fields : (Tiger_symbol.t * exp * Tiger_position.t) list + ; typ : Tiger_symbol.t + ; pos : Tiger_position.t } | SeqExp of - (exp * pos) list + (exp * Tiger_position.t) list | AssignExp of { var : var ; exp : exp - ; pos : pos + ; pos : Tiger_position.t } | IfExp of { test : exp ; then' : exp ; else' : exp option - ; pos : pos + ; pos : Tiger_position.t } | WhileExp of { test : exp ; body : exp - ; pos : pos + ; pos : Tiger_position.t } | ForExp of - { var : symbol + { var : Tiger_symbol.t ; escape : bool ref (* Whoa - why a mutable cell in AST? *) ; lo : exp ; hi : exp ; body : exp - ; pos : pos + ; pos : Tiger_position.t } | BreakExp of - pos + Tiger_position.t | LetExp of { decs : dec list ; body : exp - ; pos : pos + ; pos : Tiger_position.t } | ArrayExp of - { typ : symbol + { typ : Tiger_symbol.t ; size : exp ; init : exp - ; pos : pos + ; pos : Tiger_position.t } + | VarExp of + var and var = | SimpleVar of - { symbol : symbol - ; pos : pos + { symbol : Tiger_symbol.t + ; pos : Tiger_position.t } | FieldVar of { var : var - ; symbol : symbol - ; pos : pos + ; symbol : Tiger_symbol.t + ; pos : Tiger_position.t } | SubscriptVar of { var : var ; exp : exp - ; pos : pos + ; pos : Tiger_position.t } and dec = | FunDecs of (* "FunctionDec" in Appel's code *) fundec list | VarDec of - { name : symbol + { name : Tiger_symbol.t ; escape : bool ref (* Again, why mutable? *) - ; typ : (symbol * pos) option + ; typ : (Tiger_symbol.t * Tiger_position.t) option ; init : exp - ; pos : pos + ; pos : Tiger_position.t } | TypeDecs of (* "TypeDec" in Appel's code *) typedec list and ty = | NameTy of - { symbol : symbol - ; pos : pos + { symbol : Tiger_symbol.t + ; pos : Tiger_position.t } | RecordTy of field list | ArrayTy of - { symbol : symbol - ; pos : pos + { symbol : Tiger_symbol.t + ; pos : Tiger_position.t } and field = | Field of - { name : symbol + { name : Tiger_symbol.t ; escape : bool ref - ; typ : symbol - ; pos : pos + ; typ : Tiger_symbol.t + ; pos : Tiger_position.t } and typedec = | TypeDec of (* An anonymous record in Appel's code *) - { name : symbol + { name : Tiger_symbol.t ; ty : ty - ; pos : pos + ; pos : Tiger_position.t } and fundec = | FunDec of - { name : symbol + { name : Tiger_symbol.t ; params : field list - ; result : (symbol * pos) option + ; result : (Tiger_symbol.t * Tiger_position.t) option ; body : exp - ; pos : pos + ; pos : Tiger_position.t } type t = exp