diff lab2/dict.mli @ 0:bfdcc3820b32

Basis
author Mike Spivey <mike@cs.ox.ac.uk>
date Thu, 05 Oct 2017 08:04:15 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lab2/dict.mli	Thu Oct 05 08:04:15 2017 +0100
@@ -0,0 +1,27 @@
+(* lab2/dict.mli *)
+(* Copyright (c) 2017 J. M. Spivey *)
+
+type ident = string
+
+type ptype = 
+    Integer 
+  | Boolean 
+  | Array of int * ptype
+  | Void
+
+(* |def| -- definitions in environment *)
+type def = 
+  { d_tag: ident;               (* Name *)
+    d_type: ptype;              (* Type *)
+    d_lab: string }             (* Global label *)
+
+type environment
+
+(* |define| -- add a definition, raise Exit if already declared *)
+val define : def -> environment -> environment
+
+(* |lookup| -- search an environment or raise Not_found *)
+val lookup : ident -> environment -> def
+
+(* |init_env| -- initial empty environment *)
+val init_env : environment