| 1 |
(* |
| 2 |
* Interface with the match compiler to generate ML code |
| 3 |
*) |
| 4 |
signature MATCH_GEN = |
| 5 |
sig |
| 6 |
structure Ast : MDL_AST |
| 7 |
structure MC : MATCH_COMPILER |
| 8 |
structure LitMap : ORD_MAP where type Key.ord_key = Ast.literal |
| 9 |
|
| 10 |
datatype conrep = CONREP of Ast.id list * Ast.consbind * Ast.datatypebind |
| 11 |
| EXN of Ast.id list * Ast.id * Ast.ty option |
| 12 |
|
| 13 |
structure Env : |
| 14 |
sig |
| 15 |
type env |
| 16 |
val insertSig : env * Ast.id * env -> env |
| 17 |
val insertCons : env * Ast.id * conrep -> env |
| 18 |
val lookupSig : env * Ast.id -> env option |
| 19 |
val lookupCons : env * Ast.id -> conrep option |
| 20 |
val empty : env |
| 21 |
end |
| 22 |
|
| 23 |
type compiled_type_info = Env.env |
| 24 |
|
| 25 |
val init : unit -> unit |
| 26 |
|
| 27 |
val compileTypes : Ast.decl list -> compiled_type_info |
| 28 |
|
| 29 |
val compile : compiled_type_info -> Ast.clause list -> MC.compiled_dfa |
| 30 |
|
| 31 |
val report : {warning : string -> unit, |
| 32 |
error : string -> unit, |
| 33 |
log : string -> unit, |
| 34 |
dfa : MC.compiled_dfa, |
| 35 |
rules : Ast.clause list |
| 36 |
} -> unit |
| 37 |
|
| 38 |
val codeGen : {root : Ast.exp, |
| 39 |
dfa : MC.compiled_dfa, |
| 40 |
fail : unit -> Ast.exp, |
| 41 |
literals : Ast.id LitMap.map ref |
| 42 |
} -> Ast.exp |
| 43 |
|
| 44 |
val isComplex : Ast.clause list -> bool |
| 45 |
|
| 46 |
end |