diff --git a/generator/js_of_ast.ml b/generator/js_of_ast.ml index 7bf7f95d5b77b19e39bdcbd4024d5494df31c7fe..4e823e2a4054efb268d7b589cfeaa56e6584dd64 100644 --- a/generator/js_of_ast.ml +++ b/generator/js_of_ast.ml @@ -14,13 +14,20 @@ open Types open Typedtree let hashtbl_size = 256 + +(* val type_tbl : (string, string list * string list) Hashtbl.t + * Mapping constructor names to a pair of module list and constructor names list *) let type_tbl = Hashtbl.create hashtbl_size +(* Hard-code the special-syntax of the list datatype *) +let _ = Hashtbl.add type_tbl "[]" ([], []) +let _ = Hashtbl.add type_tbl "::" ([], ["head"; "tail"]) + let record_tbl = Hashtbl.create hashtbl_size let module_list = ref [] let module_code = ref [] let module_created = ref [] module L = Logged (Token_generator) (struct let size = 256 end) - + (** * Debug-purpose functions *) diff --git a/generator/stdlib_ml/stdlib.mli b/generator/stdlib_ml/stdlib.mli index 232b07f6712faa25c3b93e35212fcb0665a5131c..d85d15290349315037afeaba430b43890b47a12e 100644 --- a/generator/stdlib_ml/stdlib.mli +++ b/generator/stdlib_ml/stdlib.mli @@ -1,3 +1,9 @@ +(* Following type definition for lists hardcoded into OCaml/generator: +type 'a list = +| [] +| :: [@f head, tail] of 'a * 'a list +*) + val add : 'a -> 'b -> 'c val ( + ) : 'a -> 'b -> 'c val sub : 'a -> 'a -> 'a