Commit 556fe80e authored by Kim Nguyễn's avatar Kim Nguyễn Committed by Pietro Abate

Make it possible compile the ocaml/cduce interface against OCaml 3.1[12]/4.0[01]/4.02.

Conflicts:
	Makefile.distrib
	depend

Change $$ in >> in types.ml for the substitution operator
parent 5abbc48d
......@@ -3,6 +3,7 @@ default: cduce
include Makefile.conf
include VERSION
OCAMLIFACE=ocamliface/$(ML_INTERFACE_VERSION)
ALL_TARGET=cduce cduce_lib.cma
INSTALL_BINARIES=cduce$(EXE)
......@@ -18,6 +19,7 @@ all: cduce_lib.cmxa
endif
PACKAGES = dynlink camlp4 ulex pcre num netstring
ALL_ML_IFACE = 3.x 4.01 4.02
# Call make with VERBOSE=true to get a trace of commands
......@@ -42,7 +44,7 @@ CAMLC_P = ocamlc -g
DEPEND_OCAMLDEP = misc/q_symbol.cmo
ifeq ($(PROFILE), true)
CAMLOPT_P = ocamlopt -p -inline 100
ifeq ($(NATIVE), false)
ifeq ($(NATIVE), false)
CAMLC_P = ocamlcp -p a
SYNTAX_PARSER =
DEPEND_OCAMLDEP =
......@@ -138,7 +140,8 @@ help:
# Source directories
DIRS = misc parser schema typing types compile runtime driver query ocamliface win32
DIRS_DEPEND = misc parser schema typing types compile runtime driver query win32
DIRS := $(DIRS_DEPEND) $(OCAMLIFACE)
CLEAN_DIRS = $(DIRS) tools tests
# Objects to build
......@@ -182,14 +185,6 @@ schema/schema_types.ml: schema/schema_types.mli
compile/auto_pat.ml: compile/auto_pat.mli
cp $^ $@
ML_INTERFACE_OBJS = \
ocamliface/caml_cduce.cmo \
ocamliface/mltypes.cmo ocamliface/mlstub.cmo
ifneq ($(ML_INTERFACE), false)
OBJECTS += $(ML_INTERFACE_OBJS)
endif
ifneq ($(CURL), false)
OBJECTS += parser/cduce_curl.cmo
PACKAGES += curl
......@@ -229,22 +224,37 @@ endif
all: $(ALL_TARGET)
OBJECTS += driver/run.cmo
ML_INTERFACE_BASE_OBJS = caml_cduce.cmo mltypes.cmo mlstub.cmo
ML_INTERFACE_BASE_SRC = $(ML_INTERFACE_BASE_OBJS:.cmo=.ml) $(ML_INTERFACE_BASE_OBJS:.cmo=.mli)
ML_INTERFACE_OBJS = \
$(ML_INTERFACE_BASE_OBJS:%=$(OCAMLIFACE)/%)
OBJECTS_NO_MLIFACE := $(OBJECTS)
ifneq ($(ML_INTERFACE), false)
OBJECTS += $(ML_INTERFACE_OBJS)
endif
CDUCE = $(OBJECTS) driver/start.cmo
ALL_OBJECTS = $(OBJECTS) \
ALL_OBJECTS = $(OBJECTS_NO_MLIFACE) \
driver/start.cmo driver/examples.cmo \
driver/webiface.cmo driver/evaluator.cmo \
tools/validate.cmo \
$(ML_INTERFACE_OBJS) parser/cduce_curl.cmo \
parser/cduce_curl.cmo \
parser/cduce_netclient.cmo \
runtime/cduce_expat.cmo runtime/cduce_pxp.cmo
ALL_INTERFACES = schema/schema_types.mli
#types/var.mli types/boolVar.mli
DEPEND = $(ALL_OBJECTS:.cmo=.ml) $(ALL_OBJECTS:.cmo=.mli) $(ALL_INTERFACES)
INCLUDES = $(DIRS:%=-I %)
INCLUDES_DEPEND = $(DIRS_DEPEND:%=-I %)
# -I +camlp4
cduce: $(CDUCE:.cmo=.$(EXTENSION))
......@@ -271,16 +281,22 @@ dtd2cduce: tools/dtd2cduce.ml
$(HIDE)$(OCAMLFIND) $(CAML) -o $@ -package "$(PXP_PACK) netcgi2" -linkpkg $^
.PHONY: compute_depend
compute_depend: $(DEPEND_OCAMLDEP)
@echo "Computing dependencies ..."
ocamlfind ocamldep -package "$(PACKAGES)" \
$(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) > depend
$(INCLUDES_DEPEND) $(SYNTAX_PARSER) -ppopt pa_extend.cmo -ppopt q_MLast.cmo $(DEPEND) > depend
for i in $(ALL_ML_IFACE); do \
ocamlfind ocamldep -package "$(PACKAGES)" \
$(INCLUDES_DEPEND) -I ocamliface/$$i $(SYNTAX_PARSER) -ppopt pa_extend.cmo -ppopt q_MLast.cmo \
$(ML_INTERFACE_BASE_SRC:%=ocamliface/$$i/%) >> depend;\
done
clean:
for i in $(CLEAN_DIRS); do \
(cd $$i; rm -f *.cmi *.cmo *.cma *.cmx *.o *.a *.cmxa *~); \
done
rm -f misc/q_symbol.cmo.stamp
(cd ocamliface; $(MAKE) clean)
(cd $(OCAMLIFACE); $(MAKE) clean)
rm -f `find . -name "*~"`
rm -f *.cmi *.cmo *.cma *.cmx *.a *.cmxa *.o *~ META
rm -f cduce$(EXE) ocamlprof.dump
......@@ -300,7 +316,7 @@ clean:
distclean: clean
rm -f Makefile.conf
ocamliface/mltypes.$(EXTENSION): ocamliface/caml_cduce.$(EXTENSION)
$(OCAMLIFACE)/mltypes.$(EXTENSION): $(OCAMLIFACE)/caml_cduce.$(EXTENSION)
$(ALL_INTERFACES): misc/q_symbol.cmo
$(ALL_OBJECTS:.cmo=.cmi): misc/q_symbol.cmo
......@@ -308,20 +324,19 @@ $(ALL_OBJECTS:.cmo=.cmx) caml_cduce.cmx: misc/q_symbol.cmo
$(ALL_OBJECTS) caml_cduce.cmo: misc/q_symbol.cmo
$(OCAMLIFACE)/mlstub.$(EXTENSION): SYNTAX += q_MLast.cmo
.SUFFIXES: .ml .mli .cmo .cmi .cmx
misc/q_symbol.cmo: misc/q_symbol.ml
@echo "Build $@"
$(HIDE) $(CAMLC) -c -pp camlp4orf $<
$(HIDE)$(CAMLC) -c -pp camlp4orf $<
.SUFFIXES: .ml .mli .cmo .cmi .cmx
parser/parser.cmo: PACKAGES += camlp4.extend
parser/parser.cmx: PACKAGES += camlp4.extend
types/boolVar.cmo: SYNTAX_PARSER=
types/boolVar.cmi: SYNTAX_PARSER=
types/boolVar.cmx: SYNTAX_PARSER=
parser/parser.cmo: PACKAGES += camlp4.extend
parser/parser.cmx: PACKAGES += camlp4.extend
.ml.cmo:
@echo "Build $@"
$(HIDE)$(CAMLC) -c $(INCLUDES) $(SYNTAX_PARSER) $<
......@@ -364,13 +379,13 @@ install_doc: doc
### Pack OCaml modules for the CDuce/OCaml interface
ocamliface/caml_cduce.cmo:
@cd ocamliface; \
$(OCAMLIFACE)/caml_cduce.cmo:
@cd $(OCAMLIFACE); \
$(MAKE) caml_cduce.cmo
ocamliface/caml_cduce.cmx:
@cd ocamliface; \
$(OCAMLIFACE)/caml_cduce.cmx:
@cd $(OCAMLIFACE); \
$(MAKE) caml_cduce.cmx
ocamliface/mlstub.cmo: SYNTAX += q_MLast.cmo
ocamliface/mlstub.cmx: SYNTAX += q_MLast.cmo
$(OCAMLIFACE)/mlstub.cmo: SYNTAX += q_MLast.cmo
$(OCAMLIFACE)/mlstub.cmx: SYNTAX += q_MLast.cmo
......@@ -336,20 +336,6 @@ tools/validate.cmo : schema/schema_types.cmi schema/schema_parser.cmi \
schema/schema_common.cmi
tools/validate.cmx : schema/schema_types.cmx schema/schema_parser.cmx \
schema/schema_common.cmx
ocamliface/mltypes.cmo : types/ident.cmo ocamliface/config.cmo \
parser/cduce_loc.cmi ocamliface/mltypes.cmi
ocamliface/mltypes.cmx : types/ident.cmx ocamliface/config.cmx \
parser/cduce_loc.cmx ocamliface/mltypes.cmi
ocamliface/mlstub.cmo : types/types.cmi typing/typer.cmi types/sequence.cmi \
misc/ns.cmi ocamliface/mltypes.cmi driver/librarian.cmi types/ident.cmo \
types/externals.cmi compile/compile.cmi parser/cduce_loc.cmi \
driver/cduce_config.cmi types/builtin_defs.cmi types/atoms.cmi \
parser/ast.cmo ocamliface/mlstub.cmi
ocamliface/mlstub.cmx : types/types.cmx typing/typer.cmx types/sequence.cmx \
misc/ns.cmx ocamliface/mltypes.cmx driver/librarian.cmx types/ident.cmx \
types/externals.cmx compile/compile.cmx parser/cduce_loc.cmx \
driver/cduce_config.cmx types/builtin_defs.cmx types/atoms.cmx \
parser/ast.cmx ocamliface/mlstub.cmi
parser/cduce_curl.cmo : runtime/value.cmi parser/url.cmi \
driver/cduce_config.cmi
parser/cduce_curl.cmx : runtime/value.cmx parser/url.cmx \
......@@ -445,9 +431,61 @@ driver/cduce.cmi : runtime/value.cmi types/atoms.cmi
runtime/cduce_pxp.cmi :
runtime/cduce_pxp.cmi :
runtime/cduce_expat.cmi :
ocamliface/mltypes.cmi : types/types.cmi types/ident.cmo
ocamliface/mlstub.cmi : parser/ast.cmo
runtime/cduce_expat.cmi :
runtime/cduce_pxp.cmi :
schema/schema_types.cmi : runtime/value.cmi misc/ns.cmi misc/encodings.cmi \
types/atoms.cmi
ocamliface/3.x/mltypes.cmo : types/ident.cmo ocamliface/3.x/config.cmo \
parser/cduce_loc.cmi ocamliface/3.x/mltypes.cmi
ocamliface/3.x/mltypes.cmx : types/ident.cmx ocamliface/3.x/config.cmx \
parser/cduce_loc.cmx ocamliface/3.x/mltypes.cmi
ocamliface/3.x/mlstub.cmo : types/types.cmi typing/typer.cmi \
types/sequence.cmi misc/ns.cmi ocamliface/3.x/mltypes.cmi \
driver/librarian.cmi types/ident.cmo types/externals.cmi \
compile/compile.cmi parser/cduce_loc.cmi driver/cduce_config.cmi \
types/builtin_defs.cmi types/atoms.cmi parser/ast.cmo \
ocamliface/3.x/mlstub.cmi
ocamliface/3.x/mlstub.cmx : types/types.cmx typing/typer.cmx \
types/sequence.cmx misc/ns.cmx ocamliface/3.x/mltypes.cmx \
driver/librarian.cmx types/ident.cmx types/externals.cmx \
compile/compile.cmx parser/cduce_loc.cmx driver/cduce_config.cmx \
types/builtin_defs.cmx types/atoms.cmx parser/ast.cmx \
ocamliface/3.x/mlstub.cmi
ocamliface/3.x/mltypes.cmi : types/types.cmi
ocamliface/3.x/mlstub.cmi : parser/ast.cmo
ocamliface/4.01/mltypes.cmo : types/ident.cmo ocamliface/4.01/config.cmo \
parser/cduce_loc.cmi ocamliface/4.01/mltypes.cmi
ocamliface/4.01/mltypes.cmx : types/ident.cmx ocamliface/4.01/config.cmx \
parser/cduce_loc.cmx ocamliface/4.01/mltypes.cmi
ocamliface/4.01/mlstub.cmo : types/types.cmi typing/typer.cmi \
types/sequence.cmi misc/ns.cmi ocamliface/4.01/mltypes.cmi \
driver/librarian.cmi types/ident.cmo types/externals.cmi \
compile/compile.cmi parser/cduce_loc.cmi driver/cduce_config.cmi \
types/builtin_defs.cmi types/atoms.cmi parser/ast.cmo \
ocamliface/4.01/mlstub.cmi
ocamliface/4.01/mlstub.cmx : types/types.cmx typing/typer.cmx \
types/sequence.cmx misc/ns.cmx ocamliface/4.01/mltypes.cmx \
driver/librarian.cmx types/ident.cmx types/externals.cmx \
compile/compile.cmx parser/cduce_loc.cmx driver/cduce_config.cmx \
types/builtin_defs.cmx types/atoms.cmx parser/ast.cmx \
ocamliface/4.01/mlstub.cmi
ocamliface/4.01/mltypes.cmi : types/types.cmi types/ident.cmo
ocamliface/4.01/mlstub.cmi : parser/ast.cmo
ocamliface/4.02/mltypes.cmo : types/ident.cmo ocamliface/4.02/config.cmo \
parser/cduce_loc.cmi ocamliface/4.02/mltypes.cmi
ocamliface/4.02/mltypes.cmx : types/ident.cmx ocamliface/4.02/config.cmx \
parser/cduce_loc.cmx ocamliface/4.02/mltypes.cmi
ocamliface/4.02/mlstub.cmo : types/types.cmi typing/typer.cmi \
types/sequence.cmi misc/ns.cmi ocamliface/4.02/mltypes.cmi \
driver/librarian.cmi types/ident.cmo types/externals.cmi \
compile/compile.cmi parser/cduce_loc.cmi driver/cduce_config.cmi \
types/builtin_defs.cmi types/atoms.cmi parser/ast.cmo \
ocamliface/4.02/mlstub.cmi
ocamliface/4.02/mlstub.cmx : types/types.cmx typing/typer.cmx \
types/sequence.cmx misc/ns.cmx ocamliface/4.02/mltypes.cmx \
driver/librarian.cmx types/ident.cmx types/externals.cmx \
compile/compile.cmx parser/cduce_loc.cmx driver/cduce_config.cmx \
types/builtin_defs.cmx types/atoms.cmx parser/ast.cmx \
ocamliface/4.02/mlstub.cmi
ocamliface/4.02/mltypes.cmi : types/types.cmi types/ident.cmo
ocamliface/4.02/mlstub.cmi : parser/ast.cmo
# This Makefile generates caml_cduce.cmo/.cmx
# It must be called with an OCAML_SRC argument pointing to the root
# of an OCaml source tree.
include ../../Makefile.conf
all: caml_cduce.cmo caml_cduce.cmx
STDLIB=$(shell ocamlc -where)
ifeq ($(FORPACK),true)
FORPACKOPT1=-for-pack Cduce_lib.Caml_cduce
FORPACKOPT2=-for-pack Cduce_lib
else
FORPACKOPT1=
FORPACKOPT2=
endif
ocaml_files:
mkdir ocaml_files
$(HIDE)cp $(patsubst %,$(OCAML_SRC)/%, $(COPY_FILES)) ocaml_files/
cp location.ml ocaml_files/location.ml
cp ocaml_files/asttypes.mli ocaml_files/asttypes.ml
sed s=STDLIB=$(STDLIB)= config.ml > ocaml_files/config.ml
grep cmi_magic $(OCAML_SRC)/utils/config.mlp >> ocaml_files/config.ml
caml_cduce.cmo: ocaml_files
@echo "Build $@"
(cd ocaml_files; \
ocamlc $(FORPACKOPT1) -c $(COMPILE_FILES);\
ocamlc $(FORPACKOPT2) -pack -o $@ $(OBJECTS); \
cp caml_cduce.cmo caml_cduce.cmi ..)
caml_cduce.cmx: ocaml_files
@echo "Build $@"
(cd ocaml_files; ocamlopt $(FORPACKOPT1) -c $(COMPILE_FILES);\
ocamlopt $(FORPACKOPT2) -pack -o $@ $(XOBJECTS); \
cp caml_cduce.cmx caml_cduce.o caml_cduce.cmi ..)
clean:
rm -Rf ocaml_files *~ *.cm*
COPY_FILES=\
typing/annot.mli \
utils/misc.ml utils/tbl.ml \
utils/consistbl.ml utils/warnings.ml utils/terminfo.ml utils/clflags.ml \
parsing/asttypes.mli parsing/location.mli \
parsing/longident.ml \
typing/outcometree.mli \
typing/ident.ml typing/path.ml \
typing/primitive.ml typing/types.ml \
typing/btype.ml typing/oprint.ml \
typing/subst.ml typing/predef.ml \
typing/datarepr.ml typing/env.ml \
typing/ctype.ml typing/ctype.mli typing/printtyp.ml
COMPILE_FILES=\
asttypes.mli outcometree.mli asttypes.ml \
config.ml misc.ml tbl.ml \
clflags.ml consistbl.ml warnings.ml terminfo.ml \
location.mli location.ml annot.mli longident.ml \
ident.ml path.ml \
primitive.ml types.ml \
btype.ml oprint.ml \
subst.ml predef.ml \
datarepr.ml env.ml ctype.mli ctype.ml printtyp.ml
COMPILE_FILES_ML=$(filter %.ml,$(COMPILE_FILES))
OBJECTS=$(COMPILE_FILES_ML:.ml=.cmo)
XOBJECTS=$(COMPILE_FILES_ML:.ml=.cmx)
(* An implementation of the OCaml's Location signature (to cut dependencies
to other OCaml modules *)
open Lexing
type t = { loc_start: position; loc_end: position; loc_ghost: bool }
let none = { loc_start = dummy_pos; loc_end = dummy_pos; loc_ghost = true }
let dummy x = assert false
let in_file = dummy
let init = dummy
let curr = dummy
let symbol_rloc = dummy
let symbol_gloc = dummy
let rhs_loc = dummy
let input_name = ref ""
let input_lexbuf = ref None
let get_pos_info = dummy
let print_error_cur_file = dummy
let print_error = dummy
let print = dummy
let print_warning = dummy
let prerr_warning = dummy
let echo_eof = dummy
let reset = dummy
let highlight_locations = dummy
This diff is collapsed.
(**************************************************************************)
(* The CDuce compiler *)
(* Alain Frisch <Alain.Frisch@inria.fr> and the CDuce team *)
(* Copyright CNRS,INRIA, 2003-2009 (see LICENSE for details) *)
(**************************************************************************)
open Camlp4.PreCast
val gen_wrapper: string list -> Ast.str_item
This diff is collapsed.
(**************************************************************************)
(* The CDuce compiler *)
(* Alain Frisch <Alain.Frisch@inria.fr> and the CDuce team *)
(* Copyright CNRS,INRIA, 2003-2009 (see LICENSE for details) *)
(**************************************************************************)
open Caml_cduce
open Asttypes
open Types
exception Error of string
type t = { uid : int; mutable recurs : int; mutable def : def }
and def =
| Link of t
| Arrow of string * t * t
| Tuple of t list
| PVariant of (string * t option) list (* Polymorphic variant *)
| Variant of string * (string * t list) list * bool
| Record of string * (string * t) list * bool
| Builtin of string * t list
| Abstract of string
| Var of int
val reg_uid: t -> unit
(* Load an external .cmi *)
val has_cmi: string -> bool
val load_module: string -> (string * t) list
(* Load the .cmi corresponding to a CDuce compilation unit *)
val read_cmi: string -> string * (string * Types.type_expr * t) list
val print : Format.formatter -> t -> unit
val print_ocaml : Format.formatter -> Types.type_expr -> unit
val find_value: string -> t * int
# This Makefile generates caml_cduce.cmo/.cmx
# It must be called with an OCAML_SRC argument pointing to the root
# of an OCaml source tree.
include ../Makefile.conf
include ../../Makefile.conf
ifneq ($(VERBOSE), true)
HIDE=@
......
let standard_library = "STDLIB"
let load_path = ref ([] : string list)
let bytecomp_c_compiler = ""
let bytecomp_c_linker = ""
# This Makefile generates caml_cduce.cmo/.cmx
# It must be called with an OCAML_SRC argument pointing to the root
# of an OCaml source tree.
include ../../Makefile.conf
all: caml_cduce.cmo caml_cduce.cmx
STDLIB=$(shell ocamlc -where)
ifeq ($(FORPACK),true)
FORPACKOPT1=-for-pack Cduce_lib.Caml_cduce
FORPACKOPT2=-for-pack Cduce_lib
else
FORPACKOPT1=
FORPACKOPT2=
endif
ocaml_files:
mkdir ocaml_files
$(HIDE)cp $(patsubst %,$(OCAML_SRC)/%, $(COPY_FILES)) ocaml_files/
cp location.ml ocaml_files/location.ml
cp parsetree.ml ocaml_files/parsetree.ml
cp ast_mapper.ml ocaml_files/ast_mapper.ml
cp ocaml_files/asttypes.mli ocaml_files/asttypes.ml
sed s=STDLIB=$(STDLIB)= config.ml > ocaml_files/config.ml
grep cmi_magic $(OCAML_SRC)/utils/config.mlp | head -1 >> ocaml_files/config.ml
caml_cduce.cmo: ocaml_files
@echo "Build $@"
(cd ocaml_files; \
ocamlc $(FORPACKOPT1) -c $(COMPILE_FILES);\
ocamlc $(FORPACKOPT2) -pack -o $@ $(OBJECTS); \
cp caml_cduce.cmo caml_cduce.cmi ..)
caml_cduce.cmx: ocaml_files
@echo "Build $@"
(cd ocaml_files; ocamlopt $(FORPACKOPT1) -c $(COMPILE_FILES);\
ocamlopt $(FORPACKOPT2) -pack -o $@ $(XOBJECTS); \
cp caml_cduce.cmx caml_cduce.o caml_cduce.cmi ..)
clean:
rm -Rf ocaml_files *~ *.cm*
COPY_FILES=\
typing/annot.mli \
utils/misc.ml utils/tbl.ml \
utils/consistbl.ml utils/warnings.ml utils/terminfo.ml utils/clflags.mli \
utils/clflags.ml \
parsing/asttypes.mli parsing/location.mli \
parsing/longident.ml \
typing/outcometree.mli \
typing/ident.ml typing/path.ml \
typing/primitive.ml typing/types.ml \
typing/btype.ml typing/oprint.ml \
typing/subst.ml typing/predef.ml \
typing/datarepr.ml typing/env.ml \
typing/ctype.ml typing/ctype.mli typing/printtyp.ml typing/cmi_format.mli typing/cmi_format.ml
COMPILE_FILES=\
warnings.ml location.mli asttypes.mli outcometree.mli annot.mli asttypes.ml \
config.ml misc.ml tbl.ml \
clflags.mli \
clflags.ml consistbl.ml terminfo.ml \
location.ml longident.ml \
ident.ml path.ml \
parsetree.ml \
ast_mapper.ml \
primitive.ml types.ml \
btype.ml oprint.ml \
subst.ml predef.ml \
datarepr.ml cmi_format.mli cmi_format.ml env.ml ctype.mli ctype.ml printtyp.ml
COMPILE_FILES_ML=$(filter %.ml,$(COMPILE_FILES))
OBJECTS=$(COMPILE_FILES_ML:.ml=.cmo)
XOBJECTS=$(COMPILE_FILES_ML:.ml=.cmx)
open Parsetree
type mapper = { location : mapper -> Location.t -> Location.t;
attributes : mapper -> attribute list -> attribute list }
let default_mapper = { location = (fun _ x -> x);
attributes = (fun _ x -> x); }
let standard_library = "STDLIB"
let load_path = ref ([] : string list)
let bytecomp_c_compiler = ""
let bytecomp_c_linker = ""
(* An implementation of the OCaml's Location signature (to cut dependencies
to other OCaml modules *)
open Lexing
type t = { loc_start: position; loc_end: position; loc_ghost: bool }
type 'a loc = { txt: 'a; loc: t }
type error =
{
loc: t;
msg: string;
sub: error list;
if_highlight: string; (* alternative message if locations are highlighted *)
}
exception Error of error
let none = { loc_start = dummy_pos; loc_end = dummy_pos; loc_ghost = true }
let dummy x = assert false
let in_file = dummy
let init = dummy
let curr = dummy
let symbol_rloc = dummy
let symbol_gloc = dummy
let rhs_loc = dummy
let input_name = ref ""
let input_lexbuf = ref None
let get_pos_info = dummy
let print_error_cur_file = dummy
let print_error = dummy
let print = dummy
let print_warning = dummy
let prerr_warning = dummy
let echo_eof = dummy
let reset = dummy
let highlight_locations = dummy
let mknoloc = dummy
let mkloc = dummy
let print_loc = dummy
let print_filename = dummy
let show_filename = dummy
let absname = ref true
let report_exception = dummy
let report_error = dummy
let register_error_of_exn = dummy
let error_of_exn = dummy
let error_of_printer_file = dummy
let error_of_printer = dummy
let error ?(loc=none) ?(sub=[]) ?(if_highlight="") = dummy
let errorf = error
let absolute_path = dummy
This diff is collapsed.
open Camlp4.PreCast
val gen_wrapper: string list -> Ast.str_item
This diff is collapsed.
open Caml_cduce
open Asttypes
open Types
exception Error of string
type t = { uid : int; mutable recurs : int; mutable def : def }
and def =
| Link of t
| Arrow of string * t * t
| Tuple of t list
| PVariant of (string * t option) list (* Polymorphic variant *)
| Variant of string * (Ident.t * t list * t option) list * bool
| Record of string * (Ident.t * t) list * bool
| Builtin of string * t list
| Abstract of string
| Var of int
val reg_uid: t -> unit
(* Load an external .cmi *)
val has_cmi: string -> bool
val load_module: string -> (string * t) list
(* Load the .cmi corresponding to a CDuce compilation unit *)
val read_cmi: string -> string * (string * Types.type_expr * t) list
val print : Format.formatter -> t -> unit
val print_ocaml : Format.formatter -> Types.type_expr -> unit
val find_value: string -> t * int
type attribute = string
type attributes = attribute list
......@@ -201,7 +201,7 @@ let rec eval_sigma env =
List.fold_left (fun acc sigma_j ->
let exists_sub =
List.exists (fun (_,s_i) ->
inzero env env.(x) (Types.Tallying.(s_i $$ sigma_j))
inzero env env.(x) (Types.Tallying.(s_i >> sigma_j))
) iface
in
if exists_sub then sigma_j::acc else acc
......@@ -219,7 +219,7 @@ and inzero env v t =
| Abstraction (Some iface,_,sigma) ->
let s = List.fold_left (fun acc t -> Types.cap acc (snd t)) Types.any iface in
List.for_all (fun si ->
Types.subtype (Types.Tallying.(s $$ si)) t
Types.subtype (Types.Tallying.(s >> si)) t
) (eval_sigma env sigma)
| _ -> true
......
......@@ -3473,7 +3473,7 @@ module Tallying = struct
(CS.ES.elements el)
(* apply sigma to t *)
let ($$) t si = CS.E.fold (fun v sub acc -> Positive.substitute acc (v,sub)) si t
let (>>) t si = CS.E.fold (fun v sub acc -> Positive.substitute acc (v,sub)) si t
type symsubst = I | S of CS.sigma | A of (symsubst * symsubst)
......@@ -3508,9 +3508,9 @@ module Tallying = struct
in
let rec aux t = function
|I -> t
|S si -> t $$ si
|A (S si,_) when filter t si -> t $$ si
|A (S si,S sj) when filterdiff t si sj -> (t $$ sj) $$ si
|S si -> t >> si
|A (S si,_) when filter t si -> t >> si
|A (S si,S sj) when filterdiff t si sj -> (t >> sj) >> si
|A (si,sj) -> aux (aux t sj) si
in
aux t si
......@@ -3603,7 +3603,7 @@ let apply_raw delta s t =
let new_res =
Positive.clean_type delta (
List.fold_left (fun tacc si ->
cap tacc (Tallying.(gamma $$ si))
cap tacc (Tallying.(gamma >> si))
) any sl
)
in
......
......@@ -434,7 +434,7 @@ module Tallying : sig
if si # delta and for all (s,t) in C si @ s < si @ t *)
val tallying : Var.Set.t -> (t * t) list -> CS.sl
val ($$) : t -> CS.sigma -> t
val (>>) : t -> CS.sigma -> t
(** Symbolic Substitution Set *)
type symsubst =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment