From f2ace198bcb22108cd2963c7e8e7ff3f7ca6729f Mon Sep 17 00:00:00 2001 From: Samuel VIVIEN Date: Mon, 3 Jan 2022 19:25:16 +0100 Subject: [PATCH 01/13] renamed parser misc and asttypes --- .gitignore | 4 +- compiler/.depend | 382 +++++++++--------- compiler/Makefile | 22 +- compiler/caml/caml2caml.ml | 4 +- compiler/caml/caml_ast.ml | 2 +- compiler/caml/caml_misc.ml | 4 +- compiler/caml/lco2caml.ml | 6 +- compiler/caml/lk2caml.ml | 6 +- compiler/caml/print_caml_src.ml | 4 +- compiler/external/lucky.ml | 2 +- compiler/external/lucky_errors.ml | 2 +- compiler/global/global.ml | 2 +- compiler/global/initialization.ml | 2 +- compiler/global/modules.ml | 2 +- .../global/{asttypes.ml => rml_asttypes.ml} | 0 compiler/global/{misc.ml => rml_misc.ml} | 0 compiler/lco/lco_ast.ml | 2 +- compiler/lco/reac2lco.ml | 4 +- compiler/lk/lk_ast.ml | 2 +- compiler/lk/reac2lk.ml | 6 +- compiler/main/compiler.ml | 10 +- compiler/main/configure.ml | 2 +- compiler/main/errors.ml | 10 +- compiler/main/interactive.ml | 8 +- compiler/main/main.ml | 2 +- compiler/main/options.ml | 2 +- compiler/optimization/reac_optimization.ml | 2 +- compiler/other_analysis/instantaneous_loop.ml | 10 +- compiler/other_analysis/wf_rec.ml | 6 +- compiler/parsing/lexer.mll | 4 +- compiler/parsing/parse.ml | 12 +- compiler/parsing/parse_ast.ml | 2 +- compiler/parsing/parse_printer.ml | 2 +- .../parsing/{parser.mly => rml_parser.mly} | 2 +- compiler/reac/annot.ml | 6 +- compiler/reac/binding_errors.ml | 2 +- compiler/reac/parse2reac.ml | 4 +- compiler/reac/reac2reac.ml | 22 +- compiler/reac/reac_ast.ml | 2 +- compiler/reac/reac_misc.ml | 16 +- compiler/static/static.ml | 114 +++--- compiler/static/static_errors.ml | 2 +- compiler/static/static_printer.ml | 2 +- compiler/typing/def_types.ml | 2 +- compiler/typing/reactivity_check.ml | 8 +- compiler/typing/reactivity_effects.ml | 6 +- compiler/typing/types.ml | 2 +- compiler/typing/types_printer.ml | 6 +- compiler/typing/typing.ml | 4 +- compiler/typing/typing_errors.ml | 2 +- tools/rmldep/Makefile | 4 +- tools/rmldep/depend.ml | 16 +- tools/rmldep/rmldep.ml | 6 +- 53 files changed, 379 insertions(+), 379 deletions(-) rename compiler/global/{asttypes.ml => rml_asttypes.ml} (100%) rename compiler/global/{misc.ml => rml_misc.ml} (100%) rename compiler/parsing/{parser.mly => rml_parser.mly} (99%) diff --git a/.gitignore b/.gitignore index f95d7f0a..060e634c 100644 --- a/.gitignore +++ b/.gitignore @@ -35,8 +35,8 @@ compiler/global/version.ml compiler/global/rzi.ml compiler/parsing/lexer.ml compiler/parsing/linenum.ml -compiler/parsing/parser.ml -compiler/parsing/parser.mli +compiler/parsing/rml_parser.ml +compiler/parsing/rml_parser.mli tools/rmlbuild/rmlbuild/boot/ toplevel/rmltop_controller.ml toplevel/rmltop_lexer.ml diff --git a/compiler/.depend b/compiler/.depend index 7d6e3821..16dabc10 100644 --- a/compiler/.depend +++ b/compiler/.depend @@ -1,5 +1,3 @@ -global/asttypes.cmo : -global/asttypes.cmx : global/def_modules.cmo : \ global/global.cmo \ typing/def_types.cmo @@ -7,10 +5,10 @@ global/def_modules.cmx : \ global/global.cmx \ typing/def_types.cmx global/global.cmo : \ - global/misc.cmo \ + global/rml_misc.cmo \ global/global_ident.cmo global/global.cmx : \ - global/misc.cmx \ + global/rml_misc.cmx \ global/global_ident.cmx global/global_ident.cmo : \ global/ident.cmo @@ -20,30 +18,24 @@ global/ident.cmo : global/ident.cmx : global/initialization.cmo : \ typing/types.cmo \ + global/rml_misc.cmo \ global/modules.cmo \ - global/misc.cmo \ global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ typing/def_types.cmo global/initialization.cmx : \ typing/types.cmx \ + global/rml_misc.cmx \ global/modules.cmx \ - global/misc.cmx \ global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ typing/def_types.cmx -global/misc.cmo : \ - global/version.cmo \ - parsing/location.cmo -global/misc.cmx : \ - global/version.cmx \ - parsing/location.cmx global/modules.cmo : \ global/rzi.cmi \ + global/rml_misc.cmo \ parsing/parse_ident.cmo \ - global/misc.cmo \ global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ @@ -51,13 +43,21 @@ global/modules.cmo : \ global/def_modules.cmo global/modules.cmx : \ global/rzi.cmx \ + global/rml_misc.cmx \ parsing/parse_ident.cmx \ - global/misc.cmx \ global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ typing/def_types.cmx \ global/def_modules.cmx +global/rml_asttypes.cmo : +global/rml_asttypes.cmx : +global/rml_misc.cmo : \ + global/version.cmo \ + parsing/location.cmo +global/rml_misc.cmx : \ + global/version.cmx \ + parsing/location.cmx global/rzi.cmo : \ global/rzi.cmi global/rzi.cmx : \ @@ -71,13 +71,13 @@ global/warnings.cmo : global/warnings.cmx : parsing/lexer.cmo : \ global/warnings.cmo \ - parsing/parser.cmi \ - global/misc.cmo \ + parsing/rml_parser.cmi \ + global/rml_misc.cmo \ parsing/location.cmo parsing/lexer.cmx : \ global/warnings.cmx \ - parsing/parser.cmx \ - global/misc.cmx \ + parsing/rml_parser.cmx \ + global/rml_misc.cmx \ parsing/location.cmx parsing/linenum.cmo : parsing/linenum.cmx : @@ -89,55 +89,55 @@ parsing/location.cmx : \ parsing/linenum.cmx parsing/parse.cmo : \ parsing/syntaxerr.cmo \ - parsing/parser.cmi \ + parsing/rml_parser.cmi \ parsing/location.cmo \ parsing/lexer.cmo parsing/parse.cmx : \ parsing/syntaxerr.cmx \ - parsing/parser.cmx \ + parsing/rml_parser.cmx \ parsing/location.cmx \ parsing/lexer.cmx parsing/parse_ast.cmo : \ + global/rml_asttypes.cmo \ parsing/parse_ident.cmo \ parsing/location.cmo \ - static/def_static.cmo \ - global/asttypes.cmo + static/def_static.cmo parsing/parse_ast.cmx : \ + global/rml_asttypes.cmx \ parsing/parse_ident.cmx \ parsing/location.cmx \ - static/def_static.cmx \ - global/asttypes.cmx + static/def_static.cmx parsing/parse_ident.cmo : parsing/parse_ident.cmx : parsing/parse_printer.cmo : \ + global/rml_asttypes.cmo \ parsing/parse_ident.cmo \ parsing/parse_ast.cmo \ parsing/location.cmo \ - static/def_static.cmo \ - global/asttypes.cmo + static/def_static.cmo parsing/parse_printer.cmx : \ + global/rml_asttypes.cmx \ parsing/parse_ident.cmx \ parsing/parse_ast.cmx \ parsing/location.cmx \ - static/def_static.cmx \ - global/asttypes.cmx -parsing/parser.cmo : \ + static/def_static.cmx +parsing/rml_parser.cmo : \ parsing/syntaxerr.cmo \ + global/rml_asttypes.cmo \ parsing/parse_ident.cmo \ parsing/parse_ast.cmo \ parsing/location.cmo \ static/def_static.cmo \ - global/asttypes.cmo \ - parsing/parser.cmi -parsing/parser.cmx : \ + parsing/rml_parser.cmi +parsing/rml_parser.cmx : \ parsing/syntaxerr.cmx \ + global/rml_asttypes.cmx \ parsing/parse_ident.cmx \ parsing/parse_ast.cmx \ parsing/location.cmx \ static/def_static.cmx \ - global/asttypes.cmx \ - parsing/parser.cmi -parsing/parser.cmi : \ + parsing/rml_parser.cmi +parsing/rml_parser.cmi : \ parsing/parse_ast.cmo parsing/syntaxerr.cmo : \ parsing/location.cmo @@ -150,135 +150,136 @@ external/external.cmx : \ parsing/parse_ast.cmx \ external/lucky.cmx external/lucky.cmo : \ + global/rml_asttypes.cmo \ parsing/parse_ident.cmo \ parsing/parse_ast.cmo \ external/lucky_errors.cmo \ - parsing/location.cmo \ - global/asttypes.cmo + parsing/location.cmo external/lucky.cmx : \ + global/rml_asttypes.cmx \ parsing/parse_ident.cmx \ parsing/parse_ast.cmx \ external/lucky_errors.cmx \ - parsing/location.cmx \ - global/asttypes.cmx + parsing/location.cmx external/lucky_errors.cmo : \ + global/rml_misc.cmo \ parsing/parse_ast.cmo \ - global/misc.cmo \ parsing/location.cmo external/lucky_errors.cmx : \ + global/rml_misc.cmx \ parsing/parse_ast.cmx \ - global/misc.cmx \ parsing/location.cmx static/def_static.cmo : static/def_static.cmx : static/static.cmo : \ static/static_errors.cmo \ + global/rml_misc.cmo \ + global/rml_asttypes.cmo \ reac/reac_ast.cmo \ - global/misc.cmo \ typing/def_types.cmo \ - static/def_static.cmo \ - global/asttypes.cmo + static/def_static.cmo static/static.cmx : \ static/static_errors.cmx \ + global/rml_misc.cmx \ + global/rml_asttypes.cmx \ reac/reac_ast.cmx \ - global/misc.cmx \ typing/def_types.cmx \ - static/def_static.cmx \ - global/asttypes.cmx + static/def_static.cmx static/static_errors.cmo : \ + global/rml_misc.cmo \ reac/reac_ast.cmo \ - global/misc.cmo \ parsing/location.cmo \ static/def_static.cmo static/static_errors.cmx : \ + global/rml_misc.cmx \ reac/reac_ast.cmx \ - global/misc.cmx \ parsing/location.cmx \ static/def_static.cmx static/static_printer.cmo : \ + global/rml_asttypes.cmo \ reac/reac_ast.cmo \ - static/def_static.cmo \ - global/asttypes.cmo + static/def_static.cmo static/static_printer.cmx : \ + global/rml_asttypes.cmx \ reac/reac_ast.cmx \ - static/def_static.cmx \ - global/asttypes.cmx + static/def_static.cmx typing/def_types.cmo : \ + global/rml_asttypes.cmo \ global/global.cmo \ - static/def_static.cmo \ - global/asttypes.cmo + static/def_static.cmo typing/def_types.cmx : \ + global/rml_asttypes.cmx \ global/global.cmx \ - static/def_static.cmx \ - global/asttypes.cmx + static/def_static.cmx typing/reactivity_check.cmo : \ + global/rml_misc.cmo \ + global/rml_asttypes.cmo \ reac/reac_ast.cmo \ reac/reac2reac.cmo \ - global/misc.cmo \ parsing/location.cmo \ - typing/def_types.cmo \ - global/asttypes.cmo + typing/def_types.cmo typing/reactivity_check.cmx : \ + global/rml_misc.cmx \ + global/rml_asttypes.cmx \ reac/reac_ast.cmx \ reac/reac2reac.cmx \ - global/misc.cmx \ parsing/location.cmx \ - typing/def_types.cmx \ - global/asttypes.cmx + typing/def_types.cmx typing/reactivity_effects.cmo : \ typing/types_printer.cmo \ + global/rml_misc.cmo \ + global/rml_asttypes.cmo \ reac/reac_ast.cmo \ - global/misc.cmo \ global/ident.cmo \ - typing/def_types.cmo \ - global/asttypes.cmo + typing/def_types.cmo typing/reactivity_effects.cmx : \ typing/types_printer.cmx \ + global/rml_misc.cmx \ + global/rml_asttypes.cmx \ reac/reac_ast.cmx \ - global/misc.cmx \ global/ident.cmx \ - typing/def_types.cmx \ - global/asttypes.cmx + typing/def_types.cmx typing/types.cmo : \ + global/rml_misc.cmo \ typing/reactivity_effects.cmo \ - global/misc.cmo \ global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ typing/def_types.cmo typing/types.cmx : \ + global/rml_misc.cmx \ typing/reactivity_effects.cmx \ - global/misc.cmx \ global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ typing/def_types.cmx typing/types_printer.cmo : \ + global/rml_misc.cmo \ + global/rml_asttypes.cmo \ global/modules.cmo \ - global/misc.cmo \ global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ - typing/def_types.cmo \ - global/asttypes.cmo + typing/def_types.cmo typing/types_printer.cmx : \ + global/rml_misc.cmx \ + global/rml_asttypes.cmx \ global/modules.cmx \ - global/misc.cmx \ global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ - typing/def_types.cmx \ - global/asttypes.cmx + typing/def_types.cmx typing/typing.cmo : \ typing/typing_errors.cmo \ typing/types_printer.cmo \ typing/types.cmo \ global/symbol_table.cmo \ + global/rml_misc.cmo \ + global/rml_asttypes.cmo \ typing/reactivity_effects.cmo \ typing/reactivity_check.cmo \ reac/reac_misc.cmo \ reac/reac_ast.cmo \ - global/misc.cmo \ parsing/location.cmo \ global/initialization.cmo \ global/ident.cmo \ @@ -286,18 +287,18 @@ typing/typing.cmo : \ global/global.cmo \ typing/def_types.cmo \ static/def_static.cmo \ - global/asttypes.cmo \ reac/annot.cmo typing/typing.cmx : \ typing/typing_errors.cmx \ typing/types_printer.cmx \ typing/types.cmx \ global/symbol_table.cmx \ + global/rml_misc.cmx \ + global/rml_asttypes.cmx \ typing/reactivity_effects.cmx \ typing/reactivity_check.cmx \ reac/reac_misc.cmx \ reac/reac_ast.cmx \ - global/misc.cmx \ parsing/location.cmx \ global/initialization.cmx \ global/ident.cmx \ @@ -305,13 +306,12 @@ typing/typing.cmx : \ global/global.cmx \ typing/def_types.cmx \ static/def_static.cmx \ - global/asttypes.cmx \ reac/annot.cmx typing/typing_errors.cmo : \ typing/types_printer.cmo \ typing/types.cmo \ + global/rml_misc.cmo \ reac/reac_ast.cmo \ - global/misc.cmo \ parsing/location.cmo \ global/ident.cmo \ global/global_ident.cmo \ @@ -319,54 +319,54 @@ typing/typing_errors.cmo : \ typing/typing_errors.cmx : \ typing/types_printer.cmx \ typing/types.cmx \ + global/rml_misc.cmx \ reac/reac_ast.cmx \ - global/misc.cmx \ parsing/location.cmx \ global/ident.cmx \ global/global_ident.cmx \ typing/def_types.cmx other_analysis/instantaneous_loop.cmo : \ static/static.cmo \ + global/rml_misc.cmo \ + global/rml_asttypes.cmo \ reac/reac_misc.cmo \ reac/reac_ast.cmo \ - global/misc.cmo \ parsing/location.cmo \ global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ - static/def_static.cmo \ - global/asttypes.cmo + static/def_static.cmo other_analysis/instantaneous_loop.cmx : \ static/static.cmx \ + global/rml_misc.cmx \ + global/rml_asttypes.cmx \ reac/reac_misc.cmx \ reac/reac_ast.cmx \ - global/misc.cmx \ parsing/location.cmx \ global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ - static/def_static.cmx \ - global/asttypes.cmx + static/def_static.cmx other_analysis/wf_rec.cmo : \ + global/rml_misc.cmo \ + global/rml_asttypes.cmo \ reac/reac_misc.cmo \ reac/reac_ast.cmo \ reac/reac2reac.cmo \ - global/misc.cmo \ - parsing/location.cmo \ - global/asttypes.cmo + parsing/location.cmo other_analysis/wf_rec.cmx : \ + global/rml_misc.cmx \ + global/rml_asttypes.cmx \ reac/reac_misc.cmx \ reac/reac_ast.cmx \ reac/reac2reac.cmx \ - global/misc.cmx \ - parsing/location.cmx \ - global/asttypes.cmx + parsing/location.cmx reac/annot.cmo : \ typing/types_printer.cmo \ static/static_printer.cmo \ + global/rml_misc.cmo \ typing/reactivity_effects.cmo \ reac/reac_ast.cmo \ - global/misc.cmo \ parsing/location.cmo \ other_analysis/instantaneous_loop.cmo \ typing/def_types.cmo \ @@ -374,251 +374,252 @@ reac/annot.cmo : \ reac/annot.cmx : \ typing/types_printer.cmx \ static/static_printer.cmx \ + global/rml_misc.cmx \ typing/reactivity_effects.cmx \ reac/reac_ast.cmx \ - global/misc.cmx \ parsing/location.cmx \ other_analysis/instantaneous_loop.cmx \ typing/def_types.cmx \ static/def_static.cmx reac/binding_errors.cmo : \ + global/rml_misc.cmo \ parsing/parse_ident.cmo \ parsing/parse_ast.cmo \ - global/misc.cmo \ parsing/location.cmo reac/binding_errors.cmx : \ + global/rml_misc.cmx \ parsing/parse_ident.cmx \ parsing/parse_ast.cmx \ - global/misc.cmx \ parsing/location.cmx reac/parse2reac.cmo : \ typing/types.cmo \ global/symbol_table.cmo \ + global/rml_misc.cmo \ + global/rml_asttypes.cmo \ reac/reac_misc.cmo \ reac/reac_ast.cmo \ parsing/parse_ident.cmo \ parsing/parse_ast.cmo \ global/modules.cmo \ - global/misc.cmo \ parsing/location.cmo \ global/ident.cmo \ global/global.cmo \ typing/def_types.cmo \ - reac/binding_errors.cmo \ - global/asttypes.cmo + reac/binding_errors.cmo reac/parse2reac.cmx : \ typing/types.cmx \ global/symbol_table.cmx \ + global/rml_misc.cmx \ + global/rml_asttypes.cmx \ reac/reac_misc.cmx \ reac/reac_ast.cmx \ parsing/parse_ident.cmx \ parsing/parse_ast.cmx \ global/modules.cmx \ - global/misc.cmx \ parsing/location.cmx \ global/ident.cmx \ global/global.cmx \ typing/def_types.cmx \ - reac/binding_errors.cmx \ - global/asttypes.cmx + reac/binding_errors.cmx reac/reac2reac.cmo : \ + global/rml_misc.cmo \ + global/rml_asttypes.cmo \ reac/reac_misc.cmo \ reac/reac_ast.cmo \ - global/misc.cmo \ parsing/location.cmo \ typing/def_types.cmo \ - static/def_static.cmo \ - global/asttypes.cmo + static/def_static.cmo reac/reac2reac.cmx : \ + global/rml_misc.cmx \ + global/rml_asttypes.cmx \ reac/reac_misc.cmx \ reac/reac_ast.cmx \ - global/misc.cmx \ parsing/location.cmx \ typing/def_types.cmx \ - static/def_static.cmx \ - global/asttypes.cmx + static/def_static.cmx reac/reac_ast.cmo : \ + global/rml_asttypes.cmo \ parsing/location.cmo \ global/ident.cmo \ global/global.cmo \ typing/def_types.cmo \ - static/def_static.cmo \ - global/asttypes.cmo + static/def_static.cmo reac/reac_ast.cmx : \ + global/rml_asttypes.cmx \ parsing/location.cmx \ global/ident.cmx \ global/global.cmx \ typing/def_types.cmx \ - static/def_static.cmx \ - global/asttypes.cmx + static/def_static.cmx reac/reac_misc.cmo : \ typing/types.cmo \ + global/rml_misc.cmo \ + global/rml_asttypes.cmo \ typing/reactivity_effects.cmo \ reac/reac_ast.cmo \ - global/misc.cmo \ global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ typing/def_types.cmo \ - static/def_static.cmo \ - global/asttypes.cmo + static/def_static.cmo reac/reac_misc.cmx : \ typing/types.cmx \ + global/rml_misc.cmx \ + global/rml_asttypes.cmx \ typing/reactivity_effects.cmx \ reac/reac_ast.cmx \ - global/misc.cmx \ global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ typing/def_types.cmx \ - static/def_static.cmx \ - global/asttypes.cmx + static/def_static.cmx lco/lco_ast.cmo : \ + global/rml_asttypes.cmo \ parsing/location.cmo \ global/ident.cmo \ global/global.cmo \ - typing/def_types.cmo \ - global/asttypes.cmo + typing/def_types.cmo lco/lco_ast.cmx : \ + global/rml_asttypes.cmx \ parsing/location.cmx \ global/ident.cmx \ global/global.cmx \ - typing/def_types.cmx \ - global/asttypes.cmx + typing/def_types.cmx lco/lco_misc.cmo : \ lco/lco_ast.cmo lco/lco_misc.cmx : \ lco/lco_ast.cmx lco/reac2lco.cmo : \ + global/rml_misc.cmo \ + global/rml_asttypes.cmo \ reac/reac_misc.cmo \ reac/reac_ast.cmo \ global/modules.cmo \ - global/misc.cmo \ parsing/location.cmo \ lco/lco_ast.cmo \ global/initialization.cmo \ global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ - static/def_static.cmo \ - global/asttypes.cmo + static/def_static.cmo lco/reac2lco.cmx : \ + global/rml_misc.cmx \ + global/rml_asttypes.cmx \ reac/reac_misc.cmx \ reac/reac_ast.cmx \ global/modules.cmx \ - global/misc.cmx \ parsing/location.cmx \ lco/lco_ast.cmx \ global/initialization.cmx \ global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ - static/def_static.cmx \ - global/asttypes.cmx + static/def_static.cmx lk/lk_ast.cmo : \ + global/rml_asttypes.cmo \ parsing/location.cmo \ global/ident.cmo \ global/global.cmo \ - typing/def_types.cmo \ - global/asttypes.cmo + typing/def_types.cmo lk/lk_ast.cmx : \ + global/rml_asttypes.cmx \ parsing/location.cmx \ global/ident.cmx \ global/global.cmx \ - typing/def_types.cmx \ - global/asttypes.cmx + typing/def_types.cmx lk/lk_misc.cmo : \ lk/lk_ast.cmo lk/lk_misc.cmx : \ lk/lk_ast.cmx lk/reac2lk.cmo : \ + global/rml_misc.cmo \ + global/rml_asttypes.cmo \ reac/reac_misc.cmo \ reac/reac_ast.cmo \ - global/misc.cmo \ parsing/location.cmo \ lk/lk_ast.cmo \ global/ident.cmo \ - static/def_static.cmo \ - global/asttypes.cmo + static/def_static.cmo lk/reac2lk.cmx : \ + global/rml_misc.cmx \ + global/rml_asttypes.cmx \ reac/reac_misc.cmx \ reac/reac_ast.cmx \ - global/misc.cmx \ parsing/location.cmx \ lk/lk_ast.cmx \ global/ident.cmx \ - static/def_static.cmx \ - global/asttypes.cmx + static/def_static.cmx caml/caml2caml.cmo : \ global/symbol_table.cmo \ - global/misc.cmo \ + global/rml_misc.cmo \ + global/rml_asttypes.cmo \ global/ident.cmo \ caml/caml_misc.cmo \ - caml/caml_ast.cmo \ - global/asttypes.cmo + caml/caml_ast.cmo caml/caml2caml.cmx : \ global/symbol_table.cmx \ - global/misc.cmx \ + global/rml_misc.cmx \ + global/rml_asttypes.cmx \ global/ident.cmx \ caml/caml_misc.cmx \ - caml/caml_ast.cmx \ - global/asttypes.cmx + caml/caml_ast.cmx caml/caml_ast.cmo : \ + global/rml_asttypes.cmo \ parsing/location.cmo \ global/ident.cmo \ global/global.cmo \ - typing/def_types.cmo \ - global/asttypes.cmo + typing/def_types.cmo caml/caml_ast.cmx : \ + global/rml_asttypes.cmx \ parsing/location.cmx \ global/ident.cmx \ global/global.cmx \ - typing/def_types.cmx \ - global/asttypes.cmx + typing/def_types.cmx caml/caml_misc.cmo : \ + global/rml_misc.cmo \ + global/rml_asttypes.cmo \ global/modules.cmo \ - global/misc.cmo \ parsing/location.cmo \ global/initialization.cmo \ global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ typing/def_types.cmo \ - caml/caml_ast.cmo \ - global/asttypes.cmo + caml/caml_ast.cmo caml/caml_misc.cmx : \ + global/rml_misc.cmx \ + global/rml_asttypes.cmx \ global/modules.cmx \ - global/misc.cmx \ parsing/location.cmx \ global/initialization.cmx \ global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ typing/def_types.cmx \ - caml/caml_ast.cmx \ - global/asttypes.cmx + caml/caml_ast.cmx caml/lco2caml.cmo : \ - global/misc.cmo \ + global/rml_misc.cmo \ + global/rml_asttypes.cmo \ parsing/location.cmo \ lco/lco_misc.cmo \ lco/lco_ast.cmo \ global/global_ident.cmo \ global/global.cmo \ caml/caml_misc.cmo \ - caml/caml_ast.cmo \ - global/asttypes.cmo + caml/caml_ast.cmo caml/lco2caml.cmx : \ - global/misc.cmx \ + global/rml_misc.cmx \ + global/rml_asttypes.cmx \ parsing/location.cmx \ lco/lco_misc.cmx \ lco/lco_ast.cmx \ global/global_ident.cmx \ global/global.cmx \ caml/caml_misc.cmx \ - caml/caml_ast.cmx \ - global/asttypes.cmx + caml/caml_ast.cmx caml/lk2caml.cmo : \ - global/misc.cmo \ + global/rml_misc.cmo \ + global/rml_asttypes.cmo \ parsing/location.cmo \ lk/lk_misc.cmo \ lk/lk_ast.cmo \ @@ -627,10 +628,10 @@ caml/lk2caml.cmo : \ global/global_ident.cmo \ global/global.cmo \ caml/caml_misc.cmo \ - caml/caml_ast.cmo \ - global/asttypes.cmo + caml/caml_ast.cmo caml/lk2caml.cmx : \ - global/misc.cmx \ + global/rml_misc.cmx \ + global/rml_asttypes.cmx \ parsing/location.cmx \ lk/lk_misc.cmx \ lk/lk_ast.cmx \ @@ -639,26 +640,26 @@ caml/lk2caml.cmx : \ global/global_ident.cmx \ global/global.cmx \ caml/caml_misc.cmx \ - caml/caml_ast.cmx \ - global/asttypes.cmx + caml/caml_ast.cmx caml/print_caml_src.cmo : \ - global/misc.cmo \ + global/rml_misc.cmo \ + global/rml_asttypes.cmo \ global/initialization.cmo \ global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ - caml/caml_ast.cmo \ - global/asttypes.cmo + caml/caml_ast.cmo caml/print_caml_src.cmx : \ - global/misc.cmx \ + global/rml_misc.cmx \ + global/rml_asttypes.cmx \ global/initialization.cmx \ global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ - caml/caml_ast.cmx \ - global/asttypes.cmx + caml/caml_ast.cmx optimization/reac_optimization.cmo : \ typing/types.cmo \ + global/rml_asttypes.cmo \ reac/reac_misc.cmo \ reac/reac_ast.cmo \ parsing/parse_ident.cmo \ @@ -666,10 +667,10 @@ optimization/reac_optimization.cmo : \ parsing/location.cmo \ global/initialization.cmo \ typing/def_types.cmo \ - static/def_static.cmo \ - global/asttypes.cmo + static/def_static.cmo optimization/reac_optimization.cmx : \ typing/types.cmx \ + global/rml_asttypes.cmx \ reac/reac_misc.cmx \ reac/reac_ast.cmx \ parsing/parse_ident.cmx \ @@ -677,8 +678,7 @@ optimization/reac_optimization.cmx : \ parsing/location.cmx \ global/initialization.cmx \ typing/def_types.cmx \ - static/def_static.cmx \ - global/asttypes.cmx + static/def_static.cmx optimization/remove_when.cmo : \ reac/reac_misc.cmo \ reac/reac_ast.cmo \ @@ -695,6 +695,7 @@ main/compiler.cmo : \ other_analysis/wf_rec.cmo \ typing/typing.cmo \ static/static.cmo \ + global/rml_misc.cmo \ optimization/reac_optimization.cmo \ reac/reac2reac.cmo \ lk/reac2lk.cmo \ @@ -705,7 +706,6 @@ main/compiler.cmo : \ reac/parse2reac.cmo \ parsing/parse.cmo \ global/modules.cmo \ - global/misc.cmo \ parsing/location.cmo \ caml/lk2caml.cmo \ caml/lco2caml.cmo \ @@ -722,6 +722,7 @@ main/compiler.cmx : \ other_analysis/wf_rec.cmx \ typing/typing.cmx \ static/static.cmx \ + global/rml_misc.cmx \ optimization/reac_optimization.cmx \ reac/reac2reac.cmx \ lk/reac2lk.cmx \ @@ -732,7 +733,6 @@ main/compiler.cmx : \ reac/parse2reac.cmx \ parsing/parse.cmx \ global/modules.cmx \ - global/misc.cmx \ parsing/location.cmx \ caml/lk2caml.cmx \ caml/lco2caml.cmx \ @@ -747,26 +747,26 @@ main/compiler.cmx : \ reac/annot.cmx main/configure.cmo : \ global/version.cmo \ - global/misc.cmo + global/rml_misc.cmo main/configure.cmx : \ global/version.cmx \ - global/misc.cmx + global/rml_misc.cmx main/errors.cmo : \ global/warnings.cmo \ parsing/syntaxerr.cmo \ - global/misc.cmo \ + global/rml_misc.cmo \ parsing/location.cmo \ parsing/lexer.cmo main/errors.cmx : \ global/warnings.cmx \ parsing/syntaxerr.cmx \ - global/misc.cmx \ + global/rml_misc.cmx \ parsing/location.cmx \ parsing/lexer.cmx main/interactive.cmo : \ + global/rml_misc.cmo \ parsing/parse.cmo \ global/modules.cmo \ - global/misc.cmo \ parsing/location.cmo \ parsing/lexer.cmo \ global/initialization.cmo \ @@ -775,9 +775,9 @@ main/interactive.cmo : \ main/configure.cmo \ main/compiler.cmo main/interactive.cmx : \ + global/rml_misc.cmx \ parsing/parse.cmx \ global/modules.cmx \ - global/misc.cmx \ parsing/location.cmx \ parsing/lexer.cmx \ global/initialization.cmx \ @@ -786,22 +786,22 @@ main/interactive.cmx : \ main/configure.cmx \ main/compiler.cmx main/main.cmo : \ + global/rml_misc.cmo \ global/modules.cmo \ - global/misc.cmo \ main/interactive.cmo \ main/errors.cmo \ main/compiler.cmo main/main.cmx : \ + global/rml_misc.cmx \ global/modules.cmx \ - global/misc.cmx \ main/interactive.cmx \ main/errors.cmx \ main/compiler.cmx main/options.cmo : \ - global/misc.cmo \ + global/rml_misc.cmo \ main/errors.cmo \ main/configure.cmo main/options.cmx : \ - global/misc.cmx \ + global/rml_misc.cmx \ main/errors.cmx \ main/configure.cmx diff --git a/compiler/Makefile b/compiler/Makefile index a9cbecf8..d92ed727 100644 --- a/compiler/Makefile +++ b/compiler/Makefile @@ -3,12 +3,12 @@ BIN = rmlc DIRECTORIES = global parsing external static typing other_analysis reac lco lk caml optimization main -GLOBAL = global/asttypes.ml \ +GLOBAL = global/rml_asttypes.ml \ global/global.ml \ global/global_ident.ml \ global/ident.ml \ global/initialization.ml \ - global/misc.ml \ + global/rml_misc.ml \ global/modules.ml \ global/def_modules.ml \ global/rzi.ml \ @@ -22,7 +22,7 @@ PARSING = parsing/lexer.mll \ parsing/parse_ident.ml \ parsing/parse.ml \ parsing/parse_printer.ml \ - parsing/parser.mly \ + parsing/rml_parser.mly \ parsing/syntaxerr.ml \ EXTERNAL = external/lucky.ml \ @@ -81,11 +81,11 @@ SRC = $(GLOBAL) $(PARSING) $(REAC) $(TYPING) $(OTHER_ANALYSIS) $(EXTERNAL) $(STA OBJ = global/version.cmo \ - global/asttypes.cmo \ + global/rml_asttypes.cmo \ global/warnings.cmo \ parsing/linenum.cmo \ parsing/location.cmo \ - global/misc.cmo \ + global/rml_misc.cmo \ global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ @@ -102,7 +102,7 @@ OBJ = global/version.cmo \ main/options.cmo \ parsing/parse_ast.cmo \ parsing/parse_ident.cmo \ - parsing/parser.cmo \ + parsing/rml_parser.cmo \ parsing/parse.cmo \ parsing/parse_printer.cmo \ external/lucky_errors.cmo \ @@ -148,7 +148,7 @@ OBJ_OPT = $(OBJ:.cmo=.cmx) INCLUDES = $(DIRECTORIES:%=-I %) -GENSOURCES = global/version.ml parsing/parser.mli parsing/lexer.ml parsing/parser.ml \ +GENSOURCES = global/version.ml parsing/rml_parser.mli parsing/lexer.ml parsing/rml_parser.ml \ parsing/linenum.ml include ../config @@ -197,7 +197,7 @@ realclean: clean (for d in $(DIRECTORIES); \ do rm -f $$d/*~; \ done) - rm -f $(BIN).byte $(BIN).opt $(GENSOURCES) parsing/parser.output + rm -f $(BIN).byte $(BIN).opt $(GENSOURCES) parsing/rml_parser.output rm -f rmlc global/version.ml global/rzi.ml *~ cleanall: realclean @@ -213,9 +213,9 @@ wc: wc -l $(SRC) # dependencies -parsing/parser.mli parsing/parser.ml: parsing/parser.mly - $(OCAMLYACC) -v parsing/parser.mly -lexer.cmx: parser.cmi +parsing/rml_parser.mli parsing/rml_parser.ml: parsing/rml_parser.mly + $(OCAMLYACC) -v parsing/rml_parser.mly +lexer.cmx: rml_parser.cmi #.PHONY: global/rzi.ml global/rzi.ml: global/rzi.cmi global/def_modules.cmo diff --git a/compiler/caml/caml2caml.ml b/compiler/caml/caml2caml.ml index 2fb278b1..f6c5af45 100644 --- a/compiler/caml/caml2caml.ml +++ b/compiler/caml/caml2caml.ml @@ -25,8 +25,8 @@ (* Source to source transformations *) -open Misc -open Asttypes +open Rml_misc +open Rml_asttypes open Caml_ast open Caml_misc diff --git a/compiler/caml/caml_ast.ml b/compiler/caml/caml_ast.ml index 5a5158b7..a8c6a1c9 100644 --- a/compiler/caml/caml_ast.ml +++ b/compiler/caml/caml_ast.ml @@ -25,7 +25,7 @@ (* The abstract syntax for CAML *) -open Asttypes +open Rml_asttypes open Def_types type signal = Ident.t diff --git a/compiler/caml/caml_misc.ml b/compiler/caml/caml_misc.ml index 3472fbbc..42213779 100644 --- a/compiler/caml/caml_misc.ml +++ b/compiler/caml/caml_misc.ml @@ -25,12 +25,12 @@ (* Functions on Caml AST *) -open Asttypes +open Rml_asttypes open Def_types open Caml_ast open Global open Global_ident -open Misc +open Rml_misc (* Building functions *) diff --git a/compiler/caml/lco2caml.ml b/compiler/caml/lco2caml.ml index 3869e86f..57ec759a 100644 --- a/compiler/caml/lco2caml.ml +++ b/compiler/caml/lco2caml.ml @@ -30,8 +30,8 @@ open Caml_ast open Caml_misc open Global open Global_ident -open Asttypes -open Misc +open Rml_asttypes +open Rml_misc (* Translation of type expressions *) @@ -303,7 +303,7 @@ let rec translate_ml e = | Coexpr_exec p -> let hook = make_rml_exec_hook () in Cexpr_apply - (make_module_value !Misc.rml_machine_module "rml_exec", + (make_module_value !Rml_misc.rml_machine_module "rml_exec", [hook; translate_ml p]) diff --git a/compiler/caml/lk2caml.ml b/compiler/caml/lk2caml.ml index f81a4bb8..aea8f050 100644 --- a/compiler/caml/lk2caml.ml +++ b/compiler/caml/lk2caml.ml @@ -30,8 +30,8 @@ open Caml_ast open Caml_misc open Global open Global_ident -open Asttypes -open Misc +open Rml_asttypes +open Rml_misc (* Version of the combinators generated *) type version = @@ -344,7 +344,7 @@ let rec translate_ml e = | Kexpr_exec p -> let hook = make_rml_exec_hook () in Cexpr_apply - (make_module_value !Misc.rml_machine_module "rml_exec", + (make_module_value !Rml_misc.rml_machine_module "rml_exec", [hook; translate_ml p]) diff --git a/compiler/caml/print_caml_src.ml b/compiler/caml/print_caml_src.ml index 99e72962..e1dcc541 100644 --- a/compiler/caml/print_caml_src.ml +++ b/compiler/caml/print_caml_src.ml @@ -30,10 +30,10 @@ (** Printing [Caml] code *) -open Misc +open Rml_misc open Format open Caml_ast -open Asttypes +open Rml_asttypes open Global open Global_ident diff --git a/compiler/external/lucky.ml b/compiler/external/lucky.ml index 79a07f5f..27789002 100644 --- a/compiler/external/lucky.ml +++ b/compiler/external/lucky.ml @@ -25,7 +25,7 @@ (* Code generation to import Lucky definitions *) -open Asttypes +open Rml_asttypes open Parse_ident open Parse_ast diff --git a/compiler/external/lucky_errors.ml b/compiler/external/lucky_errors.ml index 9e7e7d04..79ece1b1 100644 --- a/compiler/external/lucky_errors.ml +++ b/compiler/external/lucky_errors.ml @@ -23,7 +23,7 @@ (* $Id$ *) -open Misc +open Rml_misc open Parse_ast (* Printing of error messages about Lucky import *) diff --git a/compiler/global/global.ml b/compiler/global/global.ml index df05d00a..1581a0bb 100644 --- a/compiler/global/global.ml +++ b/compiler/global/global.ml @@ -28,7 +28,7 @@ (* $Id$ *) -open Misc +open Rml_misc (* values in the symbol table *) diff --git a/compiler/global/initialization.ml b/compiler/global/initialization.ml index 3959823f..749b8112 100644 --- a/compiler/global/initialization.ml +++ b/compiler/global/initialization.ml @@ -30,7 +30,7 @@ (* the initial module *) -open Misc +open Rml_misc open Ident open Global_ident open Def_types diff --git a/compiler/global/modules.ml b/compiler/global/modules.ml index a7cd3a67..7c24d4c0 100644 --- a/compiler/global/modules.ml +++ b/compiler/global/modules.ml @@ -28,7 +28,7 @@ (* $Id$ *) -open Misc +open Rml_misc open Global_ident open Def_types open Global diff --git a/compiler/global/asttypes.ml b/compiler/global/rml_asttypes.ml similarity index 100% rename from compiler/global/asttypes.ml rename to compiler/global/rml_asttypes.ml diff --git a/compiler/global/misc.ml b/compiler/global/rml_misc.ml similarity index 100% rename from compiler/global/misc.ml rename to compiler/global/rml_misc.ml diff --git a/compiler/lco/lco_ast.ml b/compiler/lco/lco_ast.ml index 766fe529..77f500f0 100644 --- a/compiler/lco/lco_ast.ml +++ b/compiler/lco/lco_ast.ml @@ -25,7 +25,7 @@ (* The abstract syntax for the Lco language *) -open Asttypes +open Rml_asttypes open Def_types type ident = Ident.t diff --git a/compiler/lco/reac2lco.ml b/compiler/lco/reac2lco.ml index b0258258..f373f688 100644 --- a/compiler/lco/reac2lco.ml +++ b/compiler/lco/reac2lco.ml @@ -25,13 +25,13 @@ (* The translation of Reac to Lco *) -open Asttypes +open Rml_asttypes open Def_static open Reac_ast open Lco_ast open Global open Global_ident -open Misc +open Rml_misc let make_expr e loc = diff --git a/compiler/lk/lk_ast.ml b/compiler/lk/lk_ast.ml index bd629390..e0eb2aef 100644 --- a/compiler/lk/lk_ast.ml +++ b/compiler/lk/lk_ast.ml @@ -25,7 +25,7 @@ (* The abstract syntax for the Lk language (cf. thesis) *) -open Asttypes +open Rml_asttypes open Def_types type ident = Ident.t diff --git a/compiler/lk/reac2lk.ml b/compiler/lk/reac2lk.ml index 755fabda..b5f12570 100644 --- a/compiler/lk/reac2lk.ml +++ b/compiler/lk/reac2lk.ml @@ -25,11 +25,11 @@ (* The translation of Reac to Lk *) -open Asttypes +open Rml_asttypes open Def_static open Reac_ast open Lk_ast -open Misc +open Rml_misc let make_expr e loc = @@ -554,7 +554,7 @@ and translate_proc e k (ctrl: ident) = Location.none) | Rexpr_control (s, Some _, proc) -> - Misc.not_yet_implemented "Reac2lk.translate_proc Rexpr_control" + Rml_misc.not_yet_implemented "Reac2lk.translate_proc Rexpr_control" (* C_k[let s in p] = *) (* bind K = k in let s in C_K[p] *) diff --git a/compiler/main/compiler.ml b/compiler/main/compiler.ml index e72f1dd5..33593ab6 100644 --- a/compiler/main/compiler.ml +++ b/compiler/main/compiler.ml @@ -28,7 +28,7 @@ (* $Id$ *) -open Misc +open Rml_misc open Errors @@ -145,7 +145,7 @@ let compile_implementation_front_end info_fmt filename itf impl_list = end else begin (* write interface *) - Misc.opt_iter Modules.write_compiled_interface itf; + Rml_misc.opt_iter Modules.write_compiled_interface itf; end; (* we return the rml code *) @@ -246,7 +246,7 @@ let compile_implementation module_name filename = then None else Some (open_out_bin obj_interf_name) in - let info_fmt = !Misc.std_fmt in + let info_fmt = !Rml_misc.std_fmt in try (* Front_end_timer.start();*) @@ -272,7 +272,7 @@ let compile_implementation module_name filename = let intermediate_code = compile_implementation_front_end info_fmt filename itf decl_list in - Misc.opt_iter close_out itf; + Rml_misc.opt_iter close_out itf; if Sys.file_exists (filename ^ ".rmli") || Sys.file_exists (filename ^ ".mli") @@ -330,7 +330,7 @@ let compile_implementation module_name filename = "] " in output_string out_chan - ("let _ = "^(!Misc.rml_machine_module)^".rml_exec "^ + ("let _ = "^(!Rml_misc.rml_machine_module)^".rml_exec "^ boi_hook^ main_id^"\n") end; diff --git a/compiler/main/configure.ml b/compiler/main/configure.ml index 15777b2d..948d5061 100644 --- a/compiler/main/configure.ml +++ b/compiler/main/configure.ml @@ -23,7 +23,7 @@ (* $Id$ *) -open Misc +open Rml_misc (* add a file in the list of file to compile. *) let add_to_compile file = diff --git a/compiler/main/errors.ml b/compiler/main/errors.ml index 55a95c6c..9059ac7c 100644 --- a/compiler/main/errors.ml +++ b/compiler/main/errors.ml @@ -50,8 +50,8 @@ let report_error ppf exn = | Syntaxerr.Error err -> Syntaxerr.report_error ppf err - | Misc.Error -> () - | Misc.Internal (loc,msg) -> + | Rml_misc.Error -> () + | Rml_misc.Internal (loc,msg) -> if loc = Location.none then fprintf ppf "@.Internal error: %s. \nPlease report it." msg else @@ -65,17 +65,17 @@ let report_error ppf exn = let unbound_main main = eprintf "The main process \"%s\" is unbound" main; - raise Misc.Error + raise Rml_misc.Error let bad_type_main main main_ty = eprintf "The main process \"%s\" must have type unit process.\n" main; (* Types_printer.output main_ty.Def_types.value_typ.Def_types.ts_desc; *) - raise Misc.Error + raise Rml_misc.Error let no_compile_itf filename = eprintf "Error: Could not find the .rzi file for interface %s.rmli." filename; - raise Misc.Error + raise Rml_misc.Error diff --git a/compiler/main/interactive.ml b/compiler/main/interactive.ml index a3250a85..c10fc724 100644 --- a/compiler/main/interactive.ml +++ b/compiler/main/interactive.ml @@ -54,16 +54,16 @@ let translate_phrase phrase = let decl_list = List.map External.expend decl_list in (* front-end *) let intermediate_code = - Compiler.compile_implementation_front_end !Misc.err_fmt "" None decl_list + Compiler.compile_implementation_front_end !Rml_misc.err_fmt "" None decl_list in (* the implementation *) let ocaml_code = - Compiler.compile_implementation_back_end_buf !Misc.err_fmt module_name + Compiler.compile_implementation_back_end_buf !Rml_misc.err_fmt module_name intermediate_code in None, ocaml_code with x -> - let () = Errors.report_error !Misc.err_fmt x in + let () = Errors.report_error !Rml_misc.err_fmt x in Some "", [ phrase ] (* the main function *) @@ -71,7 +71,7 @@ let compile () = let module_name = module_name () in let ic = stdin in let itf = open_out_bin "/dev/null" in - let info_fmt = !Misc.err_fmt in + let info_fmt = !Rml_misc.err_fmt in let out_chan = stdout in (* Initialization *) diff --git a/compiler/main/main.ml b/compiler/main/main.ml index 0a48b79a..55057112 100644 --- a/compiler/main/main.ml +++ b/compiler/main/main.ml @@ -28,7 +28,7 @@ (* $Id$ *) -open Misc +open Rml_misc open Modules open Compiler diff --git a/compiler/main/options.ml b/compiler/main/options.ml index f6aeb3c0..dd0de71e 100644 --- a/compiler/main/options.ml +++ b/compiler/main/options.ml @@ -21,7 +21,7 @@ (* created: 2006-08-07 *) (* author: Louis Mandel *) -open Misc +open Rml_misc open Configure let _ = diff --git a/compiler/optimization/reac_optimization.ml b/compiler/optimization/reac_optimization.ml index bd69cf15..8aef3511 100644 --- a/compiler/optimization/reac_optimization.ml +++ b/compiler/optimization/reac_optimization.ml @@ -19,7 +19,7 @@ (* file: reac_optimization.ml *) -open Asttypes +open Rml_asttypes open Reac_ast open Def_types open Reac_misc diff --git a/compiler/other_analysis/instantaneous_loop.ml b/compiler/other_analysis/instantaneous_loop.ml index f7d5c161..514f8729 100644 --- a/compiler/other_analysis/instantaneous_loop.ml +++ b/compiler/other_analysis/instantaneous_loop.ml @@ -27,8 +27,8 @@ (* an instantaneous recursion. *) (* This analysis must be used after the static analysis. *) -open Misc -open Asttypes +open Rml_misc +open Rml_asttypes open Reac_ast open Reac_misc open Def_static @@ -595,8 +595,8 @@ let instantaneous_loop_expr = List.fold_left (fun acc (conf, when_opt, expr_opt) -> let ty_config = config_analyse vars conf in - let _ = Misc.opt_map (analyse Env.empty) when_opt in - let _ = Misc.opt_map (analyse Env.empty) expr_opt in + let _ = Rml_misc.opt_map (analyse Env.empty) when_opt in + let _ = Rml_misc.opt_map (analyse Env.empty) expr_opt in Env.append ty_config acc) ty conf_when_opt_expr_opt_list @@ -636,7 +636,7 @@ let instantaneous_loop_expr = Env.append ty ty1 | Rexpr_await_val (immediate, kind, e, when_opt, e1) -> let ty = config_analyse vars e in - let _ = Misc.opt_map (analyse Env.empty) when_opt in + let _ = Rml_misc.opt_map (analyse Env.empty) when_opt in let _ = analyse Env.empty e1 in ty end diff --git a/compiler/other_analysis/wf_rec.ml b/compiler/other_analysis/wf_rec.ml index 32a7b817..36824ed5 100644 --- a/compiler/other_analysis/wf_rec.ml +++ b/compiler/other_analysis/wf_rec.ml @@ -23,17 +23,17 @@ (* $Id$ *) -open Asttypes +open Rml_asttypes open Reac_ast open Reac_misc (* Checks that expression as right-hand side of `let rec' are well formed *) let error e = - Format.fprintf !Misc.err_fmt + Format.fprintf !Rml_misc.err_fmt "%aThis kind of expression is not allowed as right-hand side of `let rec'.\n" Location.print e.expr_loc; - raise Misc.Error + raise Rml_misc.Error let rec empty_intersection l1 l2 = match l1 with diff --git a/compiler/parsing/lexer.mll b/compiler/parsing/lexer.mll index 55044d9a..a09e0e4b 100644 --- a/compiler/parsing/lexer.mll +++ b/compiler/parsing/lexer.mll @@ -44,8 +44,8 @@ { open Lexing -open Misc -open Parser +open Rml_misc +open Rml_parser type error = | Illegal_character of char diff --git a/compiler/parsing/parse.ml b/compiler/parsing/parse.ml index aa26c4e9..c0748f88 100644 --- a/compiler/parsing/parse.ml +++ b/compiler/parsing/parse.ml @@ -49,7 +49,7 @@ open Location let rec skip_phrase lexbuf = try match Lexer.token lexbuf with - Parser.SEMISEMI | Parser.EOF -> () + Rml_parser.SEMISEMI | Rml_parser.EOF -> () | _ -> skip_phrase lexbuf with | Lexer.Error (Lexer.Unterminated_comment, _) -> () @@ -59,8 +59,8 @@ let rec skip_phrase lexbuf = ;; let maybe_skip_phrase lexbuf = - if Parsing.is_current_lookahead Parser.SEMISEMI - || Parsing.is_current_lookahead Parser.EOF + if Parsing.is_current_lookahead Rml_parser.SEMISEMI + || Parsing.is_current_lookahead Rml_parser.EOF then () else skip_phrase lexbuf @@ -86,6 +86,6 @@ let wrap parsing_fun lexbuf = raise(Syntaxerr.Error(Syntaxerr.Other loc)) ;; -let implementation = wrap Parser.implementation -and interface = wrap Parser.interface -and interactive = wrap Parser.interactive +let implementation = wrap Rml_parser.implementation +and interface = wrap Rml_parser.interface +and interactive = wrap Rml_parser.interactive diff --git a/compiler/parsing/parse_ast.ml b/compiler/parsing/parse_ast.ml index 4e5ed5f3..e7c68b5c 100644 --- a/compiler/parsing/parse_ast.ml +++ b/compiler/parsing/parse_ast.ml @@ -30,7 +30,7 @@ (* The abstract syntax for the parsed language *) -open Asttypes +open Rml_asttypes type ident = { pident_id: Parse_ident.t; diff --git a/compiler/parsing/parse_printer.ml b/compiler/parsing/parse_printer.ml index ee9145e3..1ed70f14 100644 --- a/compiler/parsing/parse_printer.ml +++ b/compiler/parsing/parse_printer.ml @@ -32,7 +32,7 @@ open Format open Lexing open Parse_ast -open Asttypes +open Rml_asttypes open Location let fmt_position f l = diff --git a/compiler/parsing/parser.mly b/compiler/parsing/rml_parser.mly similarity index 99% rename from compiler/parsing/parser.mly rename to compiler/parsing/rml_parser.mly index 79e33ba8..c639a59c 100644 --- a/compiler/parsing/parser.mly +++ b/compiler/parsing/rml_parser.mly @@ -44,7 +44,7 @@ %{ open Location -open Asttypes +open Rml_asttypes open Parse_ident open Parse_ast diff --git a/compiler/reac/annot.ml b/compiler/reac/annot.ml index 5e63e10c..4be560dc 100644 --- a/compiler/reac/annot.ml +++ b/compiler/reac/annot.ml @@ -74,12 +74,12 @@ end) = let phrases = ref ([] : Location.t list) let record ti = - if !Misc.save_types && not (get_location ti).Location.loc_ghost then + if !Rml_misc.save_types && not (get_location ti).Location.loc_ghost then type_info := ti :: !type_info let record_phrase loc = - if !Misc.save_types then phrases := loc :: !phrases + if !Rml_misc.save_types then phrases := loc :: !phrases (* comparison order: @@ -152,7 +152,7 @@ let rec printtyp_reset_maybe loc = let dump filename = - if !Misc.save_types then begin + if !Rml_misc.save_types then begin let info = get_info () in let oc = open_out filename in let pp = Format.formatter_of_out_channel oc in diff --git a/compiler/reac/binding_errors.ml b/compiler/reac/binding_errors.ml index dbdda564..950adcfe 100644 --- a/compiler/reac/binding_errors.ml +++ b/compiler/reac/binding_errors.ml @@ -23,7 +23,7 @@ (* $Id$ *) -open Misc +open Rml_misc open Parse_ast open Parse_ident diff --git a/compiler/reac/parse2reac.ml b/compiler/reac/parse2reac.ml index c0a27ceb..51e8cfd1 100644 --- a/compiler/reac/parse2reac.ml +++ b/compiler/reac/parse2reac.ml @@ -25,8 +25,8 @@ (* The translation of Parse to Reac *) -open Misc -open Asttypes +open Rml_misc +open Rml_asttypes open Global open Parse_ast open Binding_errors diff --git a/compiler/reac/reac2reac.ml b/compiler/reac/reac2reac.ml index fea0e91b..b2bf4306 100644 --- a/compiler/reac/reac2reac.ml +++ b/compiler/reac/reac2reac.ml @@ -25,7 +25,7 @@ (* Source to source transformations *) -open Asttypes +open Rml_asttypes open Reac_ast open Def_types open Reac_misc @@ -72,7 +72,7 @@ let expr_map = | Rexpr_function patt_expr_list -> let patt_expr_list' = List.map (fun (p, when_opt, e) -> - (p, Misc.opt_map (expr_map f) when_opt , expr_map f e)) + (p, Rml_misc.opt_map (expr_map f) when_opt , expr_map f e)) patt_expr_list in f (make_expr_all @@ -151,7 +151,7 @@ let expr_map = let e' = expr_map f e in let patt_expr_list' = List.map (fun (p, when_opt, e) -> - (p, Misc.opt_map (expr_map f) when_opt , expr_map f e)) + (p, Rml_misc.opt_map (expr_map f) when_opt , expr_map f e)) patt_expr_list in f (make_expr_all @@ -176,7 +176,7 @@ let expr_map = let e' = expr_map f e in let patt_expr_list' = List.map (fun (p, when_opt, e) -> - (p, Misc.opt_map (expr_map f) when_opt , expr_map f e)) + (p, Rml_misc.opt_map (expr_map f) when_opt , expr_map f e)) patt_expr_list in f (make_expr_all @@ -243,7 +243,7 @@ let expr_map = typ static reactivity reactivity_effect loc) | Rexpr_loop (n_opt, e) -> - let n_opt' = Misc.opt_map (expr_map f) n_opt in + let n_opt' = Rml_misc.opt_map (expr_map f) n_opt in let e' = expr_map f e in f (make_expr_all (Rexpr_loop (n_opt', e')) typ static reactivity reactivity_effect loc) @@ -289,8 +289,8 @@ let expr_map = List.map (fun (config, when_opt, e_opt) -> let config' = config_map f config in - let when_opt' = Misc.opt_map (expr_map f) when_opt in - let e_opt' = Misc.opt_map (expr_map f) e_opt in + let when_opt' = Rml_misc.opt_map (expr_map f) when_opt in + let e_opt' = Rml_misc.opt_map (expr_map f) e_opt in (config', when_opt', e_opt')) config_when_opt_e_opt_list in @@ -339,7 +339,7 @@ let expr_map = | Rexpr_await_val (immediate, kind, config, when_opt, e1) -> let config' = config_map f config in - let when_opt' = Misc.opt_map (expr_map f) when_opt in + let when_opt' = Rml_misc.opt_map (expr_map f) when_opt in let e1' = expr_map f e1 in f (make_expr_all (Rexpr_await_val (immediate, kind, config', when_opt', e1')) @@ -383,7 +383,7 @@ let impl_map f impl = (* Print static information *) let print_static e = - Format.fprintf !Misc.err_fmt + Format.fprintf !Rml_misc.err_fmt "%a%s@." Location.print e.expr_loc (Def_static.string_of_static (snd e.expr_static)); @@ -393,10 +393,10 @@ let print_static e = (* Check left branche of |> operator and annotate pause statement *) let translate_merge = let merge_error exp = - Format.fprintf !Misc.err_fmt + Format.fprintf !Rml_misc.err_fmt "%aThis expression is not allowed on the left of a |> operator.\n" Location.print exp.expr_loc; - raise Misc.Error + raise Rml_misc.Error in let annotate_pause expr = diff --git a/compiler/reac/reac_ast.ml b/compiler/reac/reac_ast.ml index 71be214b..1007b017 100644 --- a/compiler/reac/reac_ast.ml +++ b/compiler/reac/reac_ast.ml @@ -30,7 +30,7 @@ (* The abstract syntax for the reac language *) -open Asttypes +open Rml_asttypes open Def_types type ident = Ident.t diff --git a/compiler/reac/reac_misc.ml b/compiler/reac/reac_misc.ml index c3a812d0..f8d6759b 100644 --- a/compiler/reac/reac_misc.ml +++ b/compiler/reac/reac_misc.ml @@ -25,7 +25,7 @@ (* Functions on Reac AST *) -open Asttypes +open Rml_asttypes open Reac_ast open Def_types open Types @@ -175,7 +175,7 @@ let expr_free_vars e = List.iter (fun (p,when_opt,e) -> let vars' = (vars_of_patt p) @ vars in - Misc.opt_iter (expr_free_vars vars') when_opt; + Rml_misc.opt_iter (expr_free_vars vars') when_opt; expr_free_vars vars' e) patt_expr_list @@ -216,7 +216,7 @@ let expr_free_vars e = List.iter (fun (p,when_opt,e) -> let vars' = (vars_of_patt p) @ vars in - Misc.opt_iter (expr_free_vars vars') when_opt; + Rml_misc.opt_iter (expr_free_vars vars') when_opt; expr_free_vars vars' e) patt_expr_list @@ -233,7 +233,7 @@ let expr_free_vars e = List.iter (fun (p,when_opt,e) -> let vars' = (vars_of_patt p) @ vars in - Misc.opt_iter (expr_free_vars vars') when_opt; + Rml_misc.opt_iter (expr_free_vars vars') when_opt; expr_free_vars vars' e) patt_expr_list @@ -276,7 +276,7 @@ let expr_free_vars e = expr_free_vars vars e2 | Rexpr_loop (n_opt, e) -> - Misc.opt_iter (expr_free_vars vars) n_opt; + Rml_misc.opt_iter (expr_free_vars vars) n_opt; expr_free_vars vars e | Rexpr_fordopar (ident, e1, e2, direction_flag, e) -> @@ -310,8 +310,8 @@ let expr_free_vars e = (fun (config, when_opt, e_opt) -> config_free_vars vars config; let vars' = (vars_of_config config) @ vars in - Misc.opt_iter (expr_free_vars vars') when_opt; - Misc.opt_iter (expr_free_vars vars') e_opt) + Rml_misc.opt_iter (expr_free_vars vars') when_opt; + Rml_misc.opt_iter (expr_free_vars vars') e_opt) config_when_opt_e_opt_list | Rexpr_when (config, e) -> @@ -343,7 +343,7 @@ let expr_free_vars e = | Rexpr_await_val (immediate, kind, config, when_opt, e1) -> config_free_vars vars config; let vars' = (vars_of_config config) @ vars in - Misc.opt_iter (expr_free_vars vars') when_opt; + Rml_misc.opt_iter (expr_free_vars vars') when_opt; expr_free_vars vars' e1 end diff --git a/compiler/static/static.ml b/compiler/static/static.ml index 4e04ab0a..d3cf49c2 100644 --- a/compiler/static/static.ml +++ b/compiler/static/static.ml @@ -25,7 +25,7 @@ (* Set the Static/Dynamique status in parse_ast *) -open Asttypes +open Rml_asttypes open Reac_ast open Def_static open Static_errors @@ -99,14 +99,14 @@ let static_patt_when_opt_expr_list static_expr combine ctx l = match l with | [] -> Static | [(_, when_opt, e)] -> - let _ = Misc.opt_map (static_expr ML) when_opt in + let _ = Rml_misc.opt_map (static_expr ML) when_opt in static_expr ctx e | (_, when_opt, e)::l -> - let _ = Misc.opt_map (static_expr ML) when_opt in + let _ = Rml_misc.opt_map (static_expr ML) when_opt in let ty = static_expr ctx e in List.fold_left (fun typ (_, when_opt, e) -> - let _ = Misc.opt_map (static_expr ML) when_opt in + let _ = Rml_misc.opt_map (static_expr ML) when_opt in combine (* max *) typ (static_expr ctx e)) ty l @@ -123,7 +123,7 @@ let rec static_expr ctx e = | Rexpr_let (Recursive, patt_expr_list, e1) -> if static_expr_list static_expr max snd ML patt_expr_list = Static then static_expr ctx e1 - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_let (Nonrecursive, patt_expr_list, e1) -> let typ1 = static_expr_list static_expr max snd ctx patt_expr_list in let typ2 = static_expr ctx e1 in @@ -133,59 +133,59 @@ let rec static_expr ctx e = if static_patt_when_opt_expr_list static_expr max ML patt_when_opt_expr_list = Static then Static - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_apply (e1, expr_list) -> let typ1 = static_expr ML e1 in let typ2 = static_expr_list static_expr max id ML expr_list in if max typ1 typ2 = Static then Static - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_tuple expr_list -> if static_expr_list static_expr max id ML expr_list = Static then Static - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_construct (_, None) -> Static | Rexpr_construct (_, Some e1) -> if static_expr ML e1 = Static then Static - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_array expr_list -> if static_expr_list static_expr max id ML expr_list = Static then Static - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_record ide_expr_list -> if static_expr_list static_expr max snd ML ide_expr_list = Static then Static - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_record_access (e1, _) -> if static_expr ML e1 = Static then Static - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_record_with (e1, ide_expr_list) -> let typ1 = static_expr ML e1 in let typ2 = static_expr_list static_expr max snd ML ide_expr_list in if max typ1 typ2 = Static then Static - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_record_update (e1, _, e2) -> let typ1 = static_expr ML e1 in let typ2 = static_expr ML e2 in if max typ1 typ2 = Static then Static - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_constraint (e1, _) -> if static_expr ML e1 = Static then Static - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_trywith (e1, patt_when_opt_expr_list) -> let typ1 = static_expr ML e1 in @@ -195,12 +195,12 @@ let rec static_expr ctx e = in if max typ1 typ2 = Static then Static - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_assert e1 -> if static_expr ML e1 = Static then Static - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_ifthenelse (e1, e2, e3) -> if static_expr ML e1 = Static @@ -219,11 +219,11 @@ let rec static_expr ctx e = Dynamic Noninstantaneous | Dynamic _, Dynamic _ -> Dynamic Dontknow end - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_match (e1, patt_when_opt_expr_list) -> let typ1 = static_expr ML e1 in - if typ1 <> Static then expr_wrong_static_err !Misc.err_fmt e1; + if typ1 <> Static then expr_wrong_static_err !Rml_misc.err_fmt e1; let typ2 = let combine typ1 typ2 = begin match typ1, typ2 with @@ -272,7 +272,7 @@ let rec static_expr ctx e = end | ty -> ty end - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_fordopar (_, e1, e2, dir, e3) -> if ctx = Process @@ -300,8 +300,8 @@ let rec static_expr ctx e = end | ty -> ty end - else expr_wrong_static_err !Misc.err_fmt e - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_seq e_list -> static_expr_list static_expr max id ctx e_list @@ -309,30 +309,30 @@ let rec static_expr ctx e = | Rexpr_nothing -> if ctx = Process then Dynamic Instantaneous - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_pause _ -> if ctx = Process then Dynamic Noninstantaneous - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_halt _ -> if ctx = Process then Dynamic Noninstantaneous - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_emit (s, None) -> if static_expr ML s = Static then Static - else expr_wrong_static_err !Misc.err_fmt s + else expr_wrong_static_err !Rml_misc.err_fmt s | Rexpr_emit (s, Some e1) -> if static_expr ML s = Static then if static_expr ML e1 = Static then Static - else expr_wrong_static_err !Misc.err_fmt e1 - else expr_wrong_static_err !Misc.err_fmt s + else expr_wrong_static_err !Rml_misc.err_fmt e1 + else expr_wrong_static_err !Rml_misc.err_fmt s | Rexpr_loop (None, e1) -> if ctx = Process @@ -346,7 +346,7 @@ let rec static_expr ctx e = let _ty = static_expr Process e1 in Dynamic Noninstantaneous else - expr_wrong_static_err !Misc.err_fmt e + expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_loop (Some n, e1) -> if static_expr ML n = Static @@ -358,8 +358,8 @@ let rec static_expr ctx e = | ty -> ty end else - expr_wrong_static_err !Misc.err_fmt e - else expr_wrong_static_err !Misc.err_fmt n + expr_wrong_static_err !Rml_misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt n | Rexpr_par e_list -> if ctx = Process @@ -370,7 +370,7 @@ let rec static_expr ctx e = | _ -> ty end else - expr_wrong_static_err !Misc.err_fmt e + expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_merge (e1,e2) -> if ctx = Process @@ -382,7 +382,7 @@ let rec static_expr ctx e = | ty -> ty end else - expr_wrong_static_err !Misc.err_fmt e + expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_signal (_, None, p) -> static_expr ctx p @@ -393,7 +393,7 @@ let rec static_expr ctx e = let typ3 = static_expr ctx p in if max typ1 typ2 = Static then typ3 - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_process (p) -> let _typ = static_expr Process p in @@ -402,7 +402,7 @@ let rec static_expr ctx e = | Rexpr_run (e1) -> if static_expr ML e1 = Static then Dynamic Dontknow - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_until (p, conf_when_opt_expr_opt_list) -> if ctx = Process @@ -411,10 +411,10 @@ let rec static_expr ctx e = List.iter (fun (conf, when_opt, expr_opt) -> static_conf conf; - Misc.opt_iter + Rml_misc.opt_iter (fun e -> ignore (static_expr ML e)) when_opt; - Misc.opt_iter + Rml_misc.opt_iter (fun e -> ignore (static_expr Process e)) expr_opt) conf_when_opt_expr_opt_list; @@ -423,7 +423,7 @@ let rec static_expr ctx e = | _ -> typ1 end else - expr_wrong_static_err !Misc.err_fmt e + expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_when (s, p) -> if ctx = Process @@ -432,24 +432,24 @@ let rec static_expr ctx e = let typ1 = static_expr Process p in max (Dynamic Dontknow) typ1) else - expr_wrong_static_err !Misc.err_fmt e + expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_control (s, e_opt, p) -> if ctx = Process then (static_conf s; let typ1 = static_expr Process p in - Misc.opt_iter + Rml_misc.opt_iter (fun e -> if static_expr ML e <> Static - then expr_wrong_static_err !Misc.err_fmt e) + then expr_wrong_static_err !Rml_misc.err_fmt e) e_opt; begin match typ1 with | Static -> Dynamic Instantaneous | _ -> typ1 end) else - expr_wrong_static_err !Misc.err_fmt e + expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_present (s, p1, p2) -> if ctx = Process @@ -459,54 +459,54 @@ let rec static_expr ctx e = let _typ2 = static_expr ctx p2 in max (Dynamic Dontknow) typ1) else - expr_wrong_static_err !Misc.err_fmt e + expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_await (Immediate, s) -> if ctx = Process then (static_conf s; Dynamic Dontknow) - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_await (Nonimmediate, s) -> if ctx = Process then (static_conf s; Dynamic Noninstantaneous) - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_await_val (Immediate, One, s, when_opt, p) -> if ctx = Process then (static_conf s; - let _ = Misc.opt_map (static_expr ML) when_opt in + let _ = Rml_misc.opt_map (static_expr ML) when_opt in let typ = static_expr Process p in max (Dynamic Dontknow) typ) else - expr_wrong_static_err !Misc.err_fmt e + expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_await_val (_, _, s, when_opt, p) -> if ctx = Process then (static_conf s; - let _ = Misc.opt_map (static_expr ML) when_opt in + let _ = Rml_misc.opt_map (static_expr ML) when_opt in let _typ1 = static_expr Process p in Dynamic Noninstantaneous) else - expr_wrong_static_err !Misc.err_fmt e + expr_wrong_static_err !Rml_misc.err_fmt e | Rexpr_pre (_, s) -> if static_expr ML s = Static then Static - else expr_wrong_static_err !Misc.err_fmt s + else expr_wrong_static_err !Rml_misc.err_fmt s | Rexpr_last s -> if static_expr ML s = Static then Static - else expr_wrong_static_err !Misc.err_fmt s + else expr_wrong_static_err !Rml_misc.err_fmt s | Rexpr_default s -> if static_expr ML s = Static then Static - else expr_wrong_static_err !Misc.err_fmt s + else expr_wrong_static_err !Rml_misc.err_fmt s | Rexpr_get (s, _, p) -> if ctx = Process @@ -515,9 +515,9 @@ let rec static_expr ctx e = then let _typ = static_expr ctx p in Dynamic Noninstantaneous - else expr_wrong_static_err !Misc.err_fmt s + else expr_wrong_static_err !Rml_misc.err_fmt s else - expr_wrong_static_err !Misc.err_fmt p + expr_wrong_static_err !Rml_misc.err_fmt p in e.expr_static <- (ctx, t); t @@ -528,7 +528,7 @@ and static_conf conf = | Rconf_present (e, _) -> if static_expr ML e = Static then () - else expr_wrong_static_err !Misc.err_fmt e + else expr_wrong_static_err !Rml_misc.err_fmt e | Rconf_and (c1, c2) -> static_conf c1; @@ -552,10 +552,10 @@ let static impl = match combine with | Some(k,e1,e2) -> if (static_expr ML e1) <> Static - then expr_wrong_static_err !Misc.err_fmt e1 + then expr_wrong_static_err !Rml_misc.err_fmt e1 else if (static_expr ML e2) <> Static - then expr_wrong_static_err !Misc.err_fmt e2 + then expr_wrong_static_err !Rml_misc.err_fmt e2 else () | None -> ()) s_list diff --git a/compiler/static/static_errors.ml b/compiler/static/static_errors.ml index b4b6da6a..3266c284 100644 --- a/compiler/static/static_errors.ml +++ b/compiler/static/static_errors.ml @@ -23,7 +23,7 @@ (* $Id$ *) -open Misc +open Rml_misc open Reac_ast (* Printing of error messages during the "static" analysis *) diff --git a/compiler/static/static_printer.ml b/compiler/static/static_printer.ml index 03d9201b..3db5f91f 100644 --- a/compiler/static/static_printer.ml +++ b/compiler/static/static_printer.ml @@ -23,7 +23,7 @@ (* $Id$ *) -open Asttypes +open Rml_asttypes open Reac_ast open Def_static diff --git a/compiler/typing/def_types.ml b/compiler/typing/def_types.ml index fffb5717..afe2f3ed 100644 --- a/compiler/typing/def_types.ml +++ b/compiler/typing/def_types.ml @@ -30,7 +30,7 @@ (* The abstract syntax for the types *) -open Asttypes +open Rml_asttypes open Global (* types *) diff --git a/compiler/typing/reactivity_check.ml b/compiler/typing/reactivity_check.ml index af2dd723..5a1fd1f2 100644 --- a/compiler/typing/reactivity_check.ml +++ b/compiler/typing/reactivity_check.ml @@ -19,14 +19,14 @@ (* file: reactivity_effects.ml *) -open Misc -open Asttypes +open Rml_misc +open Rml_asttypes open Reac_ast open Def_types (* Warnings *) let rec_warning expr k = - if !Misc.reactivity_warning then ( + if !Rml_misc.reactivity_warning then ( Format.fprintf !err_fmt "%aWarning: This expression may produce an instantaneous recursion.@." Location.print expr.expr_loc @@ -34,7 +34,7 @@ let rec_warning expr k = (* (Types_printer.print_to_string Types_printer.print_reactivity k) *) let loop_warning expr k = - if !Misc.reactivity_warning then ( + if !Rml_misc.reactivity_warning then ( Format.fprintf !err_fmt "%aWarning: This expression may be an instantaneous loop.@." Location.print expr.expr_loc diff --git a/compiler/typing/reactivity_effects.ml b/compiler/typing/reactivity_effects.ml index 435841e9..dcbd9fc2 100644 --- a/compiler/typing/reactivity_effects.ml +++ b/compiler/typing/reactivity_effects.ml @@ -19,8 +19,8 @@ (* file: reactivity_effects.ml *) -open Misc -open Asttypes +open Rml_misc +open Rml_asttypes open Reac_ast open Def_types @@ -400,7 +400,7 @@ let react_simplify = in fun k -> visited_list := []; - if !Misc.reactivity_simplify then simplify (react_effect_repr k) + if !Rml_misc.reactivity_simplify then simplify (react_effect_repr k) else react_effect_repr k let react_equal = diff --git a/compiler/typing/types.ml b/compiler/typing/types.ml index 5f4bc464..5dd39e38 100644 --- a/compiler/typing/types.ml +++ b/compiler/typing/types.ml @@ -30,7 +30,7 @@ (* Basic operations over types *) -open Misc +open Rml_misc open Def_types open Reactivity_effects open Global diff --git a/compiler/typing/types_printer.ml b/compiler/typing/types_printer.ml index 5af24e96..4f87cfd3 100644 --- a/compiler/typing/types_printer.ml +++ b/compiler/typing/types_printer.ml @@ -32,8 +32,8 @@ open Format open Def_types -open Asttypes -open Misc +open Rml_asttypes +open Rml_misc open Ident open Modules open Global_ident @@ -187,7 +187,7 @@ and print_proc_info ff pi = (* | Some(Def_static.Instantaneous) -> pp_print_string ff "-" *) (* | Some(Def_static.Noninstantaneous) -> pp_print_string ff "+" *) (* end *) - if !Misc.dreactivity then + if !Rml_misc.dreactivity then fprintf ff "[%a]" print_reactivity pi.proc_react and print_list ff priority sep l = diff --git a/compiler/typing/typing.ml b/compiler/typing/typing.ml index 18b83821..401f5af0 100644 --- a/compiler/typing/typing.ml +++ b/compiler/typing/typing.ml @@ -35,11 +35,11 @@ open Types open Reactivity_effects open Typing_errors open Initialization -open Asttypes +open Rml_asttypes open Global open Global_ident open Reac_ast -open Misc +open Rml_misc open Annot let unify_expr expr expected_ty actual_ty = diff --git a/compiler/typing/typing_errors.ml b/compiler/typing/typing_errors.ml index aa31bbc3..e6cb896c 100644 --- a/compiler/typing/typing_errors.ml +++ b/compiler/typing/typing_errors.ml @@ -30,7 +30,7 @@ (* Printing of error messages during typing *) -open Misc +open Rml_misc open Def_types open Types open Reac_ast diff --git a/tools/rmldep/Makefile b/tools/rmldep/Makefile index 8a82667a..25b8f397 100644 --- a/tools/rmldep/Makefile +++ b/tools/rmldep/Makefile @@ -7,7 +7,7 @@ DIRECTORIES = ../../compiler/global ../../compiler/parsing INCLUDES=-I ../../compiler/global -I ../../compiler/parsing OBJ = ../../compiler/global/version.cmo \ - ../../compiler/global/misc.cmo \ + ../../compiler/global/rml_misc.cmo \ ../../compiler/global/warnings.cmo \ ../../compiler/global/ident.cmo \ ../../compiler/parsing/linenum.cmo \ @@ -16,7 +16,7 @@ OBJ = ../../compiler/global/version.cmo \ ../../compiler/parsing/location.cmo \ ../../compiler/parsing/syntaxerr.cmo \ ../../compiler/parsing/lexer.cmo \ - ../../compiler/parsing/parser.cmo \ + ../../compiler/parsing/rml_parser.cmo \ ../../compiler/parsing/parse.cmo \ depend.cmo \ rmldep.cmo diff --git a/tools/rmldep/depend.ml b/tools/rmldep/depend.ml index 6fa2e93c..20ba4632 100644 --- a/tools/rmldep/depend.ml +++ b/tools/rmldep/depend.ml @@ -139,7 +139,7 @@ let rec add_expr bv exp = | Pexpr_merge(e1, e2) -> add_expr bv e1; add_expr bv e2 | Pexpr_signal(ioel, koee, e) -> List.iter (fun (i, oe) -> add_opt add_type bv oe) ioel; - Misc.opt_iter (fun (_, e1, e2) -> add_expr bv e1; add_expr bv e2) koee; + Rml_misc.opt_iter (fun (_, e1, e2) -> add_expr bv e1; add_expr bv e2) koee; add_expr bv e | Pexpr_process(e1) -> add_expr bv e1 | Pexpr_run(e1) -> add_expr bv e1 @@ -148,13 +148,13 @@ let rec add_expr bv exp = List.iter (fun (cfg, when_opt, oe) -> add_config bv cfg; - Misc.opt_iter (add_expr bv) when_opt; - Misc.opt_iter (fun e -> add_expr bv e) oe) + Rml_misc.opt_iter (add_expr bv) when_opt; + Rml_misc.opt_iter (fun e -> add_expr bv e) oe) cfg_when_opt_oe_list | Pexpr_when(cfg, e1) -> add_config bv cfg; add_expr bv e1 | Pexpr_control(cfg, oe, e1) -> add_config bv cfg; - Misc.opt_iter (fun e -> add_expr bv e) oe; + Rml_misc.opt_iter (fun e -> add_expr bv e) oe; add_expr bv e1 | Pexpr_get(e1) -> add_expr bv e1 | Pexpr_present(cfg, e1, e2) -> @@ -163,7 +163,7 @@ let rec add_expr bv exp = | Pexpr_await_val(_, _, cfg, when_opt, e1) -> add_config bv cfg; add_config bv cfg; - Misc.opt_iter (add_expr bv) when_opt; + Rml_misc.opt_iter (add_expr bv) when_opt; add_expr bv e1 | Pexpr_pre(_, e1) -> add_expr bv e1 | Pexpr_last(e1) -> add_expr bv e1 @@ -172,7 +172,7 @@ let rec add_expr bv exp = and add_config bv conf = match conf.pconf_desc with | Pconf_present(e1, op) -> - add_expr bv e1; Misc.opt_iter (fun p -> add_pattern bv p) op + add_expr bv e1; Rml_misc.opt_iter (fun p -> add_pattern bv p) op | Pconf_and(e1, e2) -> add_config bv e1; add_config bv e2 | Pconf_or(e1, e2) -> add_config bv e1; add_config bv e2 @@ -183,7 +183,7 @@ and add_pat_when_opt_expr_list bv pel = List.iter (fun (p, when_opt, e) -> add_pattern bv p; - Misc.opt_iter (add_expr bv) when_opt; + Rml_misc.opt_iter (add_expr bv) when_opt; add_expr bv e) pel @@ -215,7 +215,7 @@ and add_struct_item bv item = add_pat_expr_list bv pel; bv | Pimpl_signal(ioel, koee) -> List.iter (fun (i, oe) -> add_opt add_type bv oe) ioel; - Misc.opt_iter (fun (_,e1, e2) -> add_expr bv e1; add_expr bv e2) koee; + Rml_misc.opt_iter (fun (_,e1, e2) -> add_expr bv e1; add_expr bv e2) koee; bv | Pimpl_type dcls -> List.iter (fun (_, _, td) -> add_type_declaration bv td) dcls; bv diff --git a/tools/rmldep/rmldep.ml b/tools/rmldep/rmldep.ml index 6ea2ee85..9dfdfc7a 100644 --- a/tools/rmldep/rmldep.ml +++ b/tools/rmldep/rmldep.ml @@ -69,7 +69,7 @@ let fix_slash s = let add_to_load_path dir = try - let dir = Misc.expand_directory Version.stdlib dir in + let dir = Rml_misc.expand_directory Version.stdlib dir in let contents = Sys.readdir dir in load_path := !load_path @ [dir, contents] with Sys_error msg -> @@ -193,7 +193,7 @@ let preprocess sourcefile = let tmpfile = Filename.temp_file "camlpp" "" in let comm = Printf.sprintf "%s %s > %s" pp sourcefile tmpfile in if Sys.command comm <> 0 then begin - Misc.remove_file tmpfile; + Rml_misc.remove_file tmpfile; raise Preprocessing_error end; tmpfile @@ -201,7 +201,7 @@ let preprocess sourcefile = let remove_preprocessed inputfile = match !preprocessor with None -> () - | Some _ -> Misc.remove_file inputfile + | Some _ -> Rml_misc.remove_file inputfile (* Parse a file or get a dumped syntax tree in it *) From cfa96ee0296c17917d5cea9fd1f71d5883dc5f1e Mon Sep 17 00:00:00 2001 From: Samuel VIVIEN Date: Tue, 4 Jan 2022 12:17:22 +0100 Subject: [PATCH 02/13] Finished changing names of modules --- .gitignore | 2 +- compiler/.depend | 284 +++++++++--------- compiler/Makefile | 32 +- compiler/caml/caml2caml.ml | 2 +- compiler/caml/caml_ast.ml | 4 +- compiler/caml/caml_misc.ml | 24 +- compiler/caml/lk2caml.ml | 4 +- compiler/caml/print_caml_src.ml | 20 +- compiler/global/global_ident.ml | 8 +- compiler/global/initialization.ml | 52 ++-- compiler/global/modules.ml | 4 +- compiler/global/{ident.ml => rml_ident.ml} | 0 compiler/lco/lco_ast.ml | 2 +- compiler/lco/reac2lco.ml | 8 +- compiler/lk/lk_ast.ml | 2 +- compiler/lk/reac2lk.ml | 2 +- compiler/main/compiler.ml | 20 +- compiler/main/interactive.ml | 10 +- compiler/main/main.ml | 2 +- compiler/main/options.ml | 2 +- compiler/main/{errors.ml => rml_errors.ml} | 8 +- compiler/optimization/reac_optimization.ml | 8 +- compiler/optimization/remove_when.ml | 2 +- compiler/other_analysis/instantaneous_loop.ml | 2 +- compiler/parsing/{lexer.mll => rml_lexer.mll} | 0 compiler/parsing/{parse.ml => rml_parse.ml} | 26 +- compiler/parsing/rml_parser.mly | 16 +- .../{syntaxerr.ml => rml_syntaxerr.ml} | 0 compiler/reac/parse2reac.ml | 28 +- compiler/reac/reac_ast.ml | 2 +- compiler/reac/reac_misc.ml | 6 +- compiler/reac/{annot.ml => rml_annot.ml} | 0 compiler/typing/reactivity_effects.ml | 2 +- compiler/typing/{types.ml => rml_types.ml} | 2 +- compiler/typing/types_printer.ml | 6 +- compiler/typing/typing.ml | 34 +-- compiler/typing/typing_errors.ml | 6 +- tools/rmldep/Makefile | 8 +- tools/rmldep/rmldep.ml | 12 +- 39 files changed, 326 insertions(+), 326 deletions(-) rename compiler/global/{ident.ml => rml_ident.ml} (100%) rename compiler/main/{errors.ml => rml_errors.ml} (96%) rename compiler/parsing/{lexer.mll => rml_lexer.mll} (100%) rename compiler/parsing/{parse.ml => rml_parse.ml} (79%) rename compiler/parsing/{syntaxerr.ml => rml_syntaxerr.ml} (100%) rename compiler/reac/{annot.ml => rml_annot.ml} (100%) rename compiler/typing/{types.ml => rml_types.ml} (99%) diff --git a/.gitignore b/.gitignore index 060e634c..b7ac9e97 100644 --- a/.gitignore +++ b/.gitignore @@ -33,7 +33,7 @@ config Makefile.common compiler/global/version.ml compiler/global/rzi.ml -compiler/parsing/lexer.ml +compiler/parsing/rml_lexer.ml compiler/parsing/linenum.ml compiler/parsing/rml_parser.ml compiler/parsing/rml_parser.mli diff --git a/compiler/.depend b/compiler/.depend index 16dabc10..ee120aed 100644 --- a/compiler/.depend +++ b/compiler/.depend @@ -11,32 +11,30 @@ global/global.cmx : \ global/rml_misc.cmx \ global/global_ident.cmx global/global_ident.cmo : \ - global/ident.cmo + global/rml_ident.cmo global/global_ident.cmx : \ - global/ident.cmx -global/ident.cmo : -global/ident.cmx : + global/rml_ident.cmx global/initialization.cmo : \ - typing/types.cmo \ + typing/rml_types.cmo \ global/rml_misc.cmo \ + global/rml_ident.cmo \ global/modules.cmo \ - global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ typing/def_types.cmo global/initialization.cmx : \ - typing/types.cmx \ + typing/rml_types.cmx \ global/rml_misc.cmx \ + global/rml_ident.cmx \ global/modules.cmx \ - global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ typing/def_types.cmx global/modules.cmo : \ global/rzi.cmi \ global/rml_misc.cmo \ + global/rml_ident.cmo \ parsing/parse_ident.cmo \ - global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ typing/def_types.cmo \ @@ -44,14 +42,16 @@ global/modules.cmo : \ global/modules.cmx : \ global/rzi.cmx \ global/rml_misc.cmx \ + global/rml_ident.cmx \ parsing/parse_ident.cmx \ - global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ typing/def_types.cmx \ global/def_modules.cmx global/rml_asttypes.cmo : global/rml_asttypes.cmx : +global/rml_ident.cmo : +global/rml_ident.cmx : global/rml_misc.cmo : \ global/version.cmo \ parsing/location.cmo @@ -69,16 +69,6 @@ global/version.cmo : global/version.cmx : global/warnings.cmo : global/warnings.cmx : -parsing/lexer.cmo : \ - global/warnings.cmo \ - parsing/rml_parser.cmi \ - global/rml_misc.cmo \ - parsing/location.cmo -parsing/lexer.cmx : \ - global/warnings.cmx \ - parsing/rml_parser.cmx \ - global/rml_misc.cmx \ - parsing/location.cmx parsing/linenum.cmo : parsing/linenum.cmx : parsing/location.cmo : \ @@ -87,16 +77,6 @@ parsing/location.cmo : \ parsing/location.cmx : \ global/warnings.cmx \ parsing/linenum.cmx -parsing/parse.cmo : \ - parsing/syntaxerr.cmo \ - parsing/rml_parser.cmi \ - parsing/location.cmo \ - parsing/lexer.cmo -parsing/parse.cmx : \ - parsing/syntaxerr.cmx \ - parsing/rml_parser.cmx \ - parsing/location.cmx \ - parsing/lexer.cmx parsing/parse_ast.cmo : \ global/rml_asttypes.cmo \ parsing/parse_ident.cmo \ @@ -121,8 +101,28 @@ parsing/parse_printer.cmx : \ parsing/parse_ast.cmx \ parsing/location.cmx \ static/def_static.cmx +parsing/rml_lexer.cmo : \ + global/warnings.cmo \ + parsing/rml_parser.cmi \ + global/rml_misc.cmo \ + parsing/location.cmo +parsing/rml_lexer.cmx : \ + global/warnings.cmx \ + parsing/rml_parser.cmx \ + global/rml_misc.cmx \ + parsing/location.cmx +parsing/rml_parse.cmo : \ + parsing/rml_syntaxerr.cmo \ + parsing/rml_parser.cmi \ + parsing/rml_lexer.cmo \ + parsing/location.cmo +parsing/rml_parse.cmx : \ + parsing/rml_syntaxerr.cmx \ + parsing/rml_parser.cmx \ + parsing/rml_lexer.cmx \ + parsing/location.cmx parsing/rml_parser.cmo : \ - parsing/syntaxerr.cmo \ + parsing/rml_syntaxerr.cmo \ global/rml_asttypes.cmo \ parsing/parse_ident.cmo \ parsing/parse_ast.cmo \ @@ -130,7 +130,7 @@ parsing/rml_parser.cmo : \ static/def_static.cmo \ parsing/rml_parser.cmi parsing/rml_parser.cmx : \ - parsing/syntaxerr.cmx \ + parsing/rml_syntaxerr.cmx \ global/rml_asttypes.cmx \ parsing/parse_ident.cmx \ parsing/parse_ast.cmx \ @@ -139,9 +139,9 @@ parsing/rml_parser.cmx : \ parsing/rml_parser.cmi parsing/rml_parser.cmi : \ parsing/parse_ast.cmo -parsing/syntaxerr.cmo : \ +parsing/rml_syntaxerr.cmo : \ parsing/location.cmo -parsing/syntaxerr.cmx : \ +parsing/rml_syntaxerr.cmx : \ parsing/location.cmx external/external.cmo : \ parsing/parse_ast.cmo \ @@ -228,122 +228,122 @@ typing/reactivity_check.cmx : \ typing/reactivity_effects.cmo : \ typing/types_printer.cmo \ global/rml_misc.cmo \ + global/rml_ident.cmo \ global/rml_asttypes.cmo \ reac/reac_ast.cmo \ - global/ident.cmo \ typing/def_types.cmo typing/reactivity_effects.cmx : \ typing/types_printer.cmx \ global/rml_misc.cmx \ + global/rml_ident.cmx \ global/rml_asttypes.cmx \ reac/reac_ast.cmx \ - global/ident.cmx \ typing/def_types.cmx -typing/types.cmo : \ +typing/rml_types.cmo : \ global/rml_misc.cmo \ + global/rml_ident.cmo \ typing/reactivity_effects.cmo \ - global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ typing/def_types.cmo -typing/types.cmx : \ +typing/rml_types.cmx : \ global/rml_misc.cmx \ + global/rml_ident.cmx \ typing/reactivity_effects.cmx \ - global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ typing/def_types.cmx typing/types_printer.cmo : \ global/rml_misc.cmo \ + global/rml_ident.cmo \ global/rml_asttypes.cmo \ global/modules.cmo \ - global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ typing/def_types.cmo typing/types_printer.cmx : \ global/rml_misc.cmx \ + global/rml_ident.cmx \ global/rml_asttypes.cmx \ global/modules.cmx \ - global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ typing/def_types.cmx typing/typing.cmo : \ typing/typing_errors.cmo \ typing/types_printer.cmo \ - typing/types.cmo \ global/symbol_table.cmo \ + typing/rml_types.cmo \ global/rml_misc.cmo \ + global/rml_ident.cmo \ global/rml_asttypes.cmo \ + reac/rml_annot.cmo \ typing/reactivity_effects.cmo \ typing/reactivity_check.cmo \ reac/reac_misc.cmo \ reac/reac_ast.cmo \ parsing/location.cmo \ global/initialization.cmo \ - global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ typing/def_types.cmo \ - static/def_static.cmo \ - reac/annot.cmo + static/def_static.cmo typing/typing.cmx : \ typing/typing_errors.cmx \ typing/types_printer.cmx \ - typing/types.cmx \ global/symbol_table.cmx \ + typing/rml_types.cmx \ global/rml_misc.cmx \ + global/rml_ident.cmx \ global/rml_asttypes.cmx \ + reac/rml_annot.cmx \ typing/reactivity_effects.cmx \ typing/reactivity_check.cmx \ reac/reac_misc.cmx \ reac/reac_ast.cmx \ parsing/location.cmx \ global/initialization.cmx \ - global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ typing/def_types.cmx \ - static/def_static.cmx \ - reac/annot.cmx + static/def_static.cmx typing/typing_errors.cmo : \ typing/types_printer.cmo \ - typing/types.cmo \ + typing/rml_types.cmo \ global/rml_misc.cmo \ + global/rml_ident.cmo \ reac/reac_ast.cmo \ parsing/location.cmo \ - global/ident.cmo \ global/global_ident.cmo \ typing/def_types.cmo typing/typing_errors.cmx : \ typing/types_printer.cmx \ - typing/types.cmx \ + typing/rml_types.cmx \ global/rml_misc.cmx \ + global/rml_ident.cmx \ reac/reac_ast.cmx \ parsing/location.cmx \ - global/ident.cmx \ global/global_ident.cmx \ typing/def_types.cmx other_analysis/instantaneous_loop.cmo : \ static/static.cmo \ global/rml_misc.cmo \ + global/rml_ident.cmo \ global/rml_asttypes.cmo \ reac/reac_misc.cmo \ reac/reac_ast.cmo \ parsing/location.cmo \ - global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ static/def_static.cmo other_analysis/instantaneous_loop.cmx : \ static/static.cmx \ global/rml_misc.cmx \ + global/rml_ident.cmx \ global/rml_asttypes.cmx \ reac/reac_misc.cmx \ reac/reac_ast.cmx \ parsing/location.cmx \ - global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ static/def_static.cmx @@ -361,26 +361,6 @@ other_analysis/wf_rec.cmx : \ reac/reac_ast.cmx \ reac/reac2reac.cmx \ parsing/location.cmx -reac/annot.cmo : \ - typing/types_printer.cmo \ - static/static_printer.cmo \ - global/rml_misc.cmo \ - typing/reactivity_effects.cmo \ - reac/reac_ast.cmo \ - parsing/location.cmo \ - other_analysis/instantaneous_loop.cmo \ - typing/def_types.cmo \ - static/def_static.cmo -reac/annot.cmx : \ - typing/types_printer.cmx \ - static/static_printer.cmx \ - global/rml_misc.cmx \ - typing/reactivity_effects.cmx \ - reac/reac_ast.cmx \ - parsing/location.cmx \ - other_analysis/instantaneous_loop.cmx \ - typing/def_types.cmx \ - static/def_static.cmx reac/binding_errors.cmo : \ global/rml_misc.cmo \ parsing/parse_ident.cmo \ @@ -392,9 +372,10 @@ reac/binding_errors.cmx : \ parsing/parse_ast.cmx \ parsing/location.cmx reac/parse2reac.cmo : \ - typing/types.cmo \ global/symbol_table.cmo \ + typing/rml_types.cmo \ global/rml_misc.cmo \ + global/rml_ident.cmo \ global/rml_asttypes.cmo \ reac/reac_misc.cmo \ reac/reac_ast.cmo \ @@ -402,14 +383,14 @@ reac/parse2reac.cmo : \ parsing/parse_ast.cmo \ global/modules.cmo \ parsing/location.cmo \ - global/ident.cmo \ global/global.cmo \ typing/def_types.cmo \ reac/binding_errors.cmo reac/parse2reac.cmx : \ - typing/types.cmx \ global/symbol_table.cmx \ + typing/rml_types.cmx \ global/rml_misc.cmx \ + global/rml_ident.cmx \ global/rml_asttypes.cmx \ reac/reac_misc.cmx \ reac/reac_ast.cmx \ @@ -417,7 +398,6 @@ reac/parse2reac.cmx : \ parsing/parse_ast.cmx \ global/modules.cmx \ parsing/location.cmx \ - global/ident.cmx \ global/global.cmx \ typing/def_types.cmx \ reac/binding_errors.cmx @@ -438,51 +418,71 @@ reac/reac2reac.cmx : \ typing/def_types.cmx \ static/def_static.cmx reac/reac_ast.cmo : \ + global/rml_ident.cmo \ global/rml_asttypes.cmo \ parsing/location.cmo \ - global/ident.cmo \ global/global.cmo \ typing/def_types.cmo \ static/def_static.cmo reac/reac_ast.cmx : \ + global/rml_ident.cmx \ global/rml_asttypes.cmx \ parsing/location.cmx \ - global/ident.cmx \ global/global.cmx \ typing/def_types.cmx \ static/def_static.cmx reac/reac_misc.cmo : \ - typing/types.cmo \ + typing/rml_types.cmo \ global/rml_misc.cmo \ + global/rml_ident.cmo \ global/rml_asttypes.cmo \ typing/reactivity_effects.cmo \ reac/reac_ast.cmo \ - global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ typing/def_types.cmo \ static/def_static.cmo reac/reac_misc.cmx : \ - typing/types.cmx \ + typing/rml_types.cmx \ global/rml_misc.cmx \ + global/rml_ident.cmx \ global/rml_asttypes.cmx \ typing/reactivity_effects.cmx \ reac/reac_ast.cmx \ - global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ typing/def_types.cmx \ static/def_static.cmx +reac/rml_annot.cmo : \ + typing/types_printer.cmo \ + static/static_printer.cmo \ + global/rml_misc.cmo \ + typing/reactivity_effects.cmo \ + reac/reac_ast.cmo \ + parsing/location.cmo \ + other_analysis/instantaneous_loop.cmo \ + typing/def_types.cmo \ + static/def_static.cmo +reac/rml_annot.cmx : \ + typing/types_printer.cmx \ + static/static_printer.cmx \ + global/rml_misc.cmx \ + typing/reactivity_effects.cmx \ + reac/reac_ast.cmx \ + parsing/location.cmx \ + other_analysis/instantaneous_loop.cmx \ + typing/def_types.cmx \ + static/def_static.cmx lco/lco_ast.cmo : \ + global/rml_ident.cmo \ global/rml_asttypes.cmo \ parsing/location.cmo \ - global/ident.cmo \ global/global.cmo \ typing/def_types.cmo lco/lco_ast.cmx : \ + global/rml_ident.cmx \ global/rml_asttypes.cmx \ parsing/location.cmx \ - global/ident.cmx \ global/global.cmx \ typing/def_types.cmx lco/lco_misc.cmo : \ @@ -491,6 +491,7 @@ lco/lco_misc.cmx : \ lco/lco_ast.cmx lco/reac2lco.cmo : \ global/rml_misc.cmo \ + global/rml_ident.cmo \ global/rml_asttypes.cmo \ reac/reac_misc.cmo \ reac/reac_ast.cmo \ @@ -498,12 +499,12 @@ lco/reac2lco.cmo : \ parsing/location.cmo \ lco/lco_ast.cmo \ global/initialization.cmo \ - global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ static/def_static.cmo lco/reac2lco.cmx : \ global/rml_misc.cmx \ + global/rml_ident.cmx \ global/rml_asttypes.cmx \ reac/reac_misc.cmx \ reac/reac_ast.cmx \ @@ -511,20 +512,19 @@ lco/reac2lco.cmx : \ parsing/location.cmx \ lco/lco_ast.cmx \ global/initialization.cmx \ - global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ static/def_static.cmx lk/lk_ast.cmo : \ + global/rml_ident.cmo \ global/rml_asttypes.cmo \ parsing/location.cmo \ - global/ident.cmo \ global/global.cmo \ typing/def_types.cmo lk/lk_ast.cmx : \ + global/rml_ident.cmx \ global/rml_asttypes.cmx \ parsing/location.cmx \ - global/ident.cmx \ global/global.cmx \ typing/def_types.cmx lk/lk_misc.cmo : \ @@ -533,66 +533,66 @@ lk/lk_misc.cmx : \ lk/lk_ast.cmx lk/reac2lk.cmo : \ global/rml_misc.cmo \ + global/rml_ident.cmo \ global/rml_asttypes.cmo \ reac/reac_misc.cmo \ reac/reac_ast.cmo \ parsing/location.cmo \ lk/lk_ast.cmo \ - global/ident.cmo \ static/def_static.cmo lk/reac2lk.cmx : \ global/rml_misc.cmx \ + global/rml_ident.cmx \ global/rml_asttypes.cmx \ reac/reac_misc.cmx \ reac/reac_ast.cmx \ parsing/location.cmx \ lk/lk_ast.cmx \ - global/ident.cmx \ static/def_static.cmx caml/caml2caml.cmo : \ global/symbol_table.cmo \ global/rml_misc.cmo \ + global/rml_ident.cmo \ global/rml_asttypes.cmo \ - global/ident.cmo \ caml/caml_misc.cmo \ caml/caml_ast.cmo caml/caml2caml.cmx : \ global/symbol_table.cmx \ global/rml_misc.cmx \ + global/rml_ident.cmx \ global/rml_asttypes.cmx \ - global/ident.cmx \ caml/caml_misc.cmx \ caml/caml_ast.cmx caml/caml_ast.cmo : \ + global/rml_ident.cmo \ global/rml_asttypes.cmo \ parsing/location.cmo \ - global/ident.cmo \ global/global.cmo \ typing/def_types.cmo caml/caml_ast.cmx : \ + global/rml_ident.cmx \ global/rml_asttypes.cmx \ parsing/location.cmx \ - global/ident.cmx \ global/global.cmx \ typing/def_types.cmx caml/caml_misc.cmo : \ global/rml_misc.cmo \ + global/rml_ident.cmo \ global/rml_asttypes.cmo \ global/modules.cmo \ parsing/location.cmo \ global/initialization.cmo \ - global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ typing/def_types.cmo \ caml/caml_ast.cmo caml/caml_misc.cmx : \ global/rml_misc.cmx \ + global/rml_ident.cmx \ global/rml_asttypes.cmx \ global/modules.cmx \ parsing/location.cmx \ global/initialization.cmx \ - global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ typing/def_types.cmx \ @@ -619,46 +619,46 @@ caml/lco2caml.cmx : \ caml/caml_ast.cmx caml/lk2caml.cmo : \ global/rml_misc.cmo \ + global/rml_ident.cmo \ global/rml_asttypes.cmo \ parsing/location.cmo \ lk/lk_misc.cmo \ lk/lk_ast.cmo \ global/initialization.cmo \ - global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ caml/caml_misc.cmo \ caml/caml_ast.cmo caml/lk2caml.cmx : \ global/rml_misc.cmx \ + global/rml_ident.cmx \ global/rml_asttypes.cmx \ parsing/location.cmx \ lk/lk_misc.cmx \ lk/lk_ast.cmx \ global/initialization.cmx \ - global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ caml/caml_misc.cmx \ caml/caml_ast.cmx caml/print_caml_src.cmo : \ global/rml_misc.cmo \ + global/rml_ident.cmo \ global/rml_asttypes.cmo \ global/initialization.cmo \ - global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ caml/caml_ast.cmo caml/print_caml_src.cmx : \ global/rml_misc.cmx \ + global/rml_ident.cmx \ global/rml_asttypes.cmx \ global/initialization.cmx \ - global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ caml/caml_ast.cmx optimization/reac_optimization.cmo : \ - typing/types.cmo \ + typing/rml_types.cmo \ global/rml_asttypes.cmo \ reac/reac_misc.cmo \ reac/reac_ast.cmo \ @@ -669,7 +669,7 @@ optimization/reac_optimization.cmo : \ typing/def_types.cmo \ static/def_static.cmo optimization/reac_optimization.cmx : \ - typing/types.cmx \ + typing/rml_types.cmx \ global/rml_asttypes.cmx \ reac/reac_misc.cmx \ reac/reac_ast.cmx \ @@ -680,22 +680,26 @@ optimization/reac_optimization.cmx : \ typing/def_types.cmx \ static/def_static.cmx optimization/remove_when.cmo : \ + global/rml_ident.cmo \ reac/reac_misc.cmo \ reac/reac_ast.cmo \ parsing/location.cmo \ - global/initialization.cmo \ - global/ident.cmo + global/initialization.cmo optimization/remove_when.cmx : \ + global/rml_ident.cmx \ reac/reac_misc.cmx \ reac/reac_ast.cmx \ parsing/location.cmx \ - global/initialization.cmx \ - global/ident.cmx + global/initialization.cmx main/compiler.cmo : \ other_analysis/wf_rec.cmo \ typing/typing.cmo \ static/static.cmo \ + parsing/rml_parse.cmo \ global/rml_misc.cmo \ + global/rml_ident.cmo \ + main/rml_errors.cmo \ + reac/rml_annot.cmo \ optimization/reac_optimization.cmo \ reac/reac2reac.cmo \ lk/reac2lk.cmo \ @@ -704,25 +708,25 @@ main/compiler.cmo : \ parsing/parse_printer.cmo \ parsing/parse_ident.cmo \ reac/parse2reac.cmo \ - parsing/parse.cmo \ global/modules.cmo \ parsing/location.cmo \ caml/lk2caml.cmo \ caml/lco2caml.cmo \ other_analysis/instantaneous_loop.cmo \ global/initialization.cmo \ - global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ external/external.cmo \ - main/errors.cmo \ - caml/caml2caml.cmo \ - reac/annot.cmo + caml/caml2caml.cmo main/compiler.cmx : \ other_analysis/wf_rec.cmx \ typing/typing.cmx \ static/static.cmx \ + parsing/rml_parse.cmx \ global/rml_misc.cmx \ + global/rml_ident.cmx \ + main/rml_errors.cmx \ + reac/rml_annot.cmx \ optimization/reac_optimization.cmx \ reac/reac2reac.cmx \ lk/reac2lk.cmx \ @@ -731,77 +735,73 @@ main/compiler.cmx : \ parsing/parse_printer.cmx \ parsing/parse_ident.cmx \ reac/parse2reac.cmx \ - parsing/parse.cmx \ global/modules.cmx \ parsing/location.cmx \ caml/lk2caml.cmx \ caml/lco2caml.cmx \ other_analysis/instantaneous_loop.cmx \ global/initialization.cmx \ - global/ident.cmx \ global/global_ident.cmx \ global/global.cmx \ external/external.cmx \ - main/errors.cmx \ - caml/caml2caml.cmx \ - reac/annot.cmx + caml/caml2caml.cmx main/configure.cmo : \ global/version.cmo \ global/rml_misc.cmo main/configure.cmx : \ global/version.cmx \ global/rml_misc.cmx -main/errors.cmo : \ - global/warnings.cmo \ - parsing/syntaxerr.cmo \ - global/rml_misc.cmo \ - parsing/location.cmo \ - parsing/lexer.cmo -main/errors.cmx : \ - global/warnings.cmx \ - parsing/syntaxerr.cmx \ - global/rml_misc.cmx \ - parsing/location.cmx \ - parsing/lexer.cmx main/interactive.cmo : \ + parsing/rml_parse.cmo \ global/rml_misc.cmo \ - parsing/parse.cmo \ + parsing/rml_lexer.cmo \ + main/rml_errors.cmo \ global/modules.cmo \ parsing/location.cmo \ - parsing/lexer.cmo \ global/initialization.cmo \ external/external.cmo \ - main/errors.cmo \ main/configure.cmo \ main/compiler.cmo main/interactive.cmx : \ + parsing/rml_parse.cmx \ global/rml_misc.cmx \ - parsing/parse.cmx \ + parsing/rml_lexer.cmx \ + main/rml_errors.cmx \ global/modules.cmx \ parsing/location.cmx \ - parsing/lexer.cmx \ global/initialization.cmx \ external/external.cmx \ - main/errors.cmx \ main/configure.cmx \ main/compiler.cmx main/main.cmo : \ global/rml_misc.cmo \ + main/rml_errors.cmo \ global/modules.cmo \ main/interactive.cmo \ - main/errors.cmo \ main/compiler.cmo main/main.cmx : \ global/rml_misc.cmx \ + main/rml_errors.cmx \ global/modules.cmx \ main/interactive.cmx \ - main/errors.cmx \ main/compiler.cmx main/options.cmo : \ global/rml_misc.cmo \ - main/errors.cmo \ + main/rml_errors.cmo \ main/configure.cmo main/options.cmx : \ global/rml_misc.cmx \ - main/errors.cmx \ + main/rml_errors.cmx \ main/configure.cmx +main/rml_errors.cmo : \ + global/warnings.cmo \ + parsing/rml_syntaxerr.cmo \ + global/rml_misc.cmo \ + parsing/rml_lexer.cmo \ + parsing/location.cmo +main/rml_errors.cmx : \ + global/warnings.cmx \ + parsing/rml_syntaxerr.cmx \ + global/rml_misc.cmx \ + parsing/rml_lexer.cmx \ + parsing/location.cmx diff --git a/compiler/Makefile b/compiler/Makefile index d92ed727..0db6f936 100644 --- a/compiler/Makefile +++ b/compiler/Makefile @@ -6,7 +6,7 @@ DIRECTORIES = global parsing external static typing other_analysis reac lco lk c GLOBAL = global/rml_asttypes.ml \ global/global.ml \ global/global_ident.ml \ - global/ident.ml \ + global/rml_ident.ml \ global/initialization.ml \ global/rml_misc.ml \ global/modules.ml \ @@ -15,15 +15,15 @@ GLOBAL = global/rml_asttypes.ml \ global/symbol_table.ml \ global/warnings.ml \ -PARSING = parsing/lexer.mll \ +PARSING = parsing/rml_lexer.mll \ parsing/linenum.mll \ parsing/location.ml \ parsing/parse_ast.ml \ parsing/parse_ident.ml \ - parsing/parse.ml \ + parsing/rml_parse.ml \ parsing/parse_printer.ml \ parsing/rml_parser.mly \ - parsing/syntaxerr.ml \ + parsing/rml_syntaxerr.ml \ EXTERNAL = external/lucky.ml \ external/lucky_errors.ml \ @@ -34,7 +34,7 @@ STATIC = static/def_static.ml \ static/static_errors.ml \ static/static_printer.ml \ -REAC = reac/annot.ml \ +REAC = reac/rml_annot.ml \ reac/binding_errors.ml \ reac/parse2reac.ml \ reac/reac2reac.ml \ @@ -44,7 +44,7 @@ REAC = reac/annot.ml \ TYPING = typing/def_types.ml \ typing/reactivity_effects.ml \ typing/reactivity_check.cmo \ - typing/types.ml \ + typing/rml_types.ml \ typing/types_printer.ml \ typing/typing.ml \ typing/typing_errors.ml \ @@ -73,7 +73,7 @@ OPTIMIZATION = optimization/reac_optimization.ml \ MAIN = main/compiler.ml \ main/configure.ml \ main/options.ml \ - main/errors.ml \ + main/rml_errors.ml \ main/interactive.ml \ main/main.ml \ @@ -86,7 +86,7 @@ OBJ = global/version.cmo \ parsing/linenum.cmo \ parsing/location.cmo \ global/rml_misc.cmo \ - global/ident.cmo \ + global/rml_ident.cmo \ global/global_ident.cmo \ global/global.cmo \ static/def_static.cmo \ @@ -95,15 +95,15 @@ OBJ = global/version.cmo \ global/def_modules.cmo \ global/modules.cmo \ global/symbol_table.cmo \ - parsing/lexer.cmo \ - parsing/syntaxerr.cmo \ - main/errors.cmo \ + parsing/rml_lexer.cmo \ + parsing/rml_syntaxerr.cmo \ + main/rml_errors.cmo \ main/configure.cmo \ main/options.cmo \ parsing/parse_ast.cmo \ parsing/parse_ident.cmo \ parsing/rml_parser.cmo \ - parsing/parse.cmo \ + parsing/rml_parse.cmo \ parsing/parse_printer.cmo \ external/lucky_errors.cmo \ external/lucky.cmo \ @@ -112,7 +112,7 @@ OBJ = global/version.cmo \ reac/binding_errors.cmo \ typing/types_printer.cmo \ typing/reactivity_effects.cmo \ - typing/types.cmo \ + typing/rml_types.cmo \ reac/reac_misc.cmo \ reac/reac2reac.cmo \ typing/reactivity_check.cmo \ @@ -123,7 +123,7 @@ OBJ = global/version.cmo \ static/static.cmo \ other_analysis/wf_rec.cmo \ other_analysis/instantaneous_loop.cmo \ - reac/annot.cmo \ + reac/rml_annot.cmo \ typing/typing_errors.cmo \ typing/typing.cmo \ lco/lco_ast.cmo \ @@ -148,7 +148,7 @@ OBJ_OPT = $(OBJ:.cmo=.cmx) INCLUDES = $(DIRECTORIES:%=-I %) -GENSOURCES = global/version.ml parsing/rml_parser.mli parsing/lexer.ml parsing/rml_parser.ml \ +GENSOURCES = global/version.ml parsing/rml_parser.mli parsing/rml_lexer.ml parsing/rml_parser.ml \ parsing/linenum.ml include ../config @@ -215,7 +215,7 @@ wc: # dependencies parsing/rml_parser.mli parsing/rml_parser.ml: parsing/rml_parser.mly $(OCAMLYACC) -v parsing/rml_parser.mly -lexer.cmx: rml_parser.cmi +rml_lexer.cmx: rml_parser.cmi #.PHONY: global/rzi.ml global/rzi.ml: global/rzi.cmi global/def_modules.cmo diff --git a/compiler/caml/caml2caml.ml b/compiler/caml/caml2caml.ml index f6c5af45..440bb91b 100644 --- a/compiler/caml/caml2caml.ml +++ b/compiler/caml/caml2caml.ml @@ -32,7 +32,7 @@ open Caml_misc -module Env = Symbol_table.Make (Ident) +module Env = Symbol_table.Make (Rml_ident) (* Constant propagation *) let constant_propagation = diff --git a/compiler/caml/caml_ast.ml b/compiler/caml/caml_ast.ml index a8c6a1c9..4934a5c4 100644 --- a/compiler/caml/caml_ast.ml +++ b/compiler/caml/caml_ast.ml @@ -28,8 +28,8 @@ open Rml_asttypes open Def_types -type signal = Ident.t -type ident = Ident.t +type signal = Rml_ident.t +type ident = Rml_ident.t type 'a global = 'a Global.global (* Expressions *) diff --git a/compiler/caml/caml_misc.ml b/compiler/caml/caml_misc.ml index 42213779..97398e9a 100644 --- a/compiler/caml/caml_misc.ml +++ b/compiler/caml/caml_misc.ml @@ -58,7 +58,7 @@ let make_instruction s = make_expr (Cexpr_global { gi = { qual = !interpreter_module; - id = Ident.create Ident.gen_var s Ident.Internal }; + id = Rml_ident.create Rml_ident.gen_var s Rml_ident.Internal }; info = no_info(); }) Location.none @@ -66,7 +66,7 @@ let make_module_value mod_name val_name = make_expr (Cexpr_global { gi = { qual = mod_name; - id = Ident.create Ident.gen_var val_name Ident.Internal }; + id = Rml_ident.create Rml_ident.gen_var val_name Rml_ident.Internal }; info = no_info(); }) Location.none @@ -74,7 +74,7 @@ let make_module_value mod_name val_name = let make_rml_type s ty_list = make_te (Ctype_constr ({ gi = { qual = !interpreter_module; - id = Ident.create Ident.gen_type s Ident.Type }; + id = Rml_ident.create Rml_ident.gen_type s Rml_ident.Type }; info = no_info(); }, ty_list)) Location.none @@ -115,14 +115,14 @@ let make_raise_RML () = (make_expr (Cexpr_global { gi = { qual = stdlib_module; - id = Ident.create Ident.gen_var "raise" Ident.Val_ML }; + id = Rml_ident.create Rml_ident.gen_var "raise" Rml_ident.Val_ML }; info = no_info(); }) Location.none, [make_expr (Cexpr_construct ({ gi = { qual = !interpreter_module; - id = Ident.create Ident.gen_constr - "RML" Ident.Internal }; + id = Rml_ident.create Rml_ident.gen_constr + "RML" Rml_ident.Internal }; info = no_info(); }, None)) Location.none])) @@ -185,7 +185,7 @@ let make_ref e = (make_expr (Cexpr_global { gi = { qual = "Stdlib"; - id = Ident.create Ident.gen_var "ref" Ident.Internal }; + id = Rml_ident.create Rml_ident.gen_var "ref" Rml_ident.Internal }; info = no_info(); }) Location.none, [e])) @@ -198,7 +198,7 @@ let deref vref = (make_expr (Cexpr_global { gi = { qual = "Stdlib"; - id = Ident.create Ident.gen_var "!" Ident.Internal }; + id = Rml_ident.create Rml_ident.gen_var "!" Rml_ident.Internal }; info = no_info(); }) Location.none, [make_expr_var_local vref])) @@ -211,7 +211,7 @@ let make_magic () = (make_expr (Cexpr_global { gi = { qual="Obj"; - id=Ident.create Ident.gen_var "magic" Ident.Internal }; + id=Rml_ident.create Rml_ident.gen_var "magic" Rml_ident.Internal }; info = no_info(); }) Location.none, [make_unit()]) @@ -223,7 +223,7 @@ let make_magic_expr () = let make_patt_none () = let none = { gi = { qual="Stdlib"; - id=Ident.create Ident.gen_var "None" Ident.Internal; }; + id=Rml_ident.create Rml_ident.gen_var "None" Rml_ident.Internal; }; info = no_info(); } in make_patt (Cpatt_construct (none, None)) Location.none @@ -233,7 +233,7 @@ let make_patt_none () = let make_patt_some p = let some = { gi = { qual="Stdlib"; - id=Ident.create Ident.gen_var "Some" Ident.Internal; }; + id=Rml_ident.create Rml_ident.gen_var "Some" Rml_ident.Internal; }; info = no_info(); } in make_patt (Cpatt_construct (some, Some p)) Location.none @@ -312,7 +312,7 @@ let rec make_dummy t = Cexpr_construct ({ gi = { qual = !interpreter_module; - id = Ident.create Ident.gen_constr "RML" Ident.Internal }; + id = Rml_ident.create Rml_ident.gen_constr "RML" Rml_ident.Internal }; info = no_info(); }, None) diff --git a/compiler/caml/lk2caml.ml b/compiler/caml/lk2caml.ml index aea8f050..9e27722b 100644 --- a/compiler/caml/lk2caml.ml +++ b/compiler/caml/lk2caml.ml @@ -771,7 +771,7 @@ and translate_proc e = (* Tr(def x in k) = *) (* fun v -> let x = v in k () *) (* ce n'est pas traduit par (fun x -> k ()) pour avoir la generalisation *) - let id = Ident.create Ident.gen_var "v" Ident.Internal in + let id = Rml_ident.create Rml_ident.gen_var "v" Rml_ident.Internal in Cexpr_fun ([make_patt_var_local id], make_expr @@ -788,7 +788,7 @@ and translate_proc e = | Kproc_def_and_dyn (patt_list, k) -> (* Tr(def x and y in k) = *) (* fun v -> let x,y = v in k () *) - let id = Ident.create Ident.gen_var "v" Ident.Internal in + let id = Rml_ident.create Rml_ident.gen_var "v" Rml_ident.Internal in Cexpr_fun ([make_patt_var_local id], make_expr diff --git a/compiler/caml/print_caml_src.ml b/compiler/caml/print_caml_src.ml index e1dcc541..aecd8417 100644 --- a/compiler/caml/print_caml_src.ml +++ b/compiler/caml/print_caml_src.ml @@ -128,18 +128,18 @@ let print_global ({ gi = {qual=q; id=n} } as gl) = begin pp_print_string !formatter !interpreter_module; pp_print_string !formatter "."; - print_name (Ident.name n) + print_name (Rml_ident.name n) end else if q = stdlib_module then (* special case for values imported from the standard library *) - print_stdlib (Ident.name n) + print_stdlib (Rml_ident.name n) else if q = !current_module || q = "" then - print_name (Ident.name n) + print_name (Rml_ident.name n) else begin pp_print_string !formatter q; pp_print_string !formatter "."; - print_name (Ident.name n) + print_name (Rml_ident.name n) end (** Prints a type variables *) @@ -179,9 +179,9 @@ let rec print pri e = begin match e.cexpr_desc with Cexpr_constant(im) -> print_immediate im | Cexpr_global(gl) -> print_global gl - | Cexpr_local(s) -> print_name (Ident.unique_name s) + | Cexpr_local(s) -> print_name (Rml_ident.unique_name s) | Cexpr_construct(gl,None) -> print_global gl - | Cexpr_construct(gl,Some expr) when (Ident.name gl.gi.id = "::") -> + | Cexpr_construct(gl,Some expr) when (Rml_ident.name gl.gi.id = "::") -> begin match expr.cexpr_desc with | Cexpr_tuple [e1;e2] -> @@ -345,7 +345,7 @@ let rec print pri e = | Cexpr_for (i,e1,e2,flag,e3) -> pp_print_string !formatter "for"; pp_print_space !formatter (); - print_name (Ident.unique_name i); + print_name (Rml_ident.unique_name i); pp_print_string !formatter " = "; print (pri_e - 1) e1; pp_print_space !formatter (); @@ -450,11 +450,11 @@ and print_pattern pri pat = begin match pat.cpatt_desc with Cpatt_constant(i) -> print_immediate i | Cpatt_var(Cvarpatt_local v) -> - print_name (Ident.unique_name v) + print_name (Rml_ident.unique_name v) | Cpatt_var(Cvarpatt_global gl) -> print_global gl | Cpatt_construct(gl, None) -> print_global gl - | Cpatt_construct(gl,Some patt) when (Ident.name gl.gi.id = "::") -> + | Cpatt_construct(gl,Some patt) when (Rml_ident.name gl.gi.id = "::") -> begin match patt.cpatt_desc with | Cpatt_tuple [p1;p2] -> @@ -497,7 +497,7 @@ and print_pattern pri pat = pp_print_space !formatter (); begin match s with - | Cvarpatt_local id -> print_name (Ident.unique_name id) + | Cvarpatt_local id -> print_name (Rml_ident.unique_name id) | Cvarpatt_global gl -> print_global gl end; pp_print_string !formatter ")" diff --git a/compiler/global/global_ident.ml b/compiler/global/global_ident.ml index 2c296181..b7e61421 100644 --- a/compiler/global/global_ident.ml +++ b/compiler/global/global_ident.ml @@ -33,14 +33,14 @@ type qualified_ident = { qual: string; - id: Ident.t } + id: Rml_ident.t } let same i1 i2 = - (Ident.same i1.id i2.id) && (i1.qual = i2.qual) + (Rml_ident.same i1.id i2.id) && (i1.qual = i2.qual) -let name i = i.qual ^ "." ^ (Ident.name i.id) +let name i = i.qual ^ "." ^ (Rml_ident.name i.id) -let little_name i = Ident.name i.id +let little_name i = Rml_ident.name i.id let print ppf i = Format.fprintf ppf "%s@? " (name i) diff --git a/compiler/global/initialization.ml b/compiler/global/initialization.ml index 749b8112..f905e7c7 100644 --- a/compiler/global/initialization.ml +++ b/compiler/global/initialization.ml @@ -31,7 +31,7 @@ (* the initial module *) open Rml_misc -open Ident +open Rml_ident open Global_ident open Def_types open Global @@ -39,16 +39,16 @@ open Global let stdlib_type id = { qual = stdlib_module; - id = Ident.create Ident.gen_type id Ident.Type } + id = Rml_ident.create Rml_ident.gen_type id Rml_ident.Type } let interpreter_type id = { qual = !interpreter_module; - id = Ident.create Ident.gen_type id Ident.Type } + id = Rml_ident.create Rml_ident.gen_type id Rml_ident.Type } let stdlib_constr id = { qual = stdlib_module; - id = Ident.create Ident.gen_constr id Ident.Constr } + id = Rml_ident.create Rml_ident.gen_constr id Rml_ident.Constr } let stdlib_val id = { qual = stdlib_module; - id = Ident.create Ident.gen_var id Ident.Val_ML } + id = Rml_ident.create Rml_ident.gen_var id Rml_ident.Val_ML } let abstract_type id = { type_constr = @@ -63,37 +63,37 @@ let type_desc id = (* int *) let int_ident = stdlib_type "int" let type_desc_int = type_desc int_ident -let type_int = Types.constr_notabbrev int_ident [] +let type_int = Rml_types.constr_notabbrev int_ident [] (* bool *) let bool_ident = stdlib_type "bool" let type_desc_bool = type_desc bool_ident -let type_bool = Types.constr_notabbrev bool_ident [] +let type_bool = Rml_types.constr_notabbrev bool_ident [] (* float *) let float_ident = stdlib_type "float" let type_desc_float = type_desc float_ident -let type_float = Types.constr_notabbrev float_ident [] +let type_float = Rml_types.constr_notabbrev float_ident [] (* char *) let char_ident = stdlib_type "char" let type_desc_char = type_desc char_ident -let type_char = Types.constr_notabbrev char_ident [] +let type_char = Rml_types.constr_notabbrev char_ident [] (* string *) let string_ident = stdlib_type "string" let type_desc_string = type_desc string_ident -let type_string = Types.constr_notabbrev string_ident [] +let type_string = Rml_types.constr_notabbrev string_ident [] (* unit *) let unit_ident = stdlib_type "unit" let type_desc_unit = type_desc unit_ident -let type_unit = Types.constr_notabbrev unit_ident [] +let type_unit = Rml_types.constr_notabbrev unit_ident [] (* exn *) let exn_ident = stdlib_type "exn" let type_desc_exn = type_desc exn_ident -let type_exn = Types.constr_notabbrev exn_ident [] +let type_exn = Rml_types.constr_notabbrev exn_ident [] (* array *) let array_ident = stdlib_type "array" @@ -103,7 +103,7 @@ let type_desc_array = info = Some { constr_abbr=Constr_notabbrev} }; type_kind = Type_abstract; type_arity = 1; } } -let type_array = Types.constr_notabbrev array_ident [Types.new_generic_var()] +let type_array = Rml_types.constr_notabbrev array_ident [Rml_types.new_generic_var()] (* event *) (* let event_ident = interpreter_type "event" *) @@ -115,8 +115,8 @@ let type_desc_event = info = Some{ constr_abbr=Constr_notabbrev} }; type_kind = Type_abstract; type_arity = 2; } } -let type_event = Types.constr_notabbrev event_ident [Types.new_generic_var(); - Types.new_generic_var(); ] +let type_event = Rml_types.constr_notabbrev event_ident [Rml_types.new_generic_var(); + Rml_types.new_generic_var(); ] (* list *) @@ -124,20 +124,20 @@ let list_ident = stdlib_type "list" let nil_ident = stdlib_constr "[]" let nil_constr_desc = - let var = Types.new_generic_var() in + let var = Rml_types.new_generic_var() in let nil_constr = { cstr_arg = None; - cstr_res = Types.constr_notabbrev list_ident [var] } + cstr_res = Rml_types.constr_notabbrev list_ident [var] } in { gi = nil_ident; info = Some nil_constr; } let cons_ident = stdlib_constr "::" let cons_constr_desc = - let var = Types.new_generic_var() in - let var_list = Types.constr_notabbrev list_ident [var] in + let var = Rml_types.new_generic_var() in + let var_list = Rml_types.constr_notabbrev list_ident [var] in let cons_constr = - { cstr_arg = Some (Types.product [var; var_list]); + { cstr_arg = Some (Rml_types.product [var; var_list]); cstr_res = var_list; } in { gi = cons_ident; @@ -150,27 +150,27 @@ let type_desc_list = type_kind = Type_variant [nil_constr_desc; cons_constr_desc]; type_arity = 1; } } -let type_list = Types.constr_notabbrev list_ident [Types.new_generic_var()] +let type_list = Rml_types.constr_notabbrev list_ident [Rml_types.new_generic_var()] (* option *) let option_ident = stdlib_type "option" let none_ident = stdlib_constr "None" let none_constr_desc = - let var = Types.new_generic_var() in + let var = Rml_types.new_generic_var() in let none_constr = { cstr_arg = None; - cstr_res = Types.constr_notabbrev option_ident [var] } + cstr_res = Rml_types.constr_notabbrev option_ident [var] } in { gi = none_ident; info = Some none_constr; } let some_ident = stdlib_constr "Some" let some_constr_desc = - let var = Types.new_generic_var() in + let var = Rml_types.new_generic_var() in let some_constr = { cstr_arg = Some var; - cstr_res = Types.constr_notabbrev option_ident [var]; } + cstr_res = Rml_types.constr_notabbrev option_ident [var]; } in { gi = some_ident; info = Some some_constr; } @@ -182,7 +182,7 @@ let type_desc_option = type_kind = Type_variant [none_constr_desc; some_constr_desc]; type_arity = 1; } } -let type_option = Types.constr_notabbrev option_ident [Types.new_generic_var()] +let type_option = Rml_types.constr_notabbrev option_ident [Rml_types.new_generic_var()] let list_of_type_desc = diff --git a/compiler/global/modules.ml b/compiler/global/modules.ml index 7c24d4c0..de0a8c05 100644 --- a/compiler/global/modules.ml +++ b/compiler/global/modules.ml @@ -162,7 +162,7 @@ let defined_global name desc = let add_global_info sel_fct glob = let tbl = sel_fct !defined_module in - Hashtbl.add tbl (Ident.name glob.gi.id) glob + Hashtbl.add tbl (Rml_ident.name glob.gi.id) glob let add_global_info_list sel_fct glob_list = List.iter (add_global_info sel_fct) glob_list @@ -209,7 +209,7 @@ and pfind_type_desc = pfind_desc types_of_module let find_desc sel_fct gident = try - Hashtbl.find (sel_fct (find_module gident.qual)) (Ident.name gident.id) + Hashtbl.find (sel_fct (find_module gident.qual)) (Rml_ident.name gident.id) with Not_found -> raise Desc_not_found diff --git a/compiler/global/ident.ml b/compiler/global/rml_ident.ml similarity index 100% rename from compiler/global/ident.ml rename to compiler/global/rml_ident.ml diff --git a/compiler/lco/lco_ast.ml b/compiler/lco/lco_ast.ml index 77f500f0..f8810426 100644 --- a/compiler/lco/lco_ast.ml +++ b/compiler/lco/lco_ast.ml @@ -28,7 +28,7 @@ open Rml_asttypes open Def_types -type ident = Ident.t +type ident = Rml_ident.t type 'a global = 'a Global.global diff --git a/compiler/lco/reac2lco.ml b/compiler/lco/reac2lco.ml index f373f688..bc60354c 100644 --- a/compiler/lco/reac2lco.ml +++ b/compiler/lco/reac2lco.ml @@ -74,7 +74,7 @@ let make_rmltop_instruction s = make_expr (Coexpr_global { gi = { qual = "Rmltop_global"; - id = Ident.create Ident.gen_var s Ident.Internal }; + id = Rml_ident.create Rml_ident.gen_var s Rml_ident.Internal }; info = no_info(); }) Location.none @@ -605,15 +605,15 @@ and translate_proc_let = in let id_array = Array.init (List.length patt_expr_list) - (fun i -> Ident.create Ident.gen_var ("v"^(string_of_int i)) - Ident.Internal) + (fun i -> Rml_ident.create Rml_ident.gen_var ("v"^(string_of_int i)) + Rml_ident.Internal) in let par = Coproc_par (List.fold_right2 (fun id (_, expr) expr_list -> let local_id = - Ident.create Ident.gen_var "x" Ident.Internal + Rml_ident.create Rml_ident.gen_var "x" Rml_ident.Internal in make_proc (Coproc_def_dyn diff --git a/compiler/lk/lk_ast.ml b/compiler/lk/lk_ast.ml index e0eb2aef..40ed423b 100644 --- a/compiler/lk/lk_ast.ml +++ b/compiler/lk/lk_ast.ml @@ -28,7 +28,7 @@ open Rml_asttypes open Def_types -type ident = Ident.t +type ident = Rml_ident.t type 'a global = 'a Global.global diff --git a/compiler/lk/reac2lk.ml b/compiler/lk/reac2lk.ml index b5f12570..7692dabc 100644 --- a/compiler/lk/reac2lk.ml +++ b/compiler/lk/reac2lk.ml @@ -60,7 +60,7 @@ let make_intf it loc = { kintf_desc = it; kintf_loc = loc; } -let make_var s = Ident.create Ident.gen_var s Ident.Internal +let make_var s = Rml_ident.create Rml_ident.gen_var s Rml_ident.Internal (* Translation of type expressions *) let rec translate_te typ = diff --git a/compiler/main/compiler.ml b/compiler/main/compiler.ml index 33593ab6..d3c179fb 100644 --- a/compiler/main/compiler.ml +++ b/compiler/main/compiler.ml @@ -29,7 +29,7 @@ (* $Id$ *) open Rml_misc -open Errors +open Rml_errors (* compiling a file. Two steps. *) @@ -113,7 +113,7 @@ let compile_implementation_front_end info_fmt filename itf impl_list = ignore (Reac2reac.impl_map - (fun e -> Annot.Sstatic.record (Annot.Ti_expr e); e) + (fun e -> Rml_annot.Sstatic.record (Rml_annot.Ti_expr e); e) rml_code); (* for option *) @@ -260,7 +260,7 @@ let compile_implementation module_name filename = (* parsing of the file *) Parse_timer.start(); - let decl_list = Parse.implementation lexbuf in + let decl_list = Rml_parse.implementation lexbuf in Parse_timer.time(); (* expend externals *) @@ -310,7 +310,7 @@ let compile_implementation module_name filename = in if not (Typing.is_unit_process (Global.info main)) then bad_type_main !simulation_process (Global.info main); - let main_id = Ident.name main.Global.gi.Global_ident.id in + let main_id = Rml_ident.name main.Global.gi.Global_ident.id in let boi_hook = "["^ (if !number_of_instant >= 0 then @@ -340,14 +340,14 @@ let compile_implementation module_name filename = end; (* write types annotation *) - Annot.Stypes.dump tannot_name; - Annot.Sstatic.dump sannot_name; + Rml_annot.Stypes.dump tannot_name; + Rml_annot.Sstatic.dump sannot_name; close_in ic; with x -> - Annot.Stypes.dump tannot_name; - Annot.Sstatic.dump sannot_name; + Rml_annot.Stypes.dump tannot_name; + Rml_annot.Sstatic.dump sannot_name; close_in ic; raise x @@ -472,10 +472,10 @@ let compile_interface parse module_name filename filename_end = let compile_scalar_interface module_name filename = let no_link_save = !no_link in no_link := true; - compile_interface Parse.interface module_name filename ".mli"; + compile_interface Rml_parse.interface module_name filename ".mli"; no_link := no_link_save (* compiling a ReactiveML interface *) let compile_interface module_name filename = - compile_interface Parse.interface module_name filename ".rmli" + compile_interface Rml_parse.interface module_name filename ".rmli" diff --git a/compiler/main/interactive.ml b/compiler/main/interactive.ml index c10fc724..28b087b4 100644 --- a/compiler/main/interactive.ml +++ b/compiler/main/interactive.ml @@ -49,7 +49,7 @@ let translate_phrase phrase = Location.reset (); try - let decl_list = Parse.interactive (Lexing.from_string phrase) in + let decl_list = Rml_parse.interactive (Lexing.from_string phrase) in (* expend externals *) let decl_list = List.map External.expend decl_list in (* front-end *) @@ -63,7 +63,7 @@ let translate_phrase phrase = in None, ocaml_code with x -> - let () = Errors.report_error !Rml_misc.err_fmt x in + let () = Rml_errors.report_error !Rml_misc.err_fmt x in Some "", [ phrase ] (* the main function *) @@ -84,11 +84,11 @@ let compile () = begin try Location.init lexbuf ""; - Lexer.update_loc lexbuf None 1 true 0; - let decl_list = Parse.interactive lexbuf in + Rml_lexer.update_loc lexbuf None 1 true 0; + let decl_list = Rml_parse.interactive lexbuf in compile_decl_list module_name (Some itf) info_fmt out_chan decl_list with x -> - Errors.report_error Format.err_formatter x; + Rml_errors.report_error Format.err_formatter x; output_string out_chan "let () = ();;\n" end; flush out_chan; diff --git a/compiler/main/main.ml b/compiler/main/main.ml index 55057112..b5db6fea 100644 --- a/compiler/main/main.ml +++ b/compiler/main/main.ml @@ -60,7 +60,7 @@ let main () = try List.iter compile !to_compile with x -> - Errors.report_error !err_fmt x; + Rml_errors.report_error !err_fmt x; Format.pp_print_flush !std_fmt (); Format.pp_print_flush !err_fmt (); exit 2 diff --git a/compiler/main/options.ml b/compiler/main/options.ml index dd0de71e..9b0f91ea 100644 --- a/compiler/main/options.ml +++ b/compiler/main/options.ml @@ -73,7 +73,7 @@ let _ = if !where then show_where (); if !with_thread then add_stdlib_thread (); with x -> - Errors.report_error Format.err_formatter x; + Rml_errors.report_error Format.err_formatter x; exit 2 let _ = diff --git a/compiler/main/errors.ml b/compiler/main/rml_errors.ml similarity index 96% rename from compiler/main/errors.ml rename to compiler/main/rml_errors.ml index 9059ac7c..07dde6d2 100644 --- a/compiler/main/errors.ml +++ b/compiler/main/rml_errors.ml @@ -44,11 +44,11 @@ open Format let report_error ppf exn = let report ppf = function - | Lexer.Error(err, loc) -> + | Rml_lexer.Error(err, loc) -> Location.print ppf loc; - Lexer.report_error ppf err - | Syntaxerr.Error err -> - Syntaxerr.report_error ppf err + Rml_lexer.report_error ppf err + | Rml_syntaxerr.Error err -> + Rml_syntaxerr.report_error ppf err | Rml_misc.Error -> () | Rml_misc.Internal (loc,msg) -> diff --git a/compiler/optimization/reac_optimization.ml b/compiler/optimization/reac_optimization.ml index 8aef3511..7a7313f5 100644 --- a/compiler/optimization/reac_optimization.ml +++ b/compiler/optimization/reac_optimization.ml @@ -131,9 +131,9 @@ let for2loop_n expr = in minus.expr_static <- (Def_static.Process, Def_static.Static); minus.expr_type <- - Types.arrow + Rml_types.arrow Initialization.type_int - (Types.arrow + (Rml_types.arrow Initialization.type_int Initialization.type_int); let e' = @@ -157,9 +157,9 @@ let for2loop_n expr = in plus.expr_static <- (Def_static.Process, Def_static.Static); plus.expr_type <- - Types.arrow + Rml_types.arrow Initialization.type_int - (Types.arrow + (Rml_types.arrow Initialization.type_int Initialization.type_int); let one = diff --git a/compiler/optimization/remove_when.ml b/compiler/optimization/remove_when.ml index c279bff6..bdfd3cf1 100644 --- a/compiler/optimization/remove_when.ml +++ b/compiler/optimization/remove_when.ml @@ -159,7 +159,7 @@ let tr = | Rexpr_process e -> let id = - Ident.create Initialization.gen_ident "__ctrl" Ident.Internal + Rml_ident.create Initialization.gen_ident "__ctrl" Rml_ident.Internal in let c = make_conf diff --git a/compiler/other_analysis/instantaneous_loop.ml b/compiler/other_analysis/instantaneous_loop.ml index 514f8729..73c32538 100644 --- a/compiler/other_analysis/instantaneous_loop.ml +++ b/compiler/other_analysis/instantaneous_loop.ml @@ -70,7 +70,7 @@ module Env : let same key1 key2 = begin match key1, key2 with | Varpatt_local id1, Varpatt_local id2 -> - Ident.same id1 id2 + Rml_ident.same id1 id2 | Varpatt_global gl1, Varpatt_global gl2 -> Global_ident.same gl1.Global.gi gl2.Global.gi | _ -> false diff --git a/compiler/parsing/lexer.mll b/compiler/parsing/rml_lexer.mll similarity index 100% rename from compiler/parsing/lexer.mll rename to compiler/parsing/rml_lexer.mll diff --git a/compiler/parsing/parse.ml b/compiler/parsing/rml_parse.ml similarity index 79% rename from compiler/parsing/parse.ml rename to compiler/parsing/rml_parse.ml index c0748f88..964167be 100644 --- a/compiler/parsing/parse.ml +++ b/compiler/parsing/rml_parse.ml @@ -48,14 +48,14 @@ open Location let rec skip_phrase lexbuf = try - match Lexer.token lexbuf with + match Rml_lexer.token lexbuf with Rml_parser.SEMISEMI | Rml_parser.EOF -> () | _ -> skip_phrase lexbuf with - | Lexer.Error (Lexer.Unterminated_comment, _) -> () - | Lexer.Error (Lexer.Unterminated_string, _) -> () - | Lexer.Error (Lexer.Unterminated_string_in_comment, _) -> () - | Lexer.Error (Lexer.Illegal_character _, _) -> skip_phrase lexbuf + | Rml_lexer.Error (Rml_lexer.Unterminated_comment, _) -> () + | Rml_lexer.Error (Rml_lexer.Unterminated_string, _) -> () + | Rml_lexer.Error (Rml_lexer.Unterminated_string_in_comment, _) -> () + | Rml_lexer.Error (Rml_lexer.Illegal_character _, _) -> skip_phrase lexbuf ;; let maybe_skip_phrase lexbuf = @@ -66,24 +66,24 @@ let maybe_skip_phrase lexbuf = let wrap parsing_fun lexbuf = try - let ast = parsing_fun Lexer.token lexbuf in + let ast = parsing_fun Rml_lexer.token lexbuf in Parsing.clear_parser(); ast with - | Lexer.Error(Lexer.Unterminated_comment, _) as err -> raise err - | Lexer.Error(Lexer.Unterminated_string, _) as err -> raise err - | Lexer.Error(Lexer.Unterminated_string_in_comment, _) as err -> raise err - | Lexer.Error(Lexer.Illegal_character _, _) as err -> + | Rml_lexer.Error(Rml_lexer.Unterminated_comment, _) as err -> raise err + | Rml_lexer.Error(Rml_lexer.Unterminated_string, _) as err -> raise err + | Rml_lexer.Error(Rml_lexer.Unterminated_string_in_comment, _) as err -> raise err + | Rml_lexer.Error(Rml_lexer.Illegal_character _, _) as err -> if !Location.input_name = "" then skip_phrase lexbuf; raise err - | Syntaxerr.Error _ as err -> + | Rml_syntaxerr.Error _ as err -> if !Location.input_name = "" then maybe_skip_phrase lexbuf; raise err - | Parsing.Parse_error | Syntaxerr.Escape_error -> + | Parsing.Parse_error | Rml_syntaxerr.Escape_error -> let loc = Location.curr lexbuf in if !Location.input_name = "" then maybe_skip_phrase lexbuf; - raise(Syntaxerr.Error(Syntaxerr.Other loc)) + raise(Rml_syntaxerr.Error(Rml_syntaxerr.Other loc)) ;; let implementation = wrap Rml_parser.implementation diff --git a/compiler/parsing/rml_parser.mly b/compiler/parsing/rml_parser.mly index c639a59c..be14c766 100644 --- a/compiler/parsing/rml_parser.mly +++ b/compiler/parsing/rml_parser.mly @@ -176,10 +176,10 @@ let rec mkrangepatt c1 c2 = reloc_patt (deep_mkrangepatt c1 c2) let syntax_error () = - raise Syntaxerr.Escape_error + raise Rml_syntaxerr.Escape_error let unclosed opening_name opening_num closing_name closing_num = - raise(Syntaxerr.Error(Syntaxerr.Unclosed(rhs_loc opening_num, opening_name, + raise(Rml_syntaxerr.Error(Rml_syntaxerr.Unclosed(rhs_loc opening_num, opening_name, rhs_loc closing_num, closing_name))) %} @@ -454,7 +454,7 @@ structure_item: { match $3 with | "luc" -> mkimpl(Pimpl_lucky(mksimple $4 4, List.rev $5, List.rev $6, $8)) - | _ -> raise (Syntaxerr.Error(Syntaxerr.Other (rhs_loc 1))) + | _ -> raise (Rml_syntaxerr.Error(Rml_syntaxerr.Other (rhs_loc 1))) } ; @@ -601,15 +601,15 @@ expr: { mkexpr(Pexpr_present($2, ghexpr(Pexpr_nothing), $4)) } | AWAIT await_flag event_config %prec above_IN { if (snd $2) = One - then raise(Syntaxerr.Error(Syntaxerr.Other (rhs_loc 2))) + then raise(Rml_syntaxerr.Error(Rml_syntaxerr.Other (rhs_loc 2))) else mkexpr(Pexpr_await(fst $2, $3)) } | AWAIT await_flag event_config IN par_expr { match $2 with - | Immediate, All -> raise(Syntaxerr.Error(Syntaxerr.Other (rhs_loc 2))) + | Immediate, All -> raise(Rml_syntaxerr.Error(Rml_syntaxerr.Other (rhs_loc 2))) | im, k -> mkexpr(Pexpr_await_val(im, k, $3, None, $5)) } | AWAIT await_flag event_config WHEN par_expr IN par_expr { match $2 with - | Immediate, All -> raise(Syntaxerr.Error(Syntaxerr.Other (rhs_loc 2))) + | Immediate, All -> raise(Rml_syntaxerr.Error(Rml_syntaxerr.Other (rhs_loc 2))) | im, k -> mkexpr(Pexpr_await_val(im, k, $3, Some $5, $7)) } | PROCESS proc_def @@ -699,7 +699,7 @@ simple_expr: [mkexpr (Pexpr_constant Const_unit)])), mkexpr Pexpr_pause)) !!!!!!!!!! *) - | _ -> raise (Syntaxerr.Error(Syntaxerr.Other (rhs_loc 2))) } + | _ -> raise (Rml_syntaxerr.Error(Rml_syntaxerr.Other (rhs_loc 2))) } ; very_simple_expr: /* simple_expr without "LPAREN expr RPAREN" */ val_longident @@ -772,7 +772,7 @@ very_simple_expr: /* simple_expr without "LPAREN expr RPAREN" */ [mkexpr (Pexpr_constant Const_unit)])), mkexpr Pexpr_pause)) !!!!!!!!!! *) - | _ -> raise (Syntaxerr.Error(Syntaxerr.Other (rhs_loc 2))) } + | _ -> raise (Rml_syntaxerr.Error(Rml_syntaxerr.Other (rhs_loc 2))) } ; pre_expr: simple_expr diff --git a/compiler/parsing/syntaxerr.ml b/compiler/parsing/rml_syntaxerr.ml similarity index 100% rename from compiler/parsing/syntaxerr.ml rename to compiler/parsing/rml_syntaxerr.ml diff --git a/compiler/reac/parse2reac.ml b/compiler/reac/parse2reac.ml index 51e8cfd1..876520c2 100644 --- a/compiler/reac/parse2reac.ml +++ b/compiler/reac/parse2reac.ml @@ -34,7 +34,7 @@ open Reac_ast open Reac_misc open Parse_ident open Def_types -open Types +open Rml_types module Env = Symbol_table.Make @@ -81,7 +81,7 @@ let rec translate_type_decl typ = let l = List.map (fun (c, typ) -> - let id = Ident.create Ident.gen_constr c.psimple_id Ident.Constr in + let id = Rml_ident.create Rml_ident.gen_constr c.psimple_id Rml_ident.Constr in let g = Modules.defined_global id (no_info()) in let _ = Modules.add_constr g in let typ = @@ -98,7 +98,7 @@ let rec translate_type_decl typ = let l = List.map (fun (lab, flag, typ) -> - let id = Ident.create Ident.gen_label lab.psimple_id Ident.Label in + let id = Rml_ident.create Rml_ident.gen_label lab.psimple_id Rml_ident.Label in let g = Modules.defined_global id (no_info()) in let _ = Modules.add_label g in (g, flag, translate_te typ)) @@ -125,7 +125,7 @@ let translate_pattern, translate_pattern_list, translate_pattern_record = with | Not_found -> let id = - Ident.create Ident.gen_var x.psimple_id Ident.Val_RML + Rml_ident.create Rml_ident.gen_var x.psimple_id Rml_ident.Val_RML in if is_global then @@ -148,7 +148,7 @@ let translate_pattern, translate_pattern_list, translate_pattern_record = with | Not_found -> let id = - Ident.create Ident.gen_var x.psimple_id Ident.Val_RML + Rml_ident.create Rml_ident.gen_var x.psimple_id Rml_ident.Val_RML in if is_global then @@ -388,7 +388,7 @@ let rec translate env e = Rexpr_while(tr_e1, tr_e2) | Pexpr_for (i,e1,e2,flag,e3) -> - let id = Ident.create Ident.gen_var i.psimple_id Ident.Val_ML in + let id = Rml_ident.create Rml_ident.gen_var i.psimple_id Rml_ident.Val_ML in let env = Env.add i.psimple_id id env in let tr_e1 = translate env e1 in let tr_e2 = translate env e2 in @@ -431,7 +431,7 @@ let rec translate env e = (translate_signal env sig_typ_list comb expr).expr_desc | Pexpr_fordopar (i, e1, e2, flag, e3) -> - let id = Ident.create Ident.gen_var i.psimple_id Ident.Val_RML in + let id = Rml_ident.create Rml_ident.gen_var i.psimple_id Rml_ident.Val_RML in let env = Env.add i.psimple_id id env in Rexpr_fordopar(id, translate env e1, @@ -612,7 +612,7 @@ and translate_signal env sig_typ_list comb expr = | [] -> translate env expr | (s,typ) :: sig_typ_list -> let (id, rtyp) = - Ident.create Ident.gen_var s.psimple_id Ident.Sig, + Rml_ident.create Rml_ident.gen_var s.psimple_id Rml_ident.Sig, opt_map translate_te typ in let env = Env.add s.psimple_id id env in @@ -637,7 +637,7 @@ let translate_type_declaration l = let l_rename = List.map (fun (name, param, typ) -> - let id = Ident.create Ident.gen_type name.psimple_id Ident.Type in + let id = Rml_ident.create Rml_ident.gen_type name.psimple_id Rml_ident.Type in let gl = Modules.defined_global id (no_info()) in let info = { type_constr = { gi = gl.gi; info = @@ -672,7 +672,7 @@ let translate_impl_item info_fmt item = Rimpl_signal (List.map (fun (s,ty_opt) -> - let id = Ident.create Ident.gen_var s.psimple_id Ident.Sig in + let id = Rml_ident.create Rml_ident.gen_var s.psimple_id Rml_ident.Sig in let gl = Modules.defined_global id (no_info()) in let _ = Modules.add_value gl in let rty_opt = opt_map translate_te ty_opt in @@ -690,13 +690,13 @@ let translate_impl_item info_fmt item = Rimpl_type l_translate | Pimpl_exn (name, typ) -> - let id = Ident.create Ident.gen_constr name.psimple_id Ident.Exn in + let id = Rml_ident.create Rml_ident.gen_constr name.psimple_id Rml_ident.Exn in let gl = Modules.defined_global id (no_info()) in let _ = Modules.add_constr gl in Rimpl_exn (gl, opt_map translate_te typ) | Pimpl_exn_rebind (name, gl_name) -> - let id = Ident.create Ident.gen_constr name.psimple_id Ident.Exn in + let id = Rml_ident.create Rml_ident.gen_constr name.psimple_id Rml_ident.Exn in let gl = Modules.defined_global id (no_info()) in let _ = Modules.add_constr gl in let gtype = try Modules.pfind_constr_desc gl_name.pident_id with @@ -721,7 +721,7 @@ let translate_intf_item info_fmt item = let ritem = match item.pintf_desc with | Pintf_val (s, t) -> - let id = Ident.create Ident.gen_var s.psimple_id Ident.Val_ML in + let id = Rml_ident.create Rml_ident.gen_var s.psimple_id Rml_ident.Val_ML in let gl = Modules.defined_global id (no_info()) in let _ = Modules.add_value gl in Rintf_val (gl, translate_te t) @@ -731,7 +731,7 @@ let translate_intf_item info_fmt item = Rintf_type l_translate | Pintf_exn (name, typ) -> - let id = Ident.create Ident.gen_constr name.psimple_id Ident.Exn in + let id = Rml_ident.create Rml_ident.gen_constr name.psimple_id Rml_ident.Exn in let gl = Modules.defined_global id (no_info()) in let _ = Modules.add_constr gl in Rintf_exn (gl, opt_map translate_te typ) diff --git a/compiler/reac/reac_ast.ml b/compiler/reac/reac_ast.ml index 1007b017..3ef108c0 100644 --- a/compiler/reac/reac_ast.ml +++ b/compiler/reac/reac_ast.ml @@ -33,7 +33,7 @@ open Rml_asttypes open Def_types -type ident = Ident.t +type ident = Rml_ident.t (*type global_ident = Global_ident.qualified_ident*) type 'a global = 'a Global.global diff --git a/compiler/reac/reac_misc.ml b/compiler/reac/reac_misc.ml index f8d6759b..89c8a2a5 100644 --- a/compiler/reac/reac_misc.ml +++ b/compiler/reac/reac_misc.ml @@ -28,7 +28,7 @@ open Rml_asttypes open Reac_ast open Def_types -open Types +open Rml_types open Reactivity_effects let make_expr_all e typ static reactivity reactivity_effect loc = @@ -71,7 +71,7 @@ let make_intf it loc = let string_of_varpatt x = begin match x with - | Varpatt_local id -> Ident.unique_name id + | Varpatt_local id -> Rml_ident.unique_name id | Varpatt_global x -> Global.little_name_of_global x end @@ -125,7 +125,7 @@ let rec is_free x vars = | x' :: vars' -> begin match x, x' with | Varpatt_local id1, Varpatt_local id2 -> - if Ident.same id1 id2 then + if Rml_ident.same id1 id2 then false else is_free x vars' diff --git a/compiler/reac/annot.ml b/compiler/reac/rml_annot.ml similarity index 100% rename from compiler/reac/annot.ml rename to compiler/reac/rml_annot.ml diff --git a/compiler/typing/reactivity_effects.ml b/compiler/typing/reactivity_effects.ml index dcbd9fc2..527364e8 100644 --- a/compiler/typing/reactivity_effects.ml +++ b/compiler/typing/reactivity_effects.ml @@ -27,7 +27,7 @@ open Def_types exception React_Unify (* generating fresh names *) -let names = new Ident.name_generator +let names = new Rml_ident.name_generator (* The current nesting level of lets *) let reactivity_current_level = ref 0;; diff --git a/compiler/typing/types.ml b/compiler/typing/rml_types.ml similarity index 99% rename from compiler/typing/types.ml rename to compiler/typing/rml_types.ml index 5dd39e38..0276ec7d 100644 --- a/compiler/typing/types.ml +++ b/compiler/typing/rml_types.ml @@ -39,7 +39,7 @@ exception Unify (* generating fresh names *) -let names = new Ident.name_generator +let names = new Rml_ident.name_generator (* The current nesting level of lets *) diff --git a/compiler/typing/types_printer.ml b/compiler/typing/types_printer.ml index 4f87cfd3..896278d4 100644 --- a/compiler/typing/types_printer.ml +++ b/compiler/typing/types_printer.ml @@ -34,7 +34,7 @@ open Format open Def_types open Rml_asttypes open Rml_misc -open Ident +open Rml_ident open Modules open Global_ident open Global @@ -47,7 +47,7 @@ let print_qualified_ident ff q = (stdlib_module <> q.qual) && (!interpreter_module <> q.qual) then begin pp_print_string ff q.qual;pp_print_string ff "." end; - pp_print_string ff (Ident.name q.id) + pp_print_string ff (Rml_ident.name q.id) (* type variables are printed 'a, 'b,... *) let type_name = new name_assoc_table int_to_alpha @@ -253,7 +253,7 @@ let print_type_name ff tc ta = pp_print_string ff ")"; pp_print_space ff () end; - pp_print_string ff (Ident.name tc.id) + pp_print_string ff (Rml_ident.name tc.id) (* prints one variant *) let print_one_variant ff global = diff --git a/compiler/typing/typing.ml b/compiler/typing/typing.ml index 401f5af0..cec450fe 100644 --- a/compiler/typing/typing.ml +++ b/compiler/typing/typing.ml @@ -31,7 +31,7 @@ (* The type synthesizer *) open Def_types -open Types +open Rml_types open Reactivity_effects open Typing_errors open Initialization @@ -40,7 +40,7 @@ open Global open Global_ident open Reac_ast open Rml_misc -open Annot +open Rml_annot let unify_expr expr expected_ty actual_ty = try @@ -189,7 +189,7 @@ let non_gen ty = ignore (gen_ty false ty) (* Typing environment *) -module Env = Symbol_table.Make (Ident) +module Env = Symbol_table.Make (Rml_ident) let env_add l env = List.fold_left @@ -379,22 +379,22 @@ let rec type_of_pattern global_env local_env patt ty = | Rpatt_var (Varpatt_global gl) -> if List.exists (fun g -> g.gi.id = gl.gi.id) global_env - then non_linear_pattern_err patt (Ident.name gl.gi.id); + then non_linear_pattern_err patt (Rml_ident.name gl.gi.id); gl.info <- Some { value_typ = forall [] [] ty }; (gl::global_env, local_env) | Rpatt_var (Varpatt_local x) -> if List.mem_assoc x local_env - then non_linear_pattern_err patt (Ident.name x); + then non_linear_pattern_err patt (Rml_ident.name x); global_env, (x,ty)::local_env | Rpatt_alias (p,Varpatt_global gl) -> if List.exists (fun g -> g.gi.id = gl.gi.id) global_env - then non_linear_pattern_err patt (Ident.name gl.gi.id); + then non_linear_pattern_err patt (Rml_ident.name gl.gi.id); gl.info <- Some { value_typ = forall [] [] ty }; type_of_pattern (gl::global_env) local_env p ty | Rpatt_alias (p,Varpatt_local x) -> if List.mem_assoc x local_env - then non_linear_pattern_err patt (Ident.name x); + then non_linear_pattern_err patt (Rml_ident.name x); type_of_pattern global_env ((x,ty)::local_env) p ty | Rpatt_constant (i) -> @@ -441,7 +441,7 @@ let rec type_of_pattern global_env local_env patt ty = try List.find (fun gl -> (gl1.gi.id = gl.gi.id)) global_env2 with - | Not_found -> orpat_vars p2.patt_loc (Ident.name gl1.gi.id) + | Not_found -> orpat_vars p2.patt_loc (Rml_ident.name gl1.gi.id) in unify_var p2.patt_loc (Global.info gl1).value_typ.ts_desc @@ -453,7 +453,7 @@ let rec type_of_pattern global_env local_env patt ty = try List.find (fun (x,ty) -> (x1 = x)) local_env2 with - | Not_found -> orpat_vars p2.patt_loc (Ident.name x1) + | Not_found -> orpat_vars p2.patt_loc (Rml_ident.name x1) in unify_var p2.patt_loc ty1 ty2) local_env1; @@ -1036,7 +1036,7 @@ and type_of_event_config env conf = List.iter (fun (x, _) -> if List.mem_assoc x loc_env1 - then non_linear_config_err conf (Ident.name x)) + then non_linear_config_err conf (Rml_ident.name x)) loc_env2; loc_env1 @ loc_env2 @@ -1049,7 +1049,7 @@ and type_of_event_config env conf = try List.find (fun (x,ty) -> (x1 = x)) loc_env2 with - | Not_found -> orconfig_vars c2.conf_loc (Ident.name x1) + | Not_found -> orconfig_vars c2.conf_loc (Rml_ident.name x1) in unify_var c2.conf_loc ty1 ty2) loc_env1; @@ -1127,9 +1127,9 @@ let check_no_repeated_constructor loc l = match l with [] -> () | ({ gi = name }, _) :: l -> - if List.mem name.id.Ident.id cont - then repeated_constructor_definition_err name.id.Ident.name loc - else checkrec (name.id.Ident.id :: cont) l + if List.mem name.id.Rml_ident.id cont + then repeated_constructor_definition_err name.id.Rml_ident.name loc + else checkrec (name.id.Rml_ident.id :: cont) l in checkrec [] l @@ -1138,9 +1138,9 @@ let check_no_repeated_label loc l = match l with [] -> () | ({ gi = name },_ , _) :: l -> - if List.mem name.id.Ident.id cont - then repeated_label_definition_err name.id.Ident.name loc - else checkrec (name.id.Ident.id :: cont) l + if List.mem name.id.Rml_ident.id cont + then repeated_label_definition_err name.id.Rml_ident.name loc + else checkrec (name.id.Rml_ident.id :: cont) l in checkrec [] l diff --git a/compiler/typing/typing_errors.ml b/compiler/typing/typing_errors.ml index e6cb896c..6c76f9a8 100644 --- a/compiler/typing/typing_errors.ml +++ b/compiler/typing/typing_errors.ml @@ -32,7 +32,7 @@ open Rml_misc open Def_types -open Types +open Rml_types open Reac_ast (* type clash *) @@ -58,7 +58,7 @@ let event_wrong_type_err evt actual_ty expected_ty = Format.fprintf !err_fmt "The event %s has type %a,\n\ but is used with type %a.\n" - (Ident.name evt) + (Rml_ident.name evt) Types_printer.output actual_ty Types_printer.output expected_ty; raise Error @@ -149,7 +149,7 @@ let unbound_global_ident_err gr loc = let unbound_ident_err n loc = Format.fprintf !err_fmt "%aThe name %s is unbound.\n" Location.print loc - (Ident.name n); + (Rml_ident.name n); raise Error let unbound_constructor_err c loc = diff --git a/tools/rmldep/Makefile b/tools/rmldep/Makefile index 25b8f397..bdd94d9f 100644 --- a/tools/rmldep/Makefile +++ b/tools/rmldep/Makefile @@ -9,15 +9,15 @@ INCLUDES=-I ../../compiler/global -I ../../compiler/parsing OBJ = ../../compiler/global/version.cmo \ ../../compiler/global/rml_misc.cmo \ ../../compiler/global/warnings.cmo \ - ../../compiler/global/ident.cmo \ + ../../compiler/global/rml_ident.cmo \ ../../compiler/parsing/linenum.cmo \ ../../compiler/parsing/parse_ident.cmo \ ../../compiler/parsing/parse_ast.cmo \ ../../compiler/parsing/location.cmo \ - ../../compiler/parsing/syntaxerr.cmo \ - ../../compiler/parsing/lexer.cmo \ + ../../compiler/parsing/rml_syntaxerr.cmo \ + ../../compiler/parsing/rml_lexer.cmo \ ../../compiler/parsing/rml_parser.cmo \ - ../../compiler/parsing/parse.cmo \ + ../../compiler/parsing/rml_parse.cmo \ depend.cmo \ rmldep.cmo diff --git a/tools/rmldep/rmldep.ml b/tools/rmldep/rmldep.ml index 9dfdfc7a..1ebd49f9 100644 --- a/tools/rmldep/rmldep.ml +++ b/tools/rmldep/rmldep.ml @@ -208,12 +208,12 @@ let remove_preprocessed inputfile = let parse_use_file ic = seek_in ic 0; let lb = Lexing.from_channel ic in - Parse.implementation lb + Rml_parse.implementation lb let parse_interface ic = seek_in ic 0; let lb = Lexing.from_channel ic in - Parse.interface lb + Rml_parse.interface lb (* Process one file *) @@ -273,12 +273,12 @@ let file_dependencies_as kind source_file = end with x -> let report_err = function - | Lexer.Error(err, range) -> + | Rml_lexer.Error(err, range) -> fprintf Format.err_formatter "@[%a%a@]@." - Location.print range Lexer.report_error err - | Syntaxerr.Error err -> + Location.print range Rml_lexer.report_error err + | Rml_syntaxerr.Error err -> fprintf Format.err_formatter "@[%a@]@." - Syntaxerr.report_error err + Rml_syntaxerr.report_error err | Sys_error msg -> fprintf Format.err_formatter "@[I/O error:@ %s@]@." msg | Preprocessing_error -> From d52eb30246c15120f7f7cccb7343a4fd00134683 Mon Sep 17 00:00:00 2001 From: Samuel VIVIEN Date: Tue, 4 Jan 2022 12:33:15 +0100 Subject: [PATCH 03/13] Renammed main.ml -> rmlc.ml --- compiler/.depend | 24 ++++++++++++------------ compiler/Makefile | 6 +++--- compiler/main/{main.ml => rmlc.ml} | 0 3 files changed, 15 insertions(+), 15 deletions(-) rename compiler/main/{main.ml => rmlc.ml} (100%) diff --git a/compiler/.depend b/compiler/.depend index ee120aed..8fba2f76 100644 --- a/compiler/.depend +++ b/compiler/.depend @@ -773,18 +773,6 @@ main/interactive.cmx : \ external/external.cmx \ main/configure.cmx \ main/compiler.cmx -main/main.cmo : \ - global/rml_misc.cmo \ - main/rml_errors.cmo \ - global/modules.cmo \ - main/interactive.cmo \ - main/compiler.cmo -main/main.cmx : \ - global/rml_misc.cmx \ - main/rml_errors.cmx \ - global/modules.cmx \ - main/interactive.cmx \ - main/compiler.cmx main/options.cmo : \ global/rml_misc.cmo \ main/rml_errors.cmo \ @@ -805,3 +793,15 @@ main/rml_errors.cmx : \ global/rml_misc.cmx \ parsing/rml_lexer.cmx \ parsing/location.cmx +main/rmlc.cmo : \ + global/rml_misc.cmo \ + main/rml_errors.cmo \ + global/modules.cmo \ + main/interactive.cmo \ + main/compiler.cmo +main/rmlc.cmx : \ + global/rml_misc.cmx \ + main/rml_errors.cmx \ + global/modules.cmx \ + main/interactive.cmx \ + main/compiler.cmx diff --git a/compiler/Makefile b/compiler/Makefile index 0db6f936..27323f58 100644 --- a/compiler/Makefile +++ b/compiler/Makefile @@ -75,7 +75,7 @@ MAIN = main/compiler.ml \ main/options.ml \ main/rml_errors.ml \ main/interactive.ml \ - main/main.ml \ + main/rmlc.ml \ SRC = $(GLOBAL) $(PARSING) $(REAC) $(TYPING) $(OTHER_ANALYSIS) $(EXTERNAL) $(STATIC) $(LCO) $(LK) $(CAML) $(MAIN) @@ -141,7 +141,7 @@ OBJ = global/version.cmo \ optimization/reac_optimization.cmo \ main/compiler.cmo \ main/interactive.cmo \ - main/main.cmo \ + main/rmlc.cmo \ OBJ_OPT = $(OBJ:.cmo=.cmx) @@ -175,7 +175,7 @@ uninstall: uninstall.$(TARGET) rm -f $(BINDIR)/$(BIN) -C_OBJ_BYTE = $(filter-out main/options.cmo main/main.cmo,$(OBJ)) +C_OBJ_BYTE = $(filter-out main/options.cmo main/rmlc.cmo,$(OBJ)) C_OBJ_OPT = $(C_OBJ_BYTE:.cmo=.cmx) rmlcompiler.cmo: $(C_OBJ_BYTE) diff --git a/compiler/main/main.ml b/compiler/main/rmlc.ml similarity index 100% rename from compiler/main/main.ml rename to compiler/main/rmlc.ml From cade929eec554a4a678915aded4e04f0647f01f6 Mon Sep 17 00:00:00 2001 From: Samuel VIVIEN Date: Tue, 4 Jan 2022 13:49:30 +0100 Subject: [PATCH 04/13] started to implement a new build sequence --- compiler/dune | 87 ++++++++++++++++++++++ compiler/global/global.ml | 2 +- compiler/main/compiler.ml | 2 + compiler/main/options.ml | 109 ++++++++++++++-------------- compiler/main/rmlc.ml | 2 + compiler/parsing/rml_parser.mly | 4 +- configure-tools/dune | 11 +++ configure-tools/embedrzi.ml | 7 +- dune | 3 + dune-project | 4 + interpreter/dune | 10 +++ rml.opam | 26 +++++++ stdlib/dune | 35 +++++++++ toplevel/dune | 40 ++++++++++ toplevel/rmltop_global.ml | 1 + toplevel/rmltop_global.mli | 1 + toplevel/rmltop_implem.ml | 1 + toplevel/rmltop_reactive_machine.ml | 2 +- 18 files changed, 282 insertions(+), 65 deletions(-) create mode 100644 compiler/dune create mode 100644 configure-tools/dune create mode 100644 dune create mode 100644 dune-project create mode 100644 interpreter/dune create mode 100644 rml.opam create mode 100644 stdlib/dune create mode 100644 toplevel/dune diff --git a/compiler/dune b/compiler/dune new file mode 100644 index 00000000..93233cdb --- /dev/null +++ b/compiler/dune @@ -0,0 +1,87 @@ +(rule (target rmlc.ml) (action (copy main/rmlc.ml rmlc.ml))) +(rule (target compiler.ml) (action (copy main/compiler.ml compiler.ml))) +(rule (target rml_errors.ml) (action (copy main/rml_errors.ml rml_errors.ml))) +(rule (target options.ml) (action (copy main/options.ml options.ml))) +(rule (target configure.ml) (action (copy main/configure.ml configure.ml))) +(rule (target interactive.ml) (action (copy main/interactive.ml interactive.ml))) + +(rule (target rml_misc.ml) (action (copy global/rml_misc.ml rml_misc.ml))) +(rule (target version.ml) (action (copy global/version.ml version.ml))) +(rule (target modules.ml) (action (copy global/modules.ml modules.ml))) +(rule (target global_ident.ml) (action (copy global/global_ident.ml global_ident.ml))) +(rule (target rml_ident.ml) (action (copy global/rml_ident.ml rml_ident.ml))) +(rule (target rml_asttypes.ml) (action (copy global/rml_asttypes.ml rml_asttypes.ml))) +(rule (target global.ml) (action (copy global/global.ml global.ml))) +(rule (target def_modules.ml) (action (copy global/def_modules.ml def_modules.ml))) +(rule (target rzi.ml) (deps ../configure-tools/embedrzi.exe (env_var RML_RECOMPILE_RZI)) (action (with-stdout-to rzi.ml (run ../configure-tools/embedrzi.exe ..)))) +(rule (target warnings.ml) (action (copy global/warnings.ml warnings.ml))) +(rule (target symbol_table.ml) (action (copy global/symbol_table.ml symbol_table.ml))) +(rule (target initialization.ml) (action (copy global/initialization.ml initialization.ml))) + +(rule (target def_types.ml) (action (copy typing/def_types.ml def_types.ml))) +(rule (target reactivity_check.ml) (action (copy typing/reactivity_check.ml reactivity_check.ml))) +(rule (target reactivity_effects.ml) (action (copy typing/reactivity_effects.ml reactivity_effects.ml))) +(rule (target rml_types.ml) (action (copy typing/rml_types.ml rml_types.ml))) +(rule (target types_printer.ml) (action (copy typing/types_printer.ml types_printer.ml))) +(rule (target typing_errors.ml) (action (copy typing/typing_errors.ml typing_errors.ml))) +(rule (target typing.ml) (action (copy typing/typing.ml typing.ml))) + +(rule (target def_static.ml) (action (copy static/def_static.ml def_static.ml))) +(rule (target static_errors.ml) (action (copy static/static_errors.ml static_errors.ml))) +(rule (target static_printer.ml) (action (copy static/static_printer.ml static_printer.ml))) +(rule (target static.ml) (action (copy static/static.ml static.ml))) + +(rule (target parse_ident.ml) (action (copy parsing/parse_ident.ml parse_ident.ml))) +(rule (target parse_ast.ml) (action (copy parsing/parse_ast.ml parse_ast.ml))) +(rule (target rml_syntaxerr.ml) (action (copy parsing/rml_syntaxerr.ml rml_syntaxerr.ml))) +(rule (target parse_printer.ml) (action (copy parsing/parse_printer.ml parse_printer.ml))) +(rule (target location.ml) (action (copy parsing/location.ml location.ml))) +(rule (target linenum.ml) (action (copy parsing/linenum.ml linenum.ml))) +(rule (target rml_parse.ml) (action (copy parsing/rml_parse.ml rml_parse.ml))) +(rule (target rml_parser.mly) (action (copy parsing/rml_parser.mly rml_parser.mly))) +(rule (target rml_lexer.mll) (action (copy parsing/rml_lexer.mll rml_lexer.mll))) + +(rule (target binding_errors.ml) (action (copy reac/binding_errors.ml binding_errors.ml))) +(rule (target parse2reac.ml) (action (copy reac/parse2reac.ml parse2reac.ml))) +(rule (target reac_ast.ml) (action (copy reac/reac_ast.ml reac_ast.ml))) +(rule (target reac_misc.ml) (action (copy reac/reac_misc.ml reac_misc.ml))) +(rule (target reac2reac.ml) (action (copy reac/reac2reac.ml reac2reac.ml))) +(rule (target rml_annot.ml) (action (copy reac/rml_annot.ml rml_annot.ml))) + +(rule (target reac_optimization.ml) (action (copy optimization/reac_optimization.ml reac_optimization.ml))) + +(rule (target instantaneous_loop.ml) (action (copy other_analysis/instantaneous_loop.ml instantaneous_loop.ml))) +(rule (target wf_rec.ml) (action (copy other_analysis/wf_rec.ml wf_rec.ml))) + +(rule (target lk_ast.ml) (action (copy lk/lk_ast.ml lk_ast.ml))) +(rule (target lk_misc.ml) (action (copy lk/lk_misc.ml lk_misc.ml))) +(rule (target reac2lk.ml) (action (copy lk/reac2lk.ml reac2lk.ml))) + +(rule (target lco_ast.ml) (action (copy lco/lco_ast.ml lco_ast.ml))) +(rule (target lco_misc.ml) (action (copy lco/lco_misc.ml lco_misc.ml))) +(rule (target reac2lco.ml) (action (copy lco/reac2lco.ml reac2lco.ml))) + +(rule (target caml_ast.ml) (action (copy caml/caml_ast.ml caml_ast.ml))) +(rule (target caml_misc.ml) (action (copy caml/caml_misc.ml caml_misc.ml))) +(rule (target caml2caml.ml) (action (copy caml/caml2caml.ml caml2caml.ml))) +(rule (target lco2caml.ml) (action (copy caml/lco2caml.ml lco2caml.ml))) +(rule (target lk2caml.ml) (action (copy caml/lk2caml.ml lk2caml.ml))) +(rule (target print_caml_src.ml) (action (copy caml/print_caml_src.ml print_caml_src.ml))) + +(rule (target external.ml) (action (copy external/external.ml external.ml))) +(rule (target lucky.ml) (action (copy external/lucky.ml lucky.ml))) +(rule (target lucky_errors.ml) (action (copy external/lucky_errors.ml lucky_errors.ml))) + +(ocamllex + (modules rml_lexer)) + +(menhir + (modules rml_parser)) + + +(executables + (names rmlc)) + +(install + (files (rmlc.exe as rmlc)) + (section bin)) \ No newline at end of file diff --git a/compiler/global/global.ml b/compiler/global/global.ml index 1581a0bb..d2fbda3d 100644 --- a/compiler/global/global.ml +++ b/compiler/global/global.ml @@ -28,7 +28,7 @@ (* $Id$ *) -open Rml_misc +(* open Rml_misc unused open *) (* values in the symbol table *) diff --git a/compiler/main/compiler.ml b/compiler/main/compiler.ml index d3c179fb..989972b8 100644 --- a/compiler/main/compiler.ml +++ b/compiler/main/compiler.ml @@ -292,6 +292,7 @@ let compile_implementation module_name filename = "(* "^(Array.fold_right (fun s cmd -> s^" "^cmd) Sys.argv " ")^ "*)\n\n"); (* selection of the interpreter *) + output_string out_chan ("open Rmllib;;\n"); output_string out_chan ("open "^ !interpreter_impl ^";;\n"); (* the implementation *) @@ -452,6 +453,7 @@ let compile_interface parse module_name filename filename_end = begin let out_chan = open_out obj_name in (* selection of the interpreter *) + output_string out_chan ("open Rmllib;;\n"); output_string out_chan ("open "^ !interpreter_impl ^";;\n"); (* the interface *) diff --git a/compiler/main/options.ml b/compiler/main/options.ml index 9b0f91ea..a91468d4 100644 --- a/compiler/main/options.ml +++ b/compiler/main/options.ml @@ -24,60 +24,59 @@ open Rml_misc open Configure -let _ = - let runtime = ref "Lco" in - let v = ref false in - let version = ref false in - let where = ref false in - let stdlib = ref None in - try - Arg.parse - [ "-stdlib", Arg.String (fun s -> stdlib := Some s), doc_stdlib; - "-v", Arg.Set v, doc_v; - "-version", Arg.Set version, doc_version; - "-where", Arg.Set where, doc_where; - "-c",Arg.Set no_link, doc_compilation; - "-I",Arg.String add_include,doc_libraries; - "-s", Arg.String set_simulation_process, doc_simulation; - "-n", Arg.Int set_number_of_instant, doc_number_of_instant; - "-sampling", Arg.Float set_sampling, doc_sampling; - "-i", Arg.Unit set_verbose, doc_verbose; - "-annot", Arg.Unit set_save_types, doc_save_types; - "-dtypes", Arg.Unit set_save_types, doc_save_types; - "-no_reactivity_warning", Arg.Unit unset_reactivity_warning, doc_no_reactivity_warning; - "-dreactivity", Arg.Unit set_dreactivity, doc_dreactivity; - "-no_reactivity_simpl", Arg.Unit unset_no_reactivity_simpl, doc_no_reactivity_simpl; - "-old_loop_warning", Arg.Unit set_old_instantaneous_loop_warning, doc_old_loop_warning; - "-runtime", Arg.Set_string runtime, doc_runtime; - "-thread", Arg.Set with_thread, doc_thread; - "-debug", Arg.Set with_debug, doc_debug; - "-interactive", Arg.Unit set_interactive, doc_interactive; - "-d", Arg.String set_output_dir, doc_d; - "-nostdlib", Arg.Unit set_no_stdlib, doc_no_stdlib; - "-no_nary_opt", Arg.Unit set_no_nary, doc_no_nary; - "-no_static_opt", Arg.Unit set_no_static, doc_no_static; - "-no_for_opt", Arg.Unit set_no_for, doc_no_for; - "-no_const_opt", Arg.Clear const_optimization, doc_no_const_opt; - "-dparse", Arg.Unit set_dparse, doc_dparse; - "-dtime", Arg.Unit set_dtime, doc_dtime; - ] - add_to_compile - errmsg; - set_runtime !runtime; - begin match !stdlib with - | None -> () - | Some s -> set_stdlib s - end; - if !v then show_v (); - if !version then show_version (); - if !where then show_where (); - if !with_thread then add_stdlib_thread (); - with x -> - Rml_errors.report_error Format.err_formatter x; - exit 2 +let set_options () = + let _ = + let runtime = ref "Lco" in + let v = ref false in + let version = ref false in + let where = ref false in + let stdlib = ref None in + try + Arg.parse + [ "-stdlib", Arg.String (fun s -> stdlib := Some s), doc_stdlib; + "-v", Arg.Set v, doc_v; + "-version", Arg.Set version, doc_version; + "-where", Arg.Set where, doc_where; + "-c",Arg.Set no_link, doc_compilation; + "-I",Arg.String add_include,doc_libraries; + "-s", Arg.String set_simulation_process, doc_simulation; + "-n", Arg.Int set_number_of_instant, doc_number_of_instant; + "-sampling", Arg.Float set_sampling, doc_sampling; + "-i", Arg.Unit set_verbose, doc_verbose; + "-annot", Arg.Unit set_save_types, doc_save_types; + "-dtypes", Arg.Unit set_save_types, doc_save_types; + "-no_reactivity_warning", Arg.Unit unset_reactivity_warning, doc_no_reactivity_warning; + "-dreactivity", Arg.Unit set_dreactivity, doc_dreactivity; + "-no_reactivity_simpl", Arg.Unit unset_no_reactivity_simpl, doc_no_reactivity_simpl; + "-old_loop_warning", Arg.Unit set_old_instantaneous_loop_warning, doc_old_loop_warning; + "-runtime", Arg.Set_string runtime, doc_runtime; + "-thread", Arg.Set with_thread, doc_thread; + "-debug", Arg.Set with_debug, doc_debug; + "-interactive", Arg.Unit set_interactive, doc_interactive; + "-d", Arg.String set_output_dir, doc_d; + "-nostdlib", Arg.Unit set_no_stdlib, doc_no_stdlib; + "-no_nary_opt", Arg.Unit set_no_nary, doc_no_nary; + "-no_static_opt", Arg.Unit set_no_static, doc_no_static; + "-no_for_opt", Arg.Unit set_no_for, doc_no_for; + "-no_const_opt", Arg.Clear const_optimization, doc_no_const_opt; + "-dparse", Arg.Unit set_dparse, doc_dparse; + "-dtime", Arg.Unit set_dtime, doc_dtime; + ] + add_to_compile + errmsg; + set_runtime !runtime; + begin match !stdlib with + | None -> () + | Some s -> set_stdlib s + end; + if !v then show_v (); + if !version then show_version (); + if !where then show_where (); + if !with_thread then add_stdlib_thread (); + with x -> + Rml_errors.report_error Format.err_formatter x; + exit 2 -let _ = - to_compile := List.rev !to_compile - -let _ = + in to_compile := List.rev !to_compile; + Printexc.catch configure () diff --git a/compiler/main/rmlc.ml b/compiler/main/rmlc.ml index b5db6fea..072379d4 100644 --- a/compiler/main/rmlc.ml +++ b/compiler/main/rmlc.ml @@ -32,6 +32,8 @@ open Rml_misc open Modules open Compiler +let () = Options.set_options () + (* list of object files passed on the command line *) let object_files = ref [] diff --git a/compiler/parsing/rml_parser.mly b/compiler/parsing/rml_parser.mly index be14c766..f9749288 100644 --- a/compiler/parsing/rml_parser.mly +++ b/compiler/parsing/rml_parser.mly @@ -79,7 +79,7 @@ let mkintf d = let rec mkexpr_until body cfg_when_opt_expr_opt_list = match cfg_when_opt_expr_opt_list with - | [] -> raise Parse_error + | [] -> raise Parsing.Parse_error | _ :: _ -> mkexpr (Pexpr_until (body, cfg_when_opt_expr_opt_list)) @@ -1051,7 +1051,7 @@ simple_core_type: simple_core_type2 { $1} | LPAREN core_type_comma_list RPAREN - { match $2 with [sty] -> sty | _ -> raise Parse_error } + { match $2 with [sty] -> sty | _ -> raise Parsing.Parse_error } simple_core_type2: QUOTE ident diff --git a/configure-tools/dune b/configure-tools/dune new file mode 100644 index 00000000..a5690dd2 --- /dev/null +++ b/configure-tools/dune @@ -0,0 +1,11 @@ +(rule (target rml_asttypes.ml) (action (copy ../compiler/global/rml_asttypes.ml rml_asttypes.ml))) +(rule (target def_modules.ml) (action (copy ../compiler/global/def_modules.ml def_modules.ml))) +(rule (target global.ml) (action (copy ../compiler/global/global.ml global.ml))) +(rule (target global_ident.ml) (action (copy ../compiler/global/global_ident.ml global_ident.ml))) +(rule (target rml_ident.ml) (action (copy ../compiler/global/rml_ident.ml rml_ident.ml))) +(rule (target def_types.ml) (action (copy ../compiler/typing/def_types.ml def_types.ml))) +(rule (target def_static.ml) (action (copy ../compiler/static/def_static.ml def_static.ml))) + + +(executable + (name embedrzi)) \ No newline at end of file diff --git a/configure-tools/embedrzi.ml b/configure-tools/embedrzi.ml index 70c34d61..cf7448de 100755 --- a/configure-tools/embedrzi.ml +++ b/configure-tools/embedrzi.ml @@ -28,9 +28,4 @@ let () = List.iter stdlib_files in let () = Buffer.add_string buf "]" in -let out = open_out_gen - [Open_creat; Open_wronly; Open_trunc] - 0o640 - (basedir // "compiler" // "global" // "rzi.ml") -in -Printf.fprintf out "%s\n" (Buffer.contents buf) +Printf.fprintf Stdlib.stdout "%s\n" (Buffer.contents buf) diff --git a/dune b/dune new file mode 100644 index 00000000..fcb534df --- /dev/null +++ b/dune @@ -0,0 +1,3 @@ +(env + (dev + (flags (:standard -warn-error -A)))) \ No newline at end of file diff --git a/dune-project b/dune-project new file mode 100644 index 00000000..135ee626 --- /dev/null +++ b/dune-project @@ -0,0 +1,4 @@ +(lang dune 2.9.1) +(name rmlc) +(version rml-1.09.8-dev) +(using menhir 2.1) diff --git a/interpreter/dune b/interpreter/dune new file mode 100644 index 00000000..a567777f --- /dev/null +++ b/interpreter/dune @@ -0,0 +1,10 @@ +(library + (name rmllib) + (libraries threads) + (flags (:standard -rectypes)) + (modules_without_implementation lco_interpreter lk_interpreter) + (modules :standard \ lk_threaded thread_implem)) + +(install + (files rmllib.a) + (section lib)) \ No newline at end of file diff --git a/rml.opam b/rml.opam new file mode 100644 index 00000000..15d5fb7c --- /dev/null +++ b/rml.opam @@ -0,0 +1,26 @@ +version: "rml-0.0.06-653-gc4043f8-dirty" +opam-version: "0.0.1" +maintainer: "Louis Mandel " +authors: [ "Louis Mandel " ] +license: "QPL" +dev-repo: "git+https://github.com/reactiveml/rml" +tags: [ "syntax" ] +build: [ + ["./configure" "--prefix" "%{prefix}%"] + [make "-j" jobs] +] + +install: [ + ["dune" "install" "-j" jobs] +] + +depends: [ + "ocaml" {>= "4.13.0"} + "dune" {>= "1.6.3"} + "menhir" +] + +synopsis: "Reactive ML" +description: """ +ReactiveML: a programming language for implementing interactive systems. +""" \ No newline at end of file diff --git a/stdlib/dune b/stdlib/dune new file mode 100644 index 00000000..5ba13ccc --- /dev/null +++ b/stdlib/dune @@ -0,0 +1,35 @@ +(rule (target arg.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c arg.rmli))) +(rule (target buffer.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c buffer.rmli))) +(rule (target complex.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c complex.rmli))) +(rule (target digest.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c digest.rmli))) +(rule (target filename.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c filename.rmli))) +(rule (target format.rzi) (deps stdlib.rzi buffer.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c format.rmli))) +(rule (target gc.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c gc.rmli))) +(rule (target genlex.rzi) (deps stdlib.rzi stream.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c genlex.rmli))) +(rule (target graphics.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c graphics.rmli))) +(rule (target hashtbl.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c hashtbl.rmli))) +(rule (target int32.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c int32.rmli))) +(rule (target int64.rzi) (deps stdlib.rzi nativeint.rzi int32.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c int64.rmli))) +(rule (target lazy.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c lazy.rmli))) +(rule (target lexing.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c lexing.rmli))) +(rule (target list.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c list.rmli))) +(rule (target luc4ocaml_nolbl.rzi) (deps stdlib.rzi luc4ocaml.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c luc4ocaml_nolbl.rmli))) +(rule (target luc4ocaml.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c luc4ocaml.rmli))) +(rule (target marshal.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c marshal.rmli))) +(rule (target nativeint.rzi) (deps stdlib.rzi int32.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c nativeint.rmli))) +(rule (target obj.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c obj.rmli))) +(rule (target parsing.rzi) (deps stdlib.rzi obj.rzi lexing.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c parsing.rmli))) +(rule (target printexc.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c printexc.rmli))) +(rule (target printf.rzi) (deps stdlib.rzi buffer.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c printf.rmli))) +(rule (target queue.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c queue.rmli))) +(rule (target random.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c random.rmli))) +(rule (target sort.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c sort.rmli))) +(rule (target stack.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c stack.rmli))) +(rule (target stream.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c stream.rmli))) +(rule (target string.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c string.rmli))) +(rule (target str.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c str.rmli))) +(rule (target sys.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c sys.rmli))) +(rule (target unix.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c unix.rmli))) +(rule (target weak.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c weak.rmli))) + +(rule (target stdlib.rzi) (deps ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c stdlib.rmli))) diff --git a/toplevel/dune b/toplevel/dune new file mode 100644 index 00000000..140ed37c --- /dev/null +++ b/toplevel/dune @@ -0,0 +1,40 @@ +(rule (target rmltop_machine_body.ml) (action (run ../compiler/rmlc.exe -I ../stdlib -runtime Lco_ctrl_tree rmltop_machine_body.rml))) +(rule (target rmltop_global.rzi) (action (run ../compiler/rmlc.exe -c -I ../stdlib rmltop_global.rmli))) +(rule (target rmltop_reactive_machine.rzi) (deps rmltop_global.rzi) (action (run ../compiler/rmlc.exe -c -I ../stdlib rmltop_reactive_machine.rmli))) +(rule (targets rmltop_controller.ml rmltop_controller.rzi) (deps rmltop_reactive_machine.rzi rmltop_global.rzi) (action (run ../compiler/rmlc.exe -I ../stdlib -runtime Rmltop rmltop_controller.rml))) + +(ocamllex rmltop_lexer) + +(library + (name rmltop_lexer) + (modules rmltop_lexer)) + +(library (name rmltop_global) (modules rmltop_global) (libraries rmllib) (flags (:standard -rectypes))) +(library (name rmltop_machine_body) (modules rmltop_machine_body) (libraries rmllib) (flags (:standard -rectypes))) +(library (name rmltop_implem) (modules rmltop_implem) (libraries rmllib) (flags (:standard -rectypes))) +(library (name rmltop_reactive_machine) (modules rmltop_reactive_machine) (libraries rmltop_machine_body rmltop_global rmllib) (flags (:standard -rectypes))) +(library (name rmltop_controller) (modules rmltop_controller) (libraries rmllib rmltop_reactive_machine rmltop_global rmltop_implem) (flags (:standard -rectypes))) +(library (name rmltop_directives) (modules rmltop_directives) (libraries rmllib rmltop_global) (flags (:standard -rectypes))) + + +(library + (name rmltop_main) + (flags (:standard -rectypes)) + (libraries rmllib rmltop_lexer rmltop_global rmltop_implem rmltop_controller) + (modules rmltop_main)) + + +(executables + (names rmltop) + (flags (:standard -rectypes)) + (libraries rmllib rmltop_main rmltop_lexer) + (modules rmltop)) + +(install + (files rmltop) + (section bin)) + +(install + (files rmltop_global.a rmltop_machine_body.a rmltop_reactive_machine.a + rmltop_controller.a rmltop_lexer.a rmltop_directives.a rmltop_implem.a rmltop_main.a rmltop_global.rzi rmltop_controller.rzi) + (section lib)) diff --git a/toplevel/rmltop_global.ml b/toplevel/rmltop_global.ml index 57378c06..cb9ea138 100644 --- a/toplevel/rmltop_global.ml +++ b/toplevel/rmltop_global.ml @@ -20,6 +20,7 @@ (* file: rmltop_global.ml *) (* author: Louis Mandel *) (* created: 2005-09-23 *) +open Rmllib type 'a rml_process = 'a Implem_lco_ctrl_tree_record.Lco_ctrl_tree_record.process diff --git a/toplevel/rmltop_global.mli b/toplevel/rmltop_global.mli index e833bf8e..9de5eb26 100644 --- a/toplevel/rmltop_global.mli +++ b/toplevel/rmltop_global.mli @@ -20,6 +20,7 @@ (* file: rmltop_global.mli *) (* author: Louis Mandel *) (* created: 2005-09-23 *) +open Rmllib type 'a rml_process = 'a Implem_lco_ctrl_tree_record.Lco_ctrl_tree_record.process diff --git a/toplevel/rmltop_implem.ml b/toplevel/rmltop_implem.ml index 53b42c08..f08d1ca8 100644 --- a/toplevel/rmltop_implem.ml +++ b/toplevel/rmltop_implem.ml @@ -20,6 +20,7 @@ (* file: rmltop_implem.ml *) (* author: Louis Mandel *) (* created: 2005-10-25 *) +open Rmllib module Sig_env (* : S *) = struct diff --git a/toplevel/rmltop_reactive_machine.ml b/toplevel/rmltop_reactive_machine.ml index 3b1d8024..8bb0c064 100644 --- a/toplevel/rmltop_reactive_machine.ml +++ b/toplevel/rmltop_reactive_machine.ml @@ -20,7 +20,7 @@ (* file: rmltop_reactive_machine.ml *) (* created: 2007-12-03 *) (* author: Louis Mandel *) - +open Rmllib;; module Interpretor = Implem_lco_ctrl_tree_record.Lco_ctrl_tree_record let rml_react_unsafe = From 85276ec5e5700167c5c918e5347b93a37960d036 Mon Sep 17 00:00:00 2001 From: Samuel VIVIEN Date: Tue, 4 Jan 2022 13:55:08 +0100 Subject: [PATCH 05/13] corrected rml.opam file --- rml.opam | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rml.opam b/rml.opam index 15d5fb7c..55a1e73f 100644 --- a/rml.opam +++ b/rml.opam @@ -7,7 +7,7 @@ dev-repo: "git+https://github.com/reactiveml/rml" tags: [ "syntax" ] build: [ ["./configure" "--prefix" "%{prefix}%"] - [make "-j" jobs] + ["dune" "build" "-j" jobs] ] install: [ From b9a91242580bd7a97fd200aeb46605290255b1af Mon Sep 17 00:00:00 2001 From: Samuel VIVIEN Date: Tue, 4 Jan 2022 14:03:37 +0100 Subject: [PATCH 06/13] fixed version number --- rml.opam | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rml.opam b/rml.opam index 55a1e73f..a60f476e 100644 --- a/rml.opam +++ b/rml.opam @@ -1,4 +1,4 @@ -version: "rml-0.0.06-653-gc4043f8-dirty" +version: "rml-1.09.08-dev" opam-version: "0.0.1" maintainer: "Louis Mandel " authors: [ "Louis Mandel " ] From f0a39e5a94ab866d62332c8192ccdd2e01f9e92d Mon Sep 17 00:00:00 2001 From: Samuel VIVIEN Date: Tue, 4 Jan 2022 21:52:27 +0100 Subject: [PATCH 07/13] Added a test --- Makefile | 216 ++------------------------------------------ rml.opam | 4 +- test/await.rml | 27 ++++++ test/await_ocaml.ml | 20 ++++ test/dune | 7 ++ test/test.ml | 4 + 6 files changed, 70 insertions(+), 208 deletions(-) create mode 100644 test/await.rml create mode 100644 test/await_ocaml.ml create mode 100644 test/dune create mode 100644 test/test.ml diff --git a/Makefile b/Makefile index c9075409..c2e11940 100644 --- a/Makefile +++ b/Makefile @@ -1,215 +1,17 @@ # Makefile for ReactiveML -# Taken from Lucid-synchrone -# Organization : SPI team, LIP6 laboratory, University Paris 6 -include configure-tools/version -include config +build: + dune build stdlib + RML_RECOMPILE_RZI=0 dune build -all: config-stamp - (cd compiler; touch .depend; $(MAKE) depend; $(MAKE) $(TARGET)) - (cd stdlib; $(MAKE) all) - (cd interpreter; touch .depend; $(MAKE) depend; $(MAKE) all) - (cd toplevel; $(MAKE) all) - (cd tools; $(MAKE) $(TARGET)) +test: build + dune runtest -config-stamp: - ./configure - touch $@ - -toplevel: FORCE - (cd toplevel; $(MAKE) all) - -toplevel-install: - (cd toplevel; $(MAKE) install) - - -opt: TARGET := opt -opt: all - -byte: TARGET := byte -byte: all - -.PHONY: install - -install: - (cd compiler; $(MAKE) install) - (cd stdlib; $(MAKE) install) - (cd interpreter; $(MAKE) install) - (cd man; $(MAKE) install) - (cd emacs; $(MAKE) install) - (cd toplevel; $(MAKE) install) - (cd tools; $(MAKE) install) - -checkinstall: config - checkinstall -D --deldoc=yes --deldesc=yes --nodoc -y --install=no +install: build + dune install uninstall: - (cd compiler; $(MAKE) uninstall) - (cd stdlib; $(MAKE) uninstall) - (cd interpreter; $(MAKE) uninstall) - (cd man; $(MAKE) uninstall) - (cd emacs; $(MAKE) uninstall) - (cd toplevel; $(MAKE) uninstall) - (cd tools; $(MAKE) uninstall) - - -### BEGIN Patch from Serge Leblanc - -install.findlib: - @echo "Install ReactiveML interpreter in ocamlfind hierarchy." - @(echo "version = \"$(VERSION)\"" > ./META) - @(cat ./configure-tools/META.in >> ./META) - - [ ! -e ./rmllib.a ] && \ - ln -s ./interpreter/rmllib.a ./rmllib.a - - [ ! -e ./rmllib.cma ] && \ - ln -s ./interpreter/rmllib.cma ./rmllib.cma - - [ ! -e ./rmllib.cmxa ] && \ - ln -s ./interpreter/rmllib.cmxa ./rmllib.cmxa - - [ -r ./META -a -r ./rmllib.a -a -r ./rmllib.cma -a -r ./rmllib.cmxa ] && \ - ocamlfind install rmlc ./META ./rmllib.a ./rmllib.cma ./rmllib.cmxa - - rm -rf rmllib.a rmllib.cma rmllib.cmxa - -uninstall.findlib: - ocamlfind remove rmlc - -### END - - -doc: dvi -dvi: - (cd doc; $(MAKE) dvi) -html: - (cd doc; $(MAKE) html) - -wc: - (cd compiler;$(MAKE) wc) - (cd interpreter; $(MAKE) wc) - (cd toplevel; $(MAKE) wc) - (cd tools; $(MAKE) wc) + dune uninstall clean: - (cd compiler;$(MAKE) clean) - (cd stdlib; $(MAKE) clean) - (cd interpreter; $(MAKE) clean) - (cd toplevel; $(MAKE) clean) - (cd tools; $(MAKE) clean) - (cd man; $(MAKE) clean) - (cd doc; $(MAKE) clean) - (cd patch; $(MAKE) clean) - (cd examples; $(MAKE) clean) - -realclean: clean-distrib - (cd compiler;$(MAKE) realclean) - (cd stdlib; $(MAKE) realclean) - (cd interpreter; $(MAKE) realclean) - (cd toplevel; $(MAKE) realclean) - (cd tools; $(MAKE) realclean) - (cd man; $(MAKE) realclean) - (cd doc; $(MAKE) realclean) - (cd patch; $(MAKE) realclean) - (cd examples; $(MAKE) realclean) - rm -rf META - rm -rf config config-stamp Makefile.common distrib/rml/rmlc.in distrib/rml/Makefile *~ - touch config - rm -rf configure-tools/rmlbuild.config - -cleanall: realclean - -# Making distribution -DATE=`date "+%Y-%m-%d"` - -public-distrib: - touch config - $(MAKE) realclean - mkdir -p distrib/rml-$(VERSION)-$(DATE) - cp -r compiler interpreter stdlib toplevel tools emacs doc man examples \ - distrib/rml-$(VERSION)-$(DATE) - cp -r configure configure-tools patch Makefile CHANGES INSTALL LICENSE \ - distrib/rml-$(VERSION)-$(DATE) - mkdir -p distrib/rml-$(VERSION)-$(DATE)/distrib - cp -r distrib/rml distrib/Makefile.byte distrib/Makefile.opt \ - distrib/rmlc.in.byte distrib/rmlc.in.opt \ - distrib/rml-$(VERSION)-$(DATE)/distrib - (cd distrib/rml-$(VERSION)-$(DATE)/patch; \ - $(MAKE) public-distrib) - (cd distrib; \ - tar --exclude=CVS --exclude=.svn --exclude=.git -zcvf rml-$(VERSION)-$(DATE).tar.gz rml-$(VERSION)-$(DATE); \ - rm -rf rml-$(VERSION)-$(DATE); \ - mv rml-$(VERSION)-$(DATE).tar.gz ..) - - -source-distrib: - touch config - $(MAKE) realclean - mkdir -p distrib/rml-$(VERSION)-$(DATE) - cp -r compiler interpreter stdlib toplevel tools emacs doc man examples \ - distrib/rml-$(VERSION)-$(DATE) - cp -r configure configure-tools patch Makefile CHANGES INSTALL LICENSE \ - distrib/rml-$(VERSION)-$(DATE) - mkdir -p distrib/rml-$(VERSION)-$(DATE)/distrib - cp -r distrib/rml distrib/Makefile.byte distrib/Makefile.opt \ - distrib/rmlc.in.byte distrib/rmlc.in.opt \ - distrib/rml-$(VERSION)-$(DATE)/distrib - (cd distrib; \ - tar --exclude=CVS --exclude=.svn --exclude=.git -zcvf rml-$(VERSION)-$(DATE).tar.gz rml-$(VERSION)-$(DATE); \ - rm -rf rml-$(VERSION)-$(DATE); \ - mv rml-$(VERSION)-$(DATE).tar.gz ..) - -binary-distrib: binary-distrib.opt - -binary-distrib.opt: clean-distrib - touch config - $(MAKE) realclean - ./configure - (cd compiler; touch .depend; $(MAKE) depend; $(MAKE) opt) - (cd stdlib; $(MAKE) all) - (cd interpreter; $(MAKE) all) - (cd toplevel; $(MAKE) all) - (cd tools; $(MAKE) opt) - (cd distrib/rml/; \ - mkdir bin lib lib/rml; \ - cp ../../compiler/rmlc.opt bin/rmlc.opt ; \ - cp ../../toplevel/rmltop bin/rmltop ; \ - cp ../../stdlib/*.rzi ../../stdlib/*.rmli lib/rml ; \ - cp ../../interpreter/*.cma ../../interpreter/*.cmxa ../../interpreter/*.a ../../interpreter/*.cmi lib/rml ; \ - cp ../../toplevel/*.cmo ../../toplevel/*.cmi lib/rml ; \ - cp ../../tools/rmldep/rmldep.opt bin/rmldep ; \ - cp -r ../../emacs . ; \ - cp ../Makefile.opt Makefile; \ - cp ../rmlc.in.opt rmlc.in; \ - cd ..; \ - tar --exclude=CVS --exclude=.svn --exclude=.git -zcvf rml-`../compiler/rmlc -version`.opt.tar.gz rml; \ - mv rml-`../compiler/rmlc -version`.opt.tar.gz ..) - -binary-distrib.byte: clean-distrib - touch config - $(MAKE) realclean - ./configure - (cd compiler; touch .depend; $(MAKE) depend; $(MAKE) byte) - (cd stdlib; $(MAKE) all) - (cd interpreter; $(MAKE) all) - (cd toplevel; $(MAKE) all) - (cd tools; $(MAKE) all) - (cd distrib/rml/ ; \ - mkdir bin lib lib/rml ; \ - cp ../../compiler/rmlc.byte bin/rmlc.byte ; \ - cp ../../toplevel/rmltop bin/rmltop ; \ - cp ../../stdlib/*.rzi ../../stdlib/*.rmli lib/rml ; \ - cp ../../interpreter/*.cma ../../interpreter/*.cmxa ../../interpreter/*.a ../../interpreter/*.cmi lib/rml ; \ - cp ../../toplevel/*.cmo ../../toplevel/*.cmi lib/rml ; \ - cp ../../tools/rmldep/rmldep.byte bin/rmldep ; \ - cp -r ../../emacs . ; \ - cp ../Makefile.byte Makefile ; \ - cp ../rmlc.in.byte rmlc.in ; \ - cd ..; tar --exclude=CVS --exclude=.svn --exclude=.git -zcvf rml-`../compiler/rmlc -version`.byte.tar.gz rml ; \ - mv rml-`../compiler/rmlc -version`.byte.tar.gz ..) - -clean-distrib: - rm -rf distrib/rml/bin \ - distrib/rml/lib \ - distrib/rml/emacs \ - distrib/rml/man - - rm -f rml-`./compiler/rmlc -version`.*.tar.gz - rm -f rml-$(VERSION)-????-??-??.tar.gz - -FORCE: + dune clean diff --git a/rml.opam b/rml.opam index a60f476e..224b5069 100644 --- a/rml.opam +++ b/rml.opam @@ -7,7 +7,8 @@ dev-repo: "git+https://github.com/reactiveml/rml" tags: [ "syntax" ] build: [ ["./configure" "--prefix" "%{prefix}%"] - ["dune" "build" "-j" jobs] + ["make" "-j" jobs] + ["dune" "test" "-j" jobs] {with-test} ] install: [ @@ -18,6 +19,7 @@ depends: [ "ocaml" {>= "4.13.0"} "dune" {>= "1.6.3"} "menhir" + "alcotest" {with-test} ] synopsis: "Reactive ML" diff --git a/test/await.rml b/test/await.rml new file mode 100644 index 00000000..287afc01 --- /dev/null +++ b/test/await.rml @@ -0,0 +1,27 @@ + +let ratio = 1000000 + +signal s default 0 gather fun x y -> x + y;; +signal s2 default 1 gather fun x y -> x * y;; +signal s3 default (0, 0) gather fun x _ -> x;; +signal s4 default [] gather fun x y -> x :: y;; + +let process spam n = + for i = 1 to n dopar + emit s i; + emit s2 i; + pause; + emit s (i * 2); + done + +let process catch p = + (* Here, both s3 and s4 won't ever be present (never emitted) but it shows the macro works :tm: *) + await ((s(i1) /\ s2(i2)) \/ s3((i1, i2)) \/ s4([i1; i2])) when (i1 + i2 >= 0) in + await s(i3) in + p := (i1 * ratio * ratio + i2 * ratio + i3) + + +let process compare n = + let p = ref 0 in + let () = run (spam n) || run (catch p) + in !p \ No newline at end of file diff --git a/test/await_ocaml.ml b/test/await_ocaml.ml new file mode 100644 index 00000000..52c0b6ec --- /dev/null +++ b/test/await_ocaml.ml @@ -0,0 +1,20 @@ + +open Rmllib +open Implem_lco_ctrl_tree_record +let run p = + Rml_machine.rml_exec ([]) + (fun () -> Lco_ctrl_tree_record.rml_run (function | () -> p ) ) + +let compute_n_seq n = + let rec fac n = if n < 2 then 1 else n * fac (n - 1) in + let n2 = ((n + 1) * n) / 2 in + Await.ratio * Await.ratio * n2 + Await.ratio * (fac n) + (2 * n2) + + let compute_n n = run (Await.compare n) + + let test_await () = + Alcotest.(check int) "await_when 1" (compute_n_seq 10) (compute_n 10) + + let test_set = [ + ("await_when", `Quick, test_await) + ] \ No newline at end of file diff --git a/test/dune b/test/dune new file mode 100644 index 00000000..c22d0048 --- /dev/null +++ b/test/dune @@ -0,0 +1,7 @@ +(rule (target await.ml) (deps (file await.rml)) (action (run ../compiler/rmlc.exe await.rml))) + + +(test + (name test) + (libraries alcotest rmllib) + (flags (:standard -rectypes))) \ No newline at end of file diff --git a/test/test.ml b/test/test.ml new file mode 100644 index 00000000..def7ff7c --- /dev/null +++ b/test/test.ml @@ -0,0 +1,4 @@ +let () = + Alcotest.run "Rml ppx" [ + ("Await_rml", Await_ocaml.test_set); + ] \ No newline at end of file From 7adfa46fbcede7057f122483f2b2e00ccc151e7f Mon Sep 17 00:00:00 2001 From: Samuel VIVIEN Date: Wed, 5 Jan 2022 09:16:13 +0100 Subject: [PATCH 08/13] corrected parser location detection as ocamlyacc was changed to menhir --- compiler/parsing/location.ml | 14 +- compiler/parsing/rml_parser.mly | 537 ++++++++++++++++---------------- test/dune | 2 +- 3 files changed, 283 insertions(+), 270 deletions(-) diff --git a/compiler/parsing/location.ml b/compiler/parsing/location.ml index 02b326c3..9ce2dd78 100644 --- a/compiler/parsing/location.ml +++ b/compiler/parsing/location.ml @@ -67,7 +67,7 @@ let curr lexbuf = { loc_end = lexbuf.lex_curr_p; loc_ghost = false };; - +(* let symbol_rloc () = { loc_start = Parsing.symbol_start_pos (); loc_end = Parsing.symbol_end_pos (); @@ -84,6 +84,18 @@ let rhs_loc n = { loc_start = Parsing.rhs_start_pos n; loc_end = Parsing.rhs_end_pos n; loc_ghost = false; +};;*) + +let loc_of_pos (ps, pe) = { + loc_start = ps; + loc_end = pe; + loc_ghost = false; +};; + +let gloc_of_pos (ps, pe) = { + loc_start = ps; + loc_end = pe; + loc_ghost = true; };; let input_name = ref "" diff --git a/compiler/parsing/rml_parser.mly b/compiler/parsing/rml_parser.mly index f9749288..09a6bf19 100644 --- a/compiler/parsing/rml_parser.mly +++ b/compiler/parsing/rml_parser.mly @@ -48,47 +48,48 @@ open Rml_asttypes open Parse_ident open Parse_ast -let mkident id pos = +let mkident id (ps, pe) = { pident_id = id; - pident_loc = rhs_loc pos; } + pident_loc = loc_of_pos (ps, pe) } + let mkident_loc id loc = { pident_id = id; pident_loc = loc; } let mksimple id pos = { psimple_id = id; - psimple_loc = rhs_loc pos; } -let mksimple_loc id loc = + psimple_loc = loc_of_pos pos; } +let _mksimple_loc id loc = { psimple_id = id; psimple_loc = loc; } -let mkte d = - { pte_desc = d; pte_loc = symbol_rloc() } -let mkpatt d = - { ppatt_desc = d; ppatt_loc = symbol_rloc() } -let mkexpr d = +let mkte d loc = + { pte_desc = d; pte_loc = loc_of_pos loc } +let mkpatt d loc = + { ppatt_desc = d; ppatt_loc = loc_of_pos loc } +let mkexpr d loc = { pexpr_desc = d; - pexpr_loc = symbol_rloc(); } -let mkconf d = + pexpr_loc = loc_of_pos loc; } +let mkconf d loc = { pconf_desc = d; - pconf_loc = symbol_rloc(); } -let mkimpl d = - { pimpl_desc = d; pimpl_loc = symbol_rloc() } -let mkintf d = - { pintf_desc = d; pintf_loc = symbol_rloc() } + pconf_loc = loc_of_pos loc; } +let mkimpl d loc = + { pimpl_desc = d; pimpl_loc = loc_of_pos loc } +let mkintf d loc = + { pintf_desc = d; pintf_loc = loc_of_pos loc } -let rec mkexpr_until body cfg_when_opt_expr_opt_list = +let mkexpr_until body cfg_when_opt_expr_opt_list loc = match cfg_when_opt_expr_opt_list with | [] -> raise Parsing.Parse_error | _ :: _ -> - mkexpr (Pexpr_until (body, cfg_when_opt_expr_opt_list)) + mkexpr (Pexpr_until (body, cfg_when_opt_expr_opt_list)) loc -let reloc_patt x = { x with ppatt_loc = symbol_rloc () };; -let reloc_expr x = { x with pexpr_loc = symbol_rloc () };; +let reloc_patt x loc = { x with ppatt_loc = loc_of_pos loc };; +let reloc_expr x loc = { x with pexpr_loc = loc_of_pos loc };; let mkoperator name pos = { pexpr_desc = Pexpr_ident (mkident (Pident name) pos); - pexpr_loc = rhs_loc pos; } + pexpr_loc = loc_of_pos pos; } (* @@ -108,35 +109,35 @@ let mkoperator name pos = AST node, then the location must be real; in all other cases, it must be ghost. *) -let ghexpr d = { pexpr_desc = d; - pexpr_loc = symbol_gloc (); };; -let ghpatt d = { ppatt_desc = d; ppatt_loc = symbol_gloc () };; -let ghte d = { pte_desc = d; pte_loc = symbol_gloc () };; -let ghimpl d = { pimpl_desc = d; pimpl_loc = symbol_gloc () };; +let ghexpr d loc = { pexpr_desc = d; + pexpr_loc = gloc_of_pos loc; };; +let ghpatt d loc = { ppatt_desc = d; ppatt_loc = gloc_of_pos loc };; +let _ghte d loc = { pte_desc = d; pte_loc = gloc_of_pos loc };; +let ghimpl d loc = { pimpl_desc = d; pimpl_loc = loc };; -let ghexpr_unit () = ghexpr (Pexpr_constant(Const_unit)) +let ghexpr_unit loc = ghexpr (Pexpr_constant(Const_unit)) loc let mkassert e = mkexpr (Pexpr_assert (e)) ;; -let mkinfix arg1 name arg2 = - mkexpr(Pexpr_apply(mkoperator name 2, [arg1; arg2])) +let mkinfix arg1 name arg2 pos = + mkexpr(Pexpr_apply(mkoperator name pos, [arg1; arg2])) pos -let mkuminus name arg = +let mkuminus name arg pos1 = match name, arg.pexpr_desc with | "-", Pexpr_constant(Const_int n) -> mkexpr(Pexpr_constant(Const_int(-n))) | _, Pexpr_constant(Const_float f) -> mkexpr(Pexpr_constant(Const_float(-. f))) | _ -> - mkexpr(Pexpr_apply(mkoperator ("~" ^ name) 1, [arg])) + mkexpr(Pexpr_apply(mkoperator ("~" ^ name) pos1, [arg])) -let rec mktailexpr = function +let rec mktailexpr loc = function [] -> - ghexpr(Pexpr_construct( mkident_loc (Pident "[]") none, None)) + ghexpr(Pexpr_construct( mkident_loc (Pident "[]") none, None)) loc | e1 :: el -> - let exp_el = mktailexpr el in + let exp_el = mktailexpr loc el in let l = {loc_start = e1.pexpr_loc.loc_start; loc_end = exp_el.pexpr_loc.loc_end; loc_ghost = true} @@ -148,11 +149,11 @@ let rec mktailexpr = function Some arg); pexpr_loc = l;} -let rec mktailpatt = function +let rec mktailpatt loc = function [] -> - ghpatt(Ppatt_construct(mkident_loc (Pident "[]") none, None)) + ghpatt(Ppatt_construct(mkident_loc (Pident "[]") none, None)) loc | p1 :: pl -> - let pat_pl = mktailpatt pl in + let pat_pl = mktailpatt loc pl in let l = {loc_start = p1.ppatt_loc.loc_start; loc_end = pat_pl.ppatt_loc.loc_end; loc_ghost = true} @@ -165,22 +166,22 @@ let rec mktailpatt = function let array_function str name = mkident_loc (Pdot(str, name)) none -let rec deep_mkrangepatt c1 c2 = - if c1 = c2 then ghpatt(Ppatt_constant(Const_char c1)) else - ghpatt(Ppatt_or(ghpatt(Ppatt_constant(Const_char c1)), - deep_mkrangepatt (Char.chr(Char.code c1 + 1)) c2)) +let rec deep_mkrangepatt c1 c2 loc = + if c1 = c2 then ghpatt(Ppatt_constant(Const_char c1)) loc else + ghpatt(Ppatt_or(ghpatt(Ppatt_constant(Const_char c1)) loc, + deep_mkrangepatt (Char.chr(Char.code c1 + 1)) c2 loc)) loc -let rec mkrangepatt c1 c2 = - if c1 > c2 then mkrangepatt c2 c1 else - if c1 = c2 then mkpatt(Ppatt_constant(Const_char c1)) else - reloc_patt (deep_mkrangepatt c1 c2) +let rec mkrangepatt c1 c2 loc = + if c1 > c2 then mkrangepatt c2 c1 loc else + if c1 = c2 then mkpatt (Ppatt_constant(Const_char c1)) loc else + reloc_patt (deep_mkrangepatt c1 c2 loc) loc let syntax_error () = raise Rml_syntaxerr.Escape_error -let unclosed opening_name opening_num closing_name closing_num = - raise(Rml_syntaxerr.Error(Rml_syntaxerr.Unclosed(rhs_loc opening_num, opening_name, - rhs_loc closing_num, closing_name))) +let unclosed opening_name opening_loc closing_name closing_loc = + raise(Rml_syntaxerr.Error(Rml_syntaxerr.Unclosed(loc_of_pos opening_loc, opening_name, + loc_of_pos closing_loc, closing_name))) %} @@ -410,7 +411,7 @@ interface: interactive: /* empty */ { exit 0 } | interactive_defs { $1 } - | seq_expr SEMISEMI { [ghimpl (Pimpl_expr $1)] } + | seq_expr SEMISEMI { [ghimpl (Pimpl_expr $1) (gloc_of_pos $loc)] } ; interactive_defs: structure_item SEMISEMI { [$1] } @@ -421,40 +422,40 @@ interactive_defs: structure: structure_tail { $1 } - | seq_expr structure_tail { ghimpl (Pimpl_expr $1) :: $2 } + | seq_expr structure_tail { ghimpl (Pimpl_expr $1) ($1).pexpr_loc :: $2 } ; structure_tail: /* empty */ { [] } | SEMISEMI { [] } - | SEMISEMI seq_expr structure_tail { ghimpl (Pimpl_expr $2) :: $3 } + | SEMISEMI seq_expr structure_tail { ghimpl (Pimpl_expr $2) ($2).pexpr_loc :: $3 } | SEMISEMI structure_item structure_tail { $2 :: $3 } | structure_item structure_tail { $1 :: $2 } ; structure_item: LET rec_flag let_bindings { match $3 with - [{ppatt_desc = Ppatt_any}, exp] -> mkimpl(Pimpl_expr exp) - | _ -> mkimpl(Pimpl_let($2, List.rev $3)) } + [{ppatt_desc = Ppatt_any; _}, exp] -> mkimpl(Pimpl_expr exp) $loc + | _ -> mkimpl(Pimpl_let($2, List.rev $3)) $loc } | SIGNAL signal_comma_list - { mkimpl(Pimpl_signal(List.rev $2, None)) } + { mkimpl(Pimpl_signal(List.rev $2, None)) $loc } | SIGNAL signal_comma_list DEFAULT par_expr GATHER par_expr - { mkimpl(Pimpl_signal(List.rev $2, Some(Default, $4, $6))) } + { mkimpl(Pimpl_signal(List.rev $2, Some(Default, $4, $6))) $loc } | SIGNAL signal_comma_list MEMORY par_expr GATHER par_expr - { mkimpl(Pimpl_signal(List.rev $2, Some(Memory, $4, $6))) } + { mkimpl(Pimpl_signal(List.rev $2, Some(Memory, $4, $6))) $loc } | TYPE type_declarations - { mkimpl(Pimpl_type(List.rev $2)) } + { mkimpl(Pimpl_type(List.rev $2)) $loc } | EXCEPTION UIDENT constructor_arguments - { mkimpl(Pimpl_exn(mksimple $2 2, $3)) } + { mkimpl(Pimpl_exn(mksimple $2 ($startpos($2), $endpos($2)), $3)) $loc } | EXCEPTION UIDENT EQUAL constr_longident - { mkimpl(Pimpl_exn_rebind(mksimple $2 2, $4)) } + { mkimpl(Pimpl_exn_rebind(mksimple $2 ($startpos($2), $endpos($2)), $4)) $loc } | OPEN UIDENT - { mkimpl(Pimpl_open $2) } + { mkimpl(Pimpl_open $2) $loc } | EXTERNAL DOT LIDENT LIDENT lucky_declarations lucky_declarations EQUAL lucky_files { match $3 with | "luc" -> - mkimpl(Pimpl_lucky(mksimple $4 4, List.rev $5, List.rev $6, $8)) - | _ -> raise (Rml_syntaxerr.Error(Rml_syntaxerr.Other (rhs_loc 1))) + mkimpl(Pimpl_lucky(mksimple $4 ($startpos($4), $endpos($4)), List.rev $5, List.rev $6, $8)) $loc + | _ -> raise (Rml_syntaxerr.Error(Rml_syntaxerr.Other (loc_of_pos ($startpos($1), $endpos($1))))) } ; @@ -467,218 +468,218 @@ signature: ; signature_item: VAL val_ident_colon core_type - { mkintf(Pintf_val($2, $3)) } + { mkintf(Pintf_val($2, $3)) $loc } | EXTERNAL val_ident_colon core_type EQUAL primitive_declaration - { mkintf(Pintf_val($2, $3)) } + { mkintf(Pintf_val($2, $3)) $loc } | TYPE type_declarations - { mkintf(Pintf_type(List.rev $2)) } + { mkintf(Pintf_type(List.rev $2)) $loc } | EXCEPTION UIDENT constructor_arguments - { mkintf(Pintf_exn(mksimple $2 2, $3)) } + { mkintf(Pintf_exn(mksimple $2 ($startpos($2), $endpos($2)), $3)) $loc } | OPEN UIDENT - { mkintf(Pintf_open $2) } + { mkintf(Pintf_open $2) $loc } ; /* Core expressions */ par_expr: | seq_expr %prec below_BARBAR { $1} - | seq_expr BARBAR par_expr { mkexpr(Pexpr_par($1, $3)) } - | seq_expr BARGRATER par_expr { mkexpr(Pexpr_merge($1, $3)) } + | seq_expr BARBAR par_expr { mkexpr(Pexpr_par($1, $3)) $loc } + | seq_expr BARGRATER par_expr { mkexpr(Pexpr_merge($1, $3)) $loc } ; seq_expr: | expr %prec below_SEMI { $1 } - | expr SEMI { reloc_expr $1 } - | expr SEMI seq_expr { mkexpr(Pexpr_seq($1, $3)) } + | expr SEMI { reloc_expr $1 $loc } + | expr SEMI seq_expr { mkexpr(Pexpr_seq($1, $3)) $loc } ; expr: simple_expr %prec below_SHARP { $1 } | simple_expr simple_expr_list - { mkexpr(Pexpr_apply($1, List.rev $2)) } + { mkexpr(Pexpr_apply($1, List.rev $2)) $loc } | LET rec_flag let_bindings IN par_expr - { mkexpr(Pexpr_let($2, List.rev $3, $5)) } + { mkexpr(Pexpr_let($2, List.rev $3, $5)) $loc } | FUNCTION opt_bar match_cases - { mkexpr(Pexpr_function(List.rev $3)) } + { mkexpr(Pexpr_function(List.rev $3)) $loc } | FUN simple_pattern fun_def { let when_opt, expr = $3 in - mkexpr(Pexpr_function([$2, when_opt, expr])) } + mkexpr(Pexpr_function([$2, when_opt, expr])) $loc } | MATCH par_expr WITH opt_bar match_cases - { mkexpr(Pexpr_match($2, List.rev $5)) } + { mkexpr(Pexpr_match($2, List.rev $5)) $loc } | TRY par_expr WITH opt_bar match_cases - { mkexpr(Pexpr_trywith($2, List.rev $5)) } + { mkexpr(Pexpr_trywith($2, List.rev $5)) $loc } | TRY par_expr WITH error { syntax_error() } | expr_comma_list %prec below_COMMA - { mkexpr(Pexpr_tuple(List.rev $1)) } + { mkexpr(Pexpr_tuple(List.rev $1)) $loc } | constr_longident simple_expr %prec prec_constr_appl /*%prec below_SHARP */ - { mkexpr(Pexpr_construct($1, Some $2)) } + { mkexpr(Pexpr_construct($1, Some $2)) $loc } | IF par_expr THEN expr ELSE expr - { mkexpr(Pexpr_ifthenelse($2, $4, Some $6)) } + { mkexpr(Pexpr_ifthenelse($2, $4, Some $6)) $loc } | IF par_expr THEN expr - { mkexpr(Pexpr_ifthenelse($2, $4, None)) } + { mkexpr(Pexpr_ifthenelse($2, $4, None)) $loc } | WHILE par_expr DO par_expr DONE - { mkexpr(Pexpr_while($2, $4)) } + { mkexpr(Pexpr_while($2, $4)) $loc } | FOR val_ident EQUAL par_expr direction_flag par_expr DO par_expr DONE - { mkexpr(Pexpr_for($2, $4, $6, $5, $8)) } + { mkexpr(Pexpr_for($2, $4, $6, $5, $8)) $loc } | FOR val_ident EQUAL par_expr direction_flag par_expr DOPAR par_expr DONE - { mkexpr(Pexpr_fordopar($2, $4, $6, $5, $8)) } + { mkexpr(Pexpr_fordopar($2, $4, $6, $5, $8)) $loc } | expr COLONCOLON expr - { mkexpr(Pexpr_construct(mkident (Pident "::") 2, - Some(ghexpr(Pexpr_tuple[$1;$3])))) } + { mkexpr(Pexpr_construct(mkident (Pident "::") ($startpos($2), $endpos($2)), + Some(ghexpr(Pexpr_tuple[$1;$3]) $loc))) $loc } | expr INFIXOP0 expr - { mkinfix $1 $2 $3 } + { mkinfix $1 $2 $3 $loc } | expr INFIXOP1 expr - { mkinfix $1 $2 $3 } + { mkinfix $1 $2 $3 $loc } | expr INFIXOP2 expr - { mkinfix $1 $2 $3 } + { mkinfix $1 $2 $3 $loc } | expr INFIXOP3 expr - { mkinfix $1 $2 $3 } + { mkinfix $1 $2 $3 $loc } | expr INFIXOP4 expr - { mkinfix $1 $2 $3 } + { mkinfix $1 $2 $3 $loc } | expr PLUS expr - { mkinfix $1 "+" $3 } + { mkinfix $1 "+" $3 $loc } | expr MINUS expr - { mkinfix $1 "-" $3 } + { mkinfix $1 "-" $3 $loc } | expr MINUSDOT expr - { mkinfix $1 "-." $3 } + { mkinfix $1 "-." $3 $loc } | expr STAR expr - { mkinfix $1 "*" $3 } + { mkinfix $1 "*" $3 $loc } | expr EQUAL expr - { mkinfix $1 "=" $3 } + { mkinfix $1 "=" $3 $loc } | expr LESS expr - { mkinfix $1 "<" $3 } + { mkinfix $1 "<" $3 $loc } | expr GREATER expr - { mkinfix $1 ">" $3 } + { mkinfix $1 ">" $3 $loc } | expr OR expr - { mkinfix $1 "or" $3 } + { mkinfix $1 "or" $3 $loc } | expr AMPERSAND expr - { mkinfix $1 "&" $3 } + { mkinfix $1 "&" $3 $loc } | expr AMPERAMPER expr - { mkinfix $1 "&&" $3 } + { mkinfix $1 "&&" $3 $loc } | expr COLONEQUAL expr - { mkinfix $1 ":=" $3 } + { mkinfix $1 ":=" $3 $loc } | subtractive expr %prec prec_unary_minus - { mkuminus $1 $2 } + { mkuminus $1 $2 ($startpos($1), $endpos($1)) $loc } | simple_expr DOT label_longident LESSMINUS expr - { mkexpr(Pexpr_record_update($1, $3, $5)) } + { mkexpr(Pexpr_record_update($1, $3, $5)) $loc } | simple_expr DOT LPAREN par_expr RPAREN LESSMINUS expr - { mkexpr(Pexpr_apply(ghexpr(Pexpr_ident(array_function "Array" "set")), - [$1; $4; $7])) } + { mkexpr(Pexpr_apply(ghexpr(Pexpr_ident(array_function "Array" "set")) $loc, + [$1; $4; $7])) $loc } | simple_expr DOT LBRACKET par_expr RBRACKET LESSMINUS expr - { mkexpr(Pexpr_apply(ghexpr(Pexpr_ident(array_function "String" "set")), - [$1; $4; $7])) } + { mkexpr(Pexpr_apply(ghexpr(Pexpr_ident(array_function "String" "set")) $loc, + [$1; $4; $7])) $loc } | ASSERT simple_expr %prec below_SHARP - { mkassert $2 } + { mkassert $2 $loc } | PRE pre_expr - { let k,s = $2 in mkexpr(Pexpr_pre (k,s)) } + { let k,s = $2 in mkexpr(Pexpr_pre (k,s)) $loc } | LAST QUESTION simple_expr - { mkexpr(Pexpr_last $3) } + { mkexpr(Pexpr_last $3) $loc } | DEFAULT QUESTION simple_expr - { mkexpr(Pexpr_default $3) } + { mkexpr(Pexpr_default $3) $loc } | EMIT simple_expr - { mkexpr(Pexpr_emit $2 ) } + { mkexpr(Pexpr_emit $2 ) $loc } | EMIT simple_expr simple_expr - { mkexpr(Pexpr_emit_val($2, $3)) } + { mkexpr(Pexpr_emit_val($2, $3)) $loc } | SIGNAL signal_comma_list IN par_expr - { mkexpr(Pexpr_signal(List.rev $2, None, $4)) } + { mkexpr(Pexpr_signal(List.rev $2, None, $4)) $loc } | SIGNAL signal_comma_list DEFAULT par_expr GATHER par_expr IN par_expr - { mkexpr(Pexpr_signal(List.rev $2, Some(Default, $4, $6), $8)) } + { mkexpr(Pexpr_signal(List.rev $2, Some(Default, $4, $6), $8)) $loc } | SIGNAL signal_comma_list MEMORY par_expr GATHER par_expr IN par_expr - { mkexpr(Pexpr_signal(List.rev $2, Some(Memory, $4, $6), $8)) } + { mkexpr(Pexpr_signal(List.rev $2, Some(Memory, $4, $6), $8)) $loc } | DO par_expr UNTIL opt_bar until_cases DONE - { mkexpr_until $2 $5 } + { mkexpr_until $2 $5 $loc } | DO par_expr WHEN event_config DONE - { mkexpr(Pexpr_when($4, $2)) } + { mkexpr(Pexpr_when($4, $2)) $loc } | CONTROL par_expr WITH event_config DONE - { mkexpr(Pexpr_control($4, None, $2)) } + { mkexpr(Pexpr_control($4, None, $2)) $loc } | CONTROL par_expr WITH event_config WHEN par_expr DONE - { mkexpr(Pexpr_control($4, Some $6, $2)) } + { mkexpr(Pexpr_control($4, Some $6, $2)) $loc } | PRESENT event_config THEN expr ELSE expr - { mkexpr(Pexpr_present($2, $4, $6)) } + { mkexpr(Pexpr_present($2, $4, $6)) $loc } | PRESENT event_config THEN expr - { mkexpr(Pexpr_present($2, $4, ghexpr(Pexpr_nothing))) } + { mkexpr(Pexpr_present($2, $4, ghexpr(Pexpr_nothing) $loc)) $loc } | PRESENT event_config ELSE expr - { mkexpr(Pexpr_present($2, ghexpr(Pexpr_nothing), $4)) } + { mkexpr(Pexpr_present($2, ghexpr(Pexpr_nothing) $loc, $4)) $loc } | AWAIT await_flag event_config %prec above_IN { if (snd $2) = One - then raise(Rml_syntaxerr.Error(Rml_syntaxerr.Other (rhs_loc 2))) - else mkexpr(Pexpr_await(fst $2, $3)) } + then raise(Rml_syntaxerr.Error(Rml_syntaxerr.Other (loc_of_pos ($startpos($2), $endpos($2))))) + else mkexpr(Pexpr_await(fst $2, $3)) $loc } | AWAIT await_flag event_config IN par_expr { match $2 with - | Immediate, All -> raise(Rml_syntaxerr.Error(Rml_syntaxerr.Other (rhs_loc 2))) - | im, k -> mkexpr(Pexpr_await_val(im, k, $3, None, $5)) } + | Immediate, All -> raise(Rml_syntaxerr.Error(Rml_syntaxerr.Other (loc_of_pos ($startpos($2), $endpos($2))))) + | im, k -> mkexpr(Pexpr_await_val(im, k, $3, None, $5)) $loc } | AWAIT await_flag event_config WHEN par_expr IN par_expr { match $2 with - | Immediate, All -> raise(Rml_syntaxerr.Error(Rml_syntaxerr.Other (rhs_loc 2))) + | Immediate, All -> raise(Rml_syntaxerr.Error(Rml_syntaxerr.Other (loc_of_pos ($startpos($2), $endpos($2))))) | im, k -> - mkexpr(Pexpr_await_val(im, k, $3, Some $5, $7)) } + mkexpr(Pexpr_await_val(im, k, $3, Some $5, $7)) $loc } | PROCESS proc_def { $2 } | PROC simple_pattern proc_fun_def - { mkexpr(Pexpr_function([$2, None, $3])) } + { mkexpr(Pexpr_function([$2, None, $3])) $loc } | RUN simple_expr simple_expr_list - { let e = mkexpr(Pexpr_apply($2, List.rev $3)) in - mkexpr(Pexpr_run(e)) } + { let e = mkexpr(Pexpr_apply($2, List.rev $3)) $loc in + mkexpr(Pexpr_run(e)) $loc } | RUN simple_expr - { mkexpr(Pexpr_run($2)) } + { mkexpr(Pexpr_run($2)) $loc } ; simple_expr: val_longident - { mkexpr(Pexpr_ident $1) } + { mkexpr(Pexpr_ident $1) $loc } | constant - { mkexpr(Pexpr_constant $1) } + { mkexpr(Pexpr_constant $1) $loc } | constr_longident %prec prec_constant_constructor - { mkexpr(Pexpr_construct($1, None)) } + { mkexpr(Pexpr_construct($1, None)) $loc } | LPAREN par_expr RPAREN - { reloc_expr $2 } + { reloc_expr $2 $loc } | LPAREN par_expr error - { unclosed "(" 1 ")" 3 } + { unclosed "(" ($startpos($1), $endpos($1)) ")" ($startpos($3), $endpos($3)) } | BEGIN par_expr END - { reloc_expr $2 } + { reloc_expr $2 $loc } | BEGIN END - { mkexpr (Pexpr_constant Const_unit) } + { mkexpr (Pexpr_constant Const_unit) $loc } | BEGIN par_expr error - { unclosed "begin" 1 "end" 3 } + { unclosed "begin" ($startpos($1), $endpos($1)) "end" ($startpos($3), $endpos($3)) } | LPAREN par_expr type_constraint RPAREN - { mkexpr(Pexpr_constraint($2, $3)) } + { mkexpr(Pexpr_constraint($2, $3)) $loc } | simple_expr DOT label_longident - { mkexpr(Pexpr_record_access($1, $3)) } + { mkexpr(Pexpr_record_access($1, $3)) $loc } | simple_expr DOT LPAREN par_expr RPAREN - { mkexpr(Pexpr_apply(ghexpr(Pexpr_ident(array_function "Array" "get")), - [$1; $4])) } + { mkexpr(Pexpr_apply(ghexpr(Pexpr_ident(array_function "Array" "get")) $loc, + [$1; $4])) $loc } | simple_expr DOT LPAREN par_expr error - { unclosed "(" 3 ")" 5 } + { unclosed "(" ($startpos($3), $endpos($3)) ")" ($startpos($5), $endpos($5)) } | simple_expr DOT LBRACKET par_expr RBRACKET - { mkexpr(Pexpr_apply(ghexpr(Pexpr_ident(array_function "String" "get")), - [$1; $4])) } + { mkexpr(Pexpr_apply(ghexpr(Pexpr_ident(array_function "String" "get")) $loc, + [$1; $4])) $loc } | simple_expr DOT LBRACKET par_expr error - { unclosed "[" 3 "]" 5 } + { unclosed "[" ($startpos($3), $endpos($3)) "]" ($startpos($5), $endpos($5)) } | LBRACE record_expr RBRACE - { mkexpr(Pexpr_record($2)) } + { mkexpr(Pexpr_record($2)) $loc } | LBRACE record_expr error - { unclosed "{" 1 "}" 5 } + { unclosed "{" ($startpos($1), $endpos($1)) "}" ($startpos($3), $endpos($3)) } | LBRACE simple_expr WITH record_expr RBRACE - { mkexpr(Pexpr_record_with ($2, $4)) } + { mkexpr(Pexpr_record_with ($2, $4)) $loc } | LBRACKETBAR expr_semi_list opt_semi BARRBRACKET - { mkexpr(Pexpr_array(List.rev $2)) } + { mkexpr(Pexpr_array(List.rev $2)) $loc } | LBRACKETBAR expr_semi_list opt_semi error - { unclosed "[|" 1 "|]" 4 } + { unclosed "[|" ($startpos($1), $endpos($1)) "|]" ($startpos($4), $endpos($4)) } | LBRACKETBAR BARRBRACKET - { mkexpr(Pexpr_array []) } + { mkexpr(Pexpr_array []) $loc } | LBRACKET expr_semi_list opt_semi RBRACKET - { reloc_expr (mktailexpr (List.rev $2)) } + { reloc_expr (mktailexpr $loc (List.rev $2)) $loc } | LBRACKET expr_semi_list opt_semi error - { unclosed "[" 1 "]" 4 } + { unclosed "[" ($startpos($1), $endpos($1)) "]" ($startpos($4), $endpos($4)) } | PREFIXOP simple_expr - { mkexpr(Pexpr_apply(mkoperator $1 1, [$2])) } + { mkexpr(Pexpr_apply(mkoperator $1 ($startpos($1), $endpos($1)), [$2])) $loc } | NOTHING - { mkexpr Pexpr_nothing } + { mkexpr Pexpr_nothing $loc } | PAUSE - { mkexpr Pexpr_pause } + { mkexpr Pexpr_pause $loc } | HALT - { mkexpr Pexpr_halt } + { mkexpr Pexpr_halt $loc } | LOOP par_expr END - { mkexpr (Pexpr_loop $2) } + { mkexpr (Pexpr_loop $2) $loc } | SHARP ident { match $2 with | "suspend" -> @@ -686,8 +687,8 @@ simple_expr: (Pexpr_apply (mkexpr (Pexpr_ident (mkident (Pdot("Rmltop_controller", - "set_suspend")) 2)), - [mkexpr (Pexpr_constant Const_unit)])) + "set_suspend")) ($startpos($2), $endpos($2)))) $loc, + [mkexpr (Pexpr_constant Const_unit) $loc])) $loc (* !!!!!!!!!! mkexpr (Pexpr_seq @@ -699,59 +700,59 @@ simple_expr: [mkexpr (Pexpr_constant Const_unit)])), mkexpr Pexpr_pause)) !!!!!!!!!! *) - | _ -> raise (Rml_syntaxerr.Error(Rml_syntaxerr.Other (rhs_loc 2))) } + | _ -> raise (Rml_syntaxerr.Error(Rml_syntaxerr.Other (loc_of_pos ($startpos($2), $endpos($2))))) } ; very_simple_expr: /* simple_expr without "LPAREN expr RPAREN" */ val_longident - { mkexpr(Pexpr_ident $1) } + { mkexpr(Pexpr_ident $1) $loc } | constant - { mkexpr(Pexpr_constant $1) } + { mkexpr(Pexpr_constant $1) $loc } | constr_longident %prec prec_constant_constructor - { mkexpr(Pexpr_construct($1, None)) } + { mkexpr(Pexpr_construct($1, None)) $loc } | BEGIN par_expr END - { reloc_expr $2 } + { reloc_expr $2 $loc } | BEGIN END - { mkexpr (Pexpr_constant Const_unit) } + { mkexpr (Pexpr_constant Const_unit) $loc } | BEGIN par_expr error - { unclosed "begin" 1 "end" 3 } + { unclosed "begin" ($startpos($1), $endpos($1)) "end" ($startpos($3), $endpos($3)) } | very_simple_expr DOT label_longident - { mkexpr(Pexpr_record_access($1, $3)) } + { mkexpr(Pexpr_record_access($1, $3)) $loc } | very_simple_expr DOT LPAREN par_expr RPAREN - { mkexpr(Pexpr_apply(ghexpr(Pexpr_ident(array_function "Array" "get")), - [$1; $4])) } + { mkexpr(Pexpr_apply(ghexpr(Pexpr_ident(array_function "Array" "get")) $loc, + [$1; $4])) $loc } | very_simple_expr DOT LPAREN par_expr error - { unclosed "(" 3 ")" 5 } + { unclosed "(" ($startpos($3), $endpos($3)) ")" ($startpos($5), $endpos($5)) } | very_simple_expr DOT LBRACKET par_expr RBRACKET - { mkexpr(Pexpr_apply(ghexpr(Pexpr_ident(array_function "String" "get")), - [$1; $4])) } + { mkexpr(Pexpr_apply(ghexpr(Pexpr_ident(array_function "String" "get")) $loc, + [$1; $4])) $loc } | very_simple_expr DOT LBRACKET par_expr error - { unclosed "[" 3 "]" 5 } + { unclosed "[" ($startpos($3), $endpos($3)) "]" ($startpos($5), $endpos($5)) } | LBRACE record_expr RBRACE - { mkexpr(Pexpr_record($2)) } + { mkexpr(Pexpr_record($2)) $loc } | LBRACE record_expr error - { unclosed "{" 1 "}" 5 } + { unclosed "{" ($startpos($1), $endpos($1)) "}" ($startpos($3), $endpos($3)) } | LBRACE simple_expr WITH record_expr RBRACE - { mkexpr(Pexpr_record_with ($2, $4)) } + { mkexpr(Pexpr_record_with ($2, $4)) $loc } | LBRACKETBAR expr_semi_list opt_semi BARRBRACKET - { mkexpr(Pexpr_array(List.rev $2)) } + { mkexpr(Pexpr_array(List.rev $2)) $loc } | LBRACKETBAR expr_semi_list opt_semi error - { unclosed "[|" 1 "|]" 4 } + { unclosed "[|" ($startpos($1), $endpos($1)) "|]" ($startpos($4), $endpos($4)) } | LBRACKETBAR BARRBRACKET - { mkexpr(Pexpr_array []) } + { mkexpr(Pexpr_array []) $loc } | LBRACKET expr_semi_list opt_semi RBRACKET - { reloc_expr (mktailexpr (List.rev $2)) } + { reloc_expr (mktailexpr $loc (List.rev $2)) $loc } | LBRACKET expr_semi_list opt_semi error - { unclosed "[" 1 "]" 4 } + { unclosed "[" ($startpos($1), $endpos($1)) "]" ($startpos($4), $endpos($4)) } | PREFIXOP simple_expr - { mkexpr(Pexpr_apply(mkoperator $1 1, [$2])) } + { mkexpr(Pexpr_apply(mkoperator $1 ($startpos($1), $endpos($1)), [$2])) $loc } | NOTHING - { mkexpr Pexpr_nothing } + { mkexpr Pexpr_nothing $loc } | PAUSE - { mkexpr Pexpr_pause } + { mkexpr Pexpr_pause $loc } | HALT - { mkexpr Pexpr_halt } + { mkexpr Pexpr_halt $loc } | LOOP par_expr END - { mkexpr (Pexpr_loop $2) } + { mkexpr (Pexpr_loop $2) $loc } | SHARP ident { match $2 with | "suspend" -> @@ -759,8 +760,8 @@ very_simple_expr: /* simple_expr without "LPAREN expr RPAREN" */ (Pexpr_apply (mkexpr (Pexpr_ident (mkident (Pdot("Rmltop_controller", - "set_suspend")) 2)), - [mkexpr (Pexpr_constant Const_unit)])) + "set_suspend")) ($startpos($2), $endpos($2)))) $loc, + [mkexpr (Pexpr_constant Const_unit) $loc])) $loc (* !!!!!!!!!! mkexpr (Pexpr_seq @@ -772,7 +773,7 @@ very_simple_expr: /* simple_expr without "LPAREN expr RPAREN" */ [mkexpr (Pexpr_constant Const_unit)])), mkexpr Pexpr_pause)) !!!!!!!!!! *) - | _ -> raise (Rml_syntaxerr.Error(Rml_syntaxerr.Other (rhs_loc 2))) } + | _ -> raise (Rml_syntaxerr.Error(Rml_syntaxerr.Other (loc_of_pos ($startpos($2), $endpos($2))))) } ; pre_expr: simple_expr @@ -782,17 +783,17 @@ pre_expr: ; event_config: very_simple_expr %prec below_LPAREN - { mkconf(Pconf_present($1, None))} + { mkconf(Pconf_present($1, None)) $loc } | very_simple_expr LPAREN pattern RPAREN - { mkconf(Pconf_present($1, Some $3))} + { mkconf(Pconf_present($1, Some $3)) $loc } | event_config BACKSLASHSLASH event_config - { mkconf(Pconf_or($1,$3)) } + { mkconf(Pconf_or($1,$3)) $loc } | event_config SLASHBACKSLASH event_config - { mkconf(Pconf_and($1,$3)) } + { mkconf(Pconf_and($1,$3)) $loc } | LPAREN event_config RPAREN { $2 } | LPAREN event_config error - { unclosed "(" 1 ")" 3 } + { unclosed "(" ($startpos($1), $endpos($1)) ")" ($startpos($3), $endpos($3)) } ; simple_expr_list: simple_expr @@ -805,41 +806,41 @@ let_bindings: | let_bindings AND let_binding { $3 :: $1 } /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ | val_longident LESS pattern GREATER - { [$3, { pexpr_desc = Pexpr_get (mkexpr(Pexpr_ident $1)); - pexpr_loc = rhs_loc 1; }] } + { [$3, { pexpr_desc = Pexpr_get (mkexpr(Pexpr_ident $1) $loc); + pexpr_loc = loc_of_pos ($startpos($1), $endpos($1)); }] } /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ ; let_binding: val_ident fun_binding - { ({ppatt_desc = Ppatt_var $1; ppatt_loc = rhs_loc 1}, $2) } + { ({ppatt_desc = Ppatt_var $1; ppatt_loc = loc_of_pos ($startpos($1), $endpos($1))}, $2) } | pattern EQUAL par_expr { ($1, $3) } | PROCESS val_ident proc_binding - { ({ppatt_desc = Ppatt_var $2; ppatt_loc = rhs_loc 2}, $3) } + { ({ppatt_desc = Ppatt_var $2; ppatt_loc = loc_of_pos ($startpos($2), $endpos($2))}, $3) } ; fun_binding: strict_binding { $1 } | type_constraint EQUAL par_expr - { ghexpr(Pexpr_constraint($3, $1)) } + { ghexpr(Pexpr_constraint($3, $1)) $loc } ; strict_binding: EQUAL par_expr { $2 } | simple_pattern fun_binding - { ghexpr(Pexpr_function([$1, None, $2])) } + { ghexpr(Pexpr_function([$1, None, $2])) $loc } ; proc_binding: strict_proc_binding { $1 } | type_constraint EQUAL par_expr - { ghexpr(Pexpr_constraint(ghexpr(Pexpr_process($3)), $1)) } + { ghexpr(Pexpr_constraint(ghexpr(Pexpr_process($3)) $loc, $1)) $loc } ; strict_proc_binding: EQUAL par_expr - { ghexpr(Pexpr_process($2)) } + { ghexpr(Pexpr_process($2)) $loc } | simple_pattern proc_binding - { ghexpr(Pexpr_function([$1, None, $2])) } + { ghexpr(Pexpr_function([$1, None, $2])) $loc } ; match_cases: pattern match_action @@ -853,15 +854,15 @@ fun_def: match_action { $1 } | simple_pattern fun_def { let when_opt, expr = $2 in - when_opt, ghexpr(Pexpr_function([$1, None, expr])) } + when_opt, ghexpr(Pexpr_function([$1, None, expr])) $loc } ; proc_fun_def: - MINUSGREATER par_expr { mkexpr (Pexpr_process $2) } + MINUSGREATER par_expr { mkexpr (Pexpr_process $2) $loc } | simple_pattern proc_fun_def - { ghexpr(Pexpr_function([$1, None, $2])) } + { ghexpr(Pexpr_function([$1, None, $2])) $loc } ; proc_def: - simple_expr { mkexpr(Pexpr_process $1) } + simple_expr { mkexpr(Pexpr_process $1) $loc } /* MINUSGREATER par_expr { mkexpr(Pexpr_process $2) } | simple_pattern proc_def @@ -874,7 +875,7 @@ match_action: ; until_action: MINUSGREATER par_expr { None, $2 } - | WHEN par_expr { Some $2, ghexpr_unit() } + | WHEN par_expr { Some $2, ghexpr_unit $loc } | WHEN par_expr MINUSGREATER par_expr { Some $2, $4 } ; expr_comma_list: @@ -918,50 +919,50 @@ pattern: simple_pattern { $1 } | pattern AS val_ident - { mkpatt(Ppatt_alias($1, $3)) } + { mkpatt(Ppatt_alias($1, $3)) $loc } | pattern_comma_list %prec below_COMMA - { mkpatt(Ppatt_tuple(List.rev $1)) } + { mkpatt(Ppatt_tuple(List.rev $1)) $loc } | constr_longident pattern %prec prec_constr_appl - { mkpatt(Ppatt_construct($1, Some $2)) } + { mkpatt(Ppatt_construct($1, Some $2)) $loc } | pattern COLONCOLON pattern - { mkpatt(Ppatt_construct(mkident (Pident "::") 2, - Some(ghpatt(Ppatt_tuple[$1;$3])))) } + { mkpatt(Ppatt_construct(mkident (Pident "::") ($startpos($2), $endpos($2)), + Some(ghpatt(Ppatt_tuple[$1;$3]) $loc))) $loc } | pattern BAR pattern - { mkpatt(Ppatt_or($1, $3)) } + { mkpatt(Ppatt_or($1, $3)) $loc } ; simple_pattern: val_ident %prec below_EQUAL - { mkpatt(Ppatt_var $1) } + { mkpatt(Ppatt_var $1) $loc } | UNDERSCORE - { mkpatt(Ppatt_any) } + { mkpatt(Ppatt_any) $loc } | signed_constant - { mkpatt(Ppatt_constant $1) } + { mkpatt(Ppatt_constant $1) $loc } | CHAR DOTDOT CHAR - { mkrangepatt $1 $3 } + { mkrangepatt $1 $3 $loc } | constr_longident - { mkpatt(Ppatt_construct($1, None)) } + { mkpatt(Ppatt_construct($1, None)) $loc } | LBRACE lbl_pattern_list opt_semi RBRACE - { mkpatt(Ppatt_record(List.rev $2)) } + { mkpatt(Ppatt_record(List.rev $2)) $loc } | LBRACE lbl_pattern_list opt_semi error - { unclosed "{" 1 "}" 4 } + { unclosed "{" ($startpos($1), $endpos($1)) "}" ($startpos($4), $endpos($4)) } | LBRACKET pattern_semi_list opt_semi RBRACKET - { reloc_patt (mktailpatt (List.rev $2)) } + { reloc_patt (mktailpatt $loc (List.rev $2)) $loc } | LBRACKET pattern_semi_list opt_semi error - { unclosed "[" 1 "]" 4 } + { unclosed "[" ($startpos($1), $endpos($1)) "]" ($startpos($4), $endpos($4)) } | LBRACKETBAR pattern_semi_list opt_semi BARRBRACKET - { mkpatt(Ppatt_array(List.rev $2)) } + { mkpatt(Ppatt_array(List.rev $2)) $loc } | LBRACKETBAR BARRBRACKET - { mkpatt(Ppatt_array []) } + { mkpatt(Ppatt_array []) $loc } | LBRACKETBAR pattern_semi_list opt_semi error - { unclosed "[|" 1 "|]" 4 } + { unclosed "[|" ($startpos($1), $endpos($1)) "|]" ($startpos($4), $endpos($4)) } | LPAREN pattern RPAREN - { reloc_patt $2 } + { reloc_patt $2 $loc } | LPAREN pattern error - { unclosed "(" 1 ")" 3 } + { unclosed "(" ($startpos($1), $endpos($1)) ")" ($startpos($3), $endpos($3)) } | LPAREN pattern COLON core_type RPAREN - { mkpatt(Ppatt_constraint($2, $4)) } + { mkpatt(Ppatt_constraint($2, $4)) $loc } | LPAREN pattern COLON core_type error - { unclosed "(" 1 ")" 5 } + { unclosed "(" ($startpos($1), $endpos($1)) ")" ($startpos($5), $endpos($5)) } ; pattern_comma_list: @@ -993,7 +994,7 @@ type_declarations: type_declaration: type_parameters LIDENT type_kind - { (mksimple $2 2, $1, $3) } + { (mksimple $2 ($startpos($2), $endpos($2)), $1, $3) } ; type_kind: /*empty*/ @@ -1044,7 +1045,7 @@ core_type: simple_core_type_or_tuple { $1 } | core_type MINUSGREATER core_type - { mkte(Ptype_arrow($1, $3)) } + { mkte(Ptype_arrow($1, $3)) $loc } ; simple_core_type: @@ -1055,24 +1056,24 @@ simple_core_type: simple_core_type2: QUOTE ident - { mkte(Ptype_var $2) } + { mkte(Ptype_var $2) $loc } | type_longident - { mkte(Ptype_constr($1, [])) } + { mkte(Ptype_constr($1, [])) $loc } | simple_core_type2 type_longident - { mkte(Ptype_constr($2, [$1])) } + { mkte(Ptype_constr($2, [$1])) $loc } | LPAREN core_type_comma_list RPAREN type_longident - { mkte(Ptype_constr($4, List.rev $2)) } + { mkte(Ptype_constr($4, List.rev $2)) $loc } | simple_core_type PROCESS - { mkte(Ptype_process ($1, Def_static.Dontknow)) } + { mkte(Ptype_process ($1, Def_static.Dontknow)) $loc } | simple_core_type PROCESS PLUS - { mkte(Ptype_process ($1, Def_static.Noninstantaneous)) } + { mkte(Ptype_process ($1, Def_static.Noninstantaneous)) $loc } | simple_core_type PROCESS MINUS - { mkte(Ptype_process ($1, Def_static.Instantaneous)) } + { mkte(Ptype_process ($1, Def_static.Instantaneous)) $loc } ; simple_core_type_or_tuple: simple_core_type { $1 } | simple_core_type STAR core_type_list - { mkte(Ptype_tuple($1 :: List.rev $3)) } + { mkte(Ptype_tuple($1 :: List.rev $3)) $loc } ; core_type_comma_list: core_type { [$1] } @@ -1083,7 +1084,7 @@ core_type_list: | core_type_list STAR simple_core_type { $3 :: $1 } ; label: - LIDENT { mksimple $1 1 } + LIDENT { mksimple $1 ($startpos($1), $endpos($1)) } ; /* Constants */ @@ -1110,13 +1111,13 @@ ident: | LIDENT { $1 } ; val_ident: - LIDENT { mksimple $1 1 } - | LPAREN operator RPAREN { mksimple $2 2 } + LIDENT { mksimple $1 ($startpos($1), $endpos($1)) } + | LPAREN operator RPAREN { mksimple $2 ($startpos($2), $endpos($2)) } ; val_ident_colon: - LIDENT COLON { mksimple $1 1 } - | LPAREN operator RPAREN COLON { mksimple $2 2 } - | LABEL { mksimple $1 1 } + LIDENT COLON { mksimple $1 ($startpos($1), $endpos($1)) } + | LPAREN operator RPAREN COLON { mksimple $2 ($startpos($2), $endpos($2)) } + | LABEL { mksimple $1 ($startpos($1), $endpos($1)) } ; operator: PREFIXOP { $1 } @@ -1138,43 +1139,43 @@ operator: | COLONEQUAL { ":=" } ; constr_ident: - UIDENT { mksimple $1 1 } + UIDENT { mksimple $1 ($startpos($1), $endpos($1)) } /* | LBRACKET RBRACKET { "[]" } */ - | COLONCOLON { mksimple "::" 1 } + | COLONCOLON { mksimple "::" ($startpos($1), $endpos($1)) } ; val_longident: val_ident - { mkident (Pident $1.psimple_id) 1 } + { mkident (Pident $1.psimple_id) ($startpos($1), $endpos($1)) } | UIDENT DOT val_ident - { mkident_loc (Pdot($1, $3.psimple_id)) (symbol_rloc()) } + { mkident (Pdot($1, $3.psimple_id)) $loc } ; constr_longident: UIDENT %prec below_DOT - { mkident (Pident $1) 1 } + { mkident (Pident $1) ($startpos($1), $endpos($1)) } | UIDENT DOT UIDENT - { mkident_loc (Pdot($1, $3)) (symbol_rloc()) } + { mkident (Pdot($1, $3)) $loc } | LBRACKET RBRACKET - { mkident_loc (Pident "[]") (symbol_rloc()) } + { mkident (Pident "[]") $loc } ; label_longident: LIDENT - { mkident (Pident $1) 1 } + { mkident (Pident $1)($startpos($1), $endpos($1)) } | UIDENT DOT LIDENT - { mkident_loc (Pdot($1, $3)) (symbol_rloc()) } + { mkident (Pdot($1, $3)) $loc } ; type_longident: LIDENT - { mkident (Pident $1) 1 } + { mkident (Pident $1) ($startpos($1), $endpos($1)) } | UIDENT DOT LIDENT - { mkident_loc (Pdot($1, $3)) (symbol_rloc()) } + { mkident (Pdot($1, $3)) $loc } ; /* Signals */ signal_decl: - LIDENT { (mksimple $1 1, None) } + LIDENT { (mksimple $1 ($startpos($1), $endpos($1)), None) } | LIDENT COLON core_type - { (mksimple $1 1, Some $3) } + { (mksimple $1 ($startpos($1), $endpos($1)), Some $3) } ; signal_comma_list: signal_decl { [$1] } @@ -1240,15 +1241,15 @@ lucky_declaration: lucky_label COLON core_type { ($1, $3) } ; lucky_label: - LIDENT { mksimple $1 1 } - | UIDENT { mksimple $1 1 } + LIDENT { mksimple $1 ($startpos($1), $endpos($1)) } + | UIDENT { mksimple $1 ($startpos($1), $endpos($1)) } ; /* string list */ lucky_files: | LBRACKET string_semi_list opt_semi RBRACKET { List.rev $2 } | LBRACKET string_semi_list opt_semi error - { unclosed "[" 1 "]" 4 } + { unclosed "[" ($startpos($1), $endpos($1)) "]" ($startpos($4), $endpos($4)) } ; string_semi_list: constant diff --git a/test/dune b/test/dune index c22d0048..7ef8ac60 100644 --- a/test/dune +++ b/test/dune @@ -1,4 +1,4 @@ -(rule (target await.ml) (deps (file await.rml)) (action (run ../compiler/rmlc.exe await.rml))) +(rule (target await.ml) (deps (file await.rml) ../compiler/rmlc.exe) (action (run ../compiler/rmlc.exe await.rml))) (test From d6838e8ee31d3b5f9ec4c78f0c60cc143cb563b7 Mon Sep 17 00:00:00 2001 From: Samuel VIVIEN Date: Thu, 6 Jan 2022 15:39:53 +0100 Subject: [PATCH 09/13] Removed tests from the default build sequence --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c2e11940..5bf548e7 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ build: dune build stdlib - RML_RECOMPILE_RZI=0 dune build + RML_RECOMPILE_RZI=0 dune build compiler tools interpreter toplevel test: build dune runtest From 106cd06551d4068662cd1e1c0e27c5514d4312e1 Mon Sep 17 00:00:00 2001 From: Constantin Gierczak--Galle Date: Sat, 8 Jan 2022 12:51:01 +0000 Subject: [PATCH 10/13] Add dune rule for camlinternalBigarray --- stdlib/dune | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/dune b/stdlib/dune index 5ba13ccc..f1f01f6f 100644 --- a/stdlib/dune +++ b/stdlib/dune @@ -1,5 +1,6 @@ (rule (target arg.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c arg.rmli))) (rule (target buffer.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c buffer.rmli))) +(rule (target camlinternalBigarray.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c camlinternalBigarray.rmli))) (rule (target complex.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c complex.rmli))) (rule (target digest.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c digest.rmli))) (rule (target filename.rzi) (deps stdlib.rzi ../compiler/rmlc.exe) (mode (promote (until-clean))) (action (run ../compiler/rmlc.exe -c filename.rmli))) From 1eb682760a366567df825ce1dcc56d869022f3be Mon Sep 17 00:00:00 2001 From: Samuel VIVIEN Date: Sat, 8 Jan 2022 13:59:22 +0100 Subject: [PATCH 11/13] corrected errors around linenum.mll and version.ml files --- Makefile | 4 ++++ compiler/dune | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5bf548e7..dc521588 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ # Makefile for ReactiveML build: + echo "(* This file is generated *)" > compiler/global/version.ml + echo "let version = \"$(VERSION)\"" >> compiler/global/version.ml + echo "let stdlib = \"$(LIBDIR)\"" >> compiler/global/version.ml dune build stdlib RML_RECOMPILE_RZI=0 dune build compiler tools interpreter toplevel @@ -14,4 +17,5 @@ uninstall: dune uninstall clean: + rm -f compiler/global/version.ml dune clean diff --git a/compiler/dune b/compiler/dune index 93233cdb..8baf2e1c 100644 --- a/compiler/dune +++ b/compiler/dune @@ -36,7 +36,7 @@ (rule (target rml_syntaxerr.ml) (action (copy parsing/rml_syntaxerr.ml rml_syntaxerr.ml))) (rule (target parse_printer.ml) (action (copy parsing/parse_printer.ml parse_printer.ml))) (rule (target location.ml) (action (copy parsing/location.ml location.ml))) -(rule (target linenum.ml) (action (copy parsing/linenum.ml linenum.ml))) +(rule (target linenum.mll) (action (copy parsing/linenum.mll linenum.mll))) (rule (target rml_parse.ml) (action (copy parsing/rml_parse.ml rml_parse.ml))) (rule (target rml_parser.mly) (action (copy parsing/rml_parser.mly rml_parser.mly))) (rule (target rml_lexer.mll) (action (copy parsing/rml_lexer.mll rml_lexer.mll))) @@ -73,7 +73,7 @@ (rule (target lucky_errors.ml) (action (copy external/lucky_errors.ml lucky_errors.ml))) (ocamllex - (modules rml_lexer)) + (modules rml_lexer linenum)) (menhir (modules rml_parser)) From dac860345664b0e06613103a91e198b53dc70929 Mon Sep 17 00:00:00 2001 From: Samuel VIVIEN Date: Sat, 15 Jan 2022 09:27:06 +0100 Subject: [PATCH 12/13] changed minimal compiler version --- rml.opam | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rml.opam b/rml.opam index 224b5069..503e7db3 100644 --- a/rml.opam +++ b/rml.opam @@ -16,7 +16,7 @@ install: [ ] depends: [ - "ocaml" {>= "4.13.0"} + "ocaml" {>= "4.09.0"} "dune" {>= "1.6.3"} "menhir" "alcotest" {with-test} @@ -25,4 +25,4 @@ depends: [ synopsis: "Reactive ML" description: """ ReactiveML: a programming language for implementing interactive systems. -""" \ No newline at end of file +""" From 853ae6ee0b897b0aca40a11e657526ca5e3f624d Mon Sep 17 00:00:00 2001 From: Samuel VIVIEN Date: Sun, 16 Jan 2022 12:15:59 +0100 Subject: [PATCH 13/13] corrected errors in rml_parse.ml and Makefile --- Makefile | 2 ++ compiler/parsing/rml_parse.ml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index dc521588..296b4e91 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ # Makefile for ReactiveML +include config + build: echo "(* This file is generated *)" > compiler/global/version.ml echo "let version = \"$(VERSION)\"" >> compiler/global/version.ml diff --git a/compiler/parsing/rml_parse.ml b/compiler/parsing/rml_parse.ml index 964167be..1df861bf 100644 --- a/compiler/parsing/rml_parse.ml +++ b/compiler/parsing/rml_parse.ml @@ -79,7 +79,7 @@ let wrap parsing_fun lexbuf = | Rml_syntaxerr.Error _ as err -> if !Location.input_name = "" then maybe_skip_phrase lexbuf; raise err - | Parsing.Parse_error | Rml_syntaxerr.Escape_error -> + | Parsing.Parse_error | Rml_parser.Error | Rml_syntaxerr.Escape_error -> let loc = Location.curr lexbuf in if !Location.input_name = "" then maybe_skip_phrase lexbuf;