Taddeus Kroes 12 лет назад
Родитель
Сommit
f8e99b742a
1 измененных файлов с 25 добавлено и 3 удалено
  1. 25 3
      types.mli

+ 25 - 3
types.mli

@@ -168,7 +168,7 @@ type instr =
 
   | Load of ctype * stack_scope * int   (** [[ifb]load[ gn] G] *)
   | LoadConst of ctype * int            (** [[ifb]loadc C] *)
-  | LoadImm of const                    (** [[ifb]loadc_[01tf]] *)
+  | LoadImm of const                    (** [[ifb]loadc_[01tf] | iloadc_m1] *)
 
   (* Operators ] *)
   | Op of operator * ctype
@@ -198,32 +198,54 @@ type instr =
 
   | EmptyLine  (** Empty line, added in between functions for readability. *)
 
-(** {2 General} *)
+(** {2 Global} *)
 
-(* Intermediate representations between phases *)
+(** Intermediate representations, passed from phase to phase. *)
 type intermediate =
   | Empty
+    (** For phases without input/output (first and last phase). *)
   | FileContent of string * string
+    (** Input file content. *)
   | Ast of node
+    (** Abstract Syntax Tree. *)
   | Assembly of instr list
+    (** List of assembly instructions. *)
 
 (** Container for command-line arguments. *)
 type args_record = {
   mutable infile   : string option;
+  (** Input filename. *)
   mutable outfile  : string option;
+  (** Output filename. *)
   mutable verbose  : int;
+  (** Verbosity level. *)
   mutable cpp      : bool;
+  (** Run C preprocessor? *)
   mutable optimize : bool;
+  (** Run {!Constprop} and {!Peephole} phases? *)
   mutable endphase : string;
+  (** Stop at the phase which has the given identifier (see {!Main.phases}). *)
 }
 
 (** {2 Exceptions} *)
 
+(** Error occurred at a certain location in an input file. *)
 exception LocError of location * string
+
+(** Error occurred at a certain AST node, to be transformed to {!LocError} using
+    {!Util.locof}. *)
 exception NodeError of node * string
+
+(** General compilation error message (caught by main function). *)
 exception CompileError of string
+
+(** Error without message, just makes the compiler fail with non-zero return
+    value. *)
 exception EmptyError
 
+(** Catch-all error for traversals that accept a limit set of node types. *)
 exception InvalidNode
+
+(** Error raised when a phase receives an unsupported {!intermediate} type. *)
 exception InvalidInput of string