annotate lab1/tree.mli @ 1:b5139af1a420 tip basis

Fixed permissions on compile scripts
author Mike Spivey <mike@cs.ox.ac.uk>
date Fri, 13 Oct 2017 17:27:58 +0100
parents bfdcc3820b32
children
rev   line source
mike@0 1 (* lab1/tree.mli *)
mike@0 2 (* Copyright (c) 2017 J. M. Spivey *)
mike@0 3
mike@0 4 type ident = string
mike@0 5
mike@0 6 (* |name| -- type for applied occurrences, with annotations *)
mike@0 7 type name =
mike@0 8 { x_name: ident; (* Name of the reference *)
mike@0 9 x_lab: string; (* Global label *)
mike@0 10 x_line: int } (* Line number *)
mike@0 11
mike@0 12 val make_name : ident -> int -> name
mike@0 13
mike@0 14
mike@0 15 (* Abstract syntax *)
mike@0 16
mike@0 17 type program = Program of stmt
mike@0 18
mike@0 19 and stmt =
mike@0 20 Skip
mike@0 21 | Seq of stmt list
mike@0 22 | Assign of name * expr
mike@0 23 | Print of expr
mike@0 24 | Newline
mike@0 25 | IfStmt of expr * stmt * stmt
mike@0 26 | WhileStmt of expr * stmt
mike@0 27
mike@0 28 and expr =
mike@0 29 Constant of int
mike@0 30 | Variable of name
mike@0 31 | Monop of Keiko.op * expr
mike@0 32 | Binop of Keiko.op * expr * expr
mike@0 33
mike@0 34
mike@0 35 (* seq -- neatly join a list of statements into a sequence *)
mike@0 36 val seq : stmt list -> stmt
mike@0 37
mike@0 38 val print_tree : out_channel -> program -> unit