comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:bfdcc3820b32
1 (* lab4/check.mli *)
2 (* Copyright (c) 2017 J. M. Spivey *)
3
4 open Tree
5
6 (* This module is the semantic analysis pass of the compiler. It
7 provides a single function |annotate| that takes a program, checks
8 it for semantic errors, and annotates defining and applied
9 occurrences identifiers with the corresponding definitions. These
10 annotations are used by the code generation pass to generate code
11 for variable references.
12
13 If a semantic error is detected, |annotate| raises the exception
14 |Sem_error|. There is no way of resuming the analysis, and only
15 one error can be detected per run of the compiler. *)
16
17 (* |annotate| -- check tree for type errors and annotate with definitions *)
18 val annotate : program -> unit
19
20 (* |Sem_error| -- exception raised on semantic error *)
21 exception Sem_error of string * Print.arg list * int
22
23 (* |regvars| -- whether to allocate register varaibles *)
24 val regvars : bool ref