summaryrefslogtreecommitdiff
path: root/src/ast.mli
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2013-11-14 17:58:57 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2013-11-14 17:58:57 +0100
commit5dacc48b53568f673b03de794a9a13f7a5c11b0f (patch)
tree6040bbc45a0ee0ede2af63377c0df43920650b1a /src/ast.mli
parentd9fab442401005b49b9221b9d897501fef9a4d8d (diff)
downloadLPC-Projet-5dacc48b53568f673b03de794a9a13f7a5c11b0f.tar.gz
LPC-Projet-5dacc48b53568f673b03de794a9a13f7a5c11b0f.zip
Imported MIPS ASM definitions and more docs.
Diffstat (limited to 'src/ast.mli')
-rw-r--r--src/ast.mli55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/ast.mli b/src/ast.mli
index 557b3f6..29a6293 100644
--- a/src/ast.mli
+++ b/src/ast.mli
@@ -26,4 +26,59 @@ type expr =
| EThis
| ENull
| EMem of expr * ident
+and str_expr =
+ | SEExpr of expr
+ | SEStr of string
+and instr =
+ | IEmpty
+ | IExpr of expr
+ | IIf of expr * instr * instr
+ | IWhile of expr * instr
+ | IFor of expr list * expr option * expr list * instr
+ | IBlock of block
+ | IStdCoutWrite of str_expr list
+ | IReturn of expr option
+ | IDeclVar of ty_expr * ident * expr option
+ | IDeclVarAssignConstruct of ty_expr * ident * ident * expr list
+and block = instr list
+and ty_expr =
+ | TVoid
+ | TInt
+ | TId of ident
+ | TPtr of ty_expr
+ | TRef of ty_expr
+and var =
+ | VId of ident
+ | VClsMem of ident * ident
+
+type proto =
+ | PConstructor of constructor_proto
+ | PFunction of function_proto
+and constructor_proto = {
+ cc_class : ident;
+ cc_args : arg list;
+}
+and function_proto = {
+ f_type : ty_expr;
+ f_name : var;
+ f_args : arg list;
+}
+and arg = {
+ arg_ty : ty_expr;
+ arg_name : ident;
+}
+and var_decl = ty_expr * ident
+
+type cls = {
+ c_name : ident;
+ c_supers : ident list;
+ c_vars : var_decl list;
+ c_protos : proto list;
+}
+
+type program = {
+ p_classes : cls list;
+ p_vars : var_decl list;
+ p_functions : (proto * block) list; (* class methods included in here *)
+}