annotate lab4/check.mli @ 0:bfdcc3820b32

Basis
author Mike Spivey <mike@cs.ox.ac.uk>
date Thu, 05 Oct 2017 08:04:15 +0100
parents
children
rev   line source
mike@0 1 (* lab4/check.mli *)
mike@0 2 (* Copyright (c) 2017 J. M. Spivey *)
mike@0 3
mike@0 4 open Tree
mike@0 5
mike@0 6 (* This module is the semantic analysis pass of the compiler. It
mike@0 7 provides a single function |annotate| that takes a program, checks
mike@0 8 it for semantic errors, and annotates defining and applied
mike@0 9 occurrences identifiers with the corresponding definitions. These
mike@0 10 annotations are used by the code generation pass to generate code
mike@0 11 for variable references.
mike@0 12
mike@0 13 If a semantic error is detected, |annotate| raises the exception
mike@0 14 |Sem_error|. There is no way of resuming the analysis, and only
mike@0 15 one error can be detected per run of the compiler. *)
mike@0 16
mike@0 17 (* |annotate| -- check tree for type errors and annotate with definitions *)
mike@0 18 val annotate : program -> unit
mike@0 19
mike@0 20 (* |Sem_error| -- exception raised on semantic error *)
mike@0 21 exception Sem_error of string * Print.arg list * int
mike@0 22
mike@0 23 (* |regvars| -- whether to allocate register varaibles *)
mike@0 24 val regvars : bool ref