|
@@ -1,5 +1,7 @@
|
|
|
(** Type definitions for abstract syntax tree, assembly code, and exceptions. *)
|
|
(** Type definitions for abstract syntax tree, assembly code, and exceptions. *)
|
|
|
|
|
|
|
|
|
|
+(** {2 Abstract Syntax Tree} *)
|
|
|
|
|
+
|
|
|
(** [(filename, startline, endline, startcol, endcol)]
|
|
(** [(filename, startline, endline, startcol, endcol)]
|
|
|
Location of node in source code. Used for error reporting. *)
|
|
Location of node in source code. Used for error reporting. *)
|
|
|
type location = string * int * int * int * int
|
|
type location = string * int * int * int * int
|
|
@@ -109,6 +111,8 @@ and node =
|
|
|
| Cond of node * node * node * ann (* cond, true_expr, false_expr *)
|
|
| Cond of node * node * node * ann (* cond, true_expr, false_expr *)
|
|
|
| DummyNode (* null node, pruned by traversals *)
|
|
| DummyNode (* null node, pruned by traversals *)
|
|
|
|
|
|
|
|
|
|
+(** {2 Assembly instructions} *)
|
|
|
|
|
+
|
|
|
type stack_scope = Glob | Local | Rel of int | Current
|
|
type stack_scope = Glob | Local | Rel of int | Current
|
|
|
type rtn_scope = ExternFun of int | LocalFun of int * string
|
|
type rtn_scope = ExternFun of int | LocalFun of int * string
|
|
|
type instr =
|
|
type instr =
|
|
@@ -159,6 +163,8 @@ type instr =
|
|
|
| EmptyLine
|
|
| EmptyLine
|
|
|
| DummyInstr
|
|
| DummyInstr
|
|
|
|
|
|
|
|
|
|
+(** {2 General} *)
|
|
|
|
|
+
|
|
|
(* Intermediate representations between phases *)
|
|
(* Intermediate representations between phases *)
|
|
|
type intermediate =
|
|
type intermediate =
|
|
|
| Empty
|
|
| Empty
|
|
@@ -176,7 +182,8 @@ type args_record = {
|
|
|
mutable endphase : string;
|
|
mutable endphase : string;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-(* Exceptions *)
|
|
|
|
|
|
|
+(** {2 Exceptions} *)
|
|
|
|
|
+
|
|
|
exception LocError of location * string
|
|
exception LocError of location * string
|
|
|
exception NodeError of node * string
|
|
exception NodeError of node * string
|
|
|
exception CompileError of string
|
|
exception CompileError of string
|