Commit | Line | Data |
---|---|---|
492c1cff AC |
1 | (* HCoop Domtool (http://hcoop.sourceforge.net/) |
2 | * Copyright (c) 2006, Adam Chlipala | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or | |
5 | * modify it under the terms of the GNU General Public License | |
6 | * as published by the Free Software Foundation; either version 2 | |
7 | * of the License, or (at your option) any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
dac62e84 | 17 | *) |
492c1cff AC |
18 | |
19 | (* Domtool type-checking and reduction environments *) | |
20 | ||
21 | signature ENV = sig | |
22 | ||
a3698041 AC |
23 | type typeRule = Ast.exp -> bool |
24 | val registerType : string * typeRule -> unit | |
25 | val typeRule : string -> typeRule option | |
26 | ||
27 | type env_vars = Ast.exp Ast.StringMap.map | |
28 | type action = env_vars * Ast.exp list -> env_vars | |
29 | val registerAction : string * action -> unit | |
30 | val action : string -> action option | |
31 | ||
32 | val registerContainer : string * action * (unit -> unit) -> unit | |
33 | val container : string -> (action * (unit -> unit)) option | |
34 | ||
629a34f6 AC |
35 | val badArgs : string * Ast.exp list -> 'a |
36 | val badArg : string * string * Ast.exp -> 'a | |
37 | ||
38 | type 'a arg = Ast.exp -> 'a option | |
39 | ||
40 | val int : int arg | |
41 | val string : string arg | |
42 | val list : 'a arg -> 'a list arg | |
43 | ||
44 | val one : string -> string * 'a arg -> ('a -> unit) -> action | |
45 | val two : string -> string * 'a arg * string * 'b arg -> ('a * 'b -> unit) -> action | |
46 | ||
47 | val type_one : string -> 'a arg -> ('a -> bool) -> unit | |
48 | ||
49 | val action_one : string -> string * 'a arg -> ('a -> unit) -> unit | |
50 | val action_two : string -> string * 'a arg * string * 'b arg -> ('a * 'b -> unit) -> unit | |
51 | ||
52 | val container_one : string -> string * 'a arg -> ('a -> unit) * (unit -> unit) -> unit | |
6be996d4 | 53 | |
492c1cff AC |
54 | type env |
55 | val empty : env | |
56 | ||
57 | val bindType : env -> string -> env | |
58 | val bindVal : env -> string * Ast.typ * Ast.exp option -> env | |
095de39e | 59 | val bindContext : env -> string -> env |
492c1cff AC |
60 | |
61 | val lookupType : env -> string -> bool | |
62 | val lookupVal : env -> string -> Ast.typ option | |
63 | val lookupEquation : env -> string -> Ast.exp option | |
095de39e | 64 | val lookupContext : env -> string -> bool |
492c1cff | 65 | |
095de39e AC |
66 | val types : env -> Ast.StringSet.set |
67 | val vals : env -> Ast.StringSet.set | |
68 | val contexts : env -> Ast.StringSet.set | |
492c1cff | 69 | end |