diff --git a/.gitignore b/.gitignore index f95d7f0a..b7ac9e97 100644 --- a/.gitignore +++ b/.gitignore @@ -33,10 +33,10 @@ 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/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/Makefile b/Makefile index c9075409..5bf548e7 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 compiler tools interpreter toplevel -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/compiler/.depend b/compiler/.depend index 7d6e3821..8fba2f76 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,57 +5,59 @@ 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 + 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/misc.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/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 \ + global/rml_ident.cmo \ parsing/parse_ident.cmo \ - global/misc.cmo \ - global/ident.cmo \ global/global_ident.cmo \ global/global.cmo \ typing/def_types.cmo \ global/def_modules.cmo global/modules.cmx : \ global/rzi.cmx \ + global/rml_misc.cmx \ + global/rml_ident.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_ident.cmo : +global/rml_ident.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 : \ @@ -69,16 +69,6 @@ global/version.cmo : global/version.cmx : global/warnings.cmo : global/warnings.cmx : -parsing/lexer.cmo : \ - global/warnings.cmo \ - parsing/parser.cmi \ - global/misc.cmo \ - parsing/location.cmo -parsing/lexer.cmx : \ - global/warnings.cmx \ - parsing/parser.cmx \ - global/misc.cmx \ - parsing/location.cmx parsing/linenum.cmo : parsing/linenum.cmx : parsing/location.cmo : \ @@ -87,61 +77,71 @@ parsing/location.cmo : \ parsing/location.cmx : \ global/warnings.cmx \ parsing/linenum.cmx -parsing/parse.cmo : \ - parsing/syntaxerr.cmo \ - parsing/parser.cmi \ - parsing/location.cmo \ - parsing/lexer.cmo -parsing/parse.cmx : \ - parsing/syntaxerr.cmx \ - parsing/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 : \ - parsing/syntaxerr.cmo \ + 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/rml_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/syntaxerr.cmx \ + parsing/rml_parser.cmi +parsing/rml_parser.cmx : \ + parsing/rml_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/rml_syntaxerr.cmo : \ parsing/location.cmo -parsing/syntaxerr.cmx : \ +parsing/rml_syntaxerr.cmx : \ parsing/location.cmx external/external.cmo : \ parsing/parse_ast.cmo \ @@ -150,515 +150,516 @@ 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_ident.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_ident.cmx \ + global/rml_asttypes.cmx \ reac/reac_ast.cmx \ - global/misc.cmx \ - global/ident.cmx \ - typing/def_types.cmx \ - global/asttypes.cmx -typing/types.cmo : \ + typing/def_types.cmx +typing/rml_types.cmo : \ + global/rml_misc.cmo \ + global/rml_ident.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 : \ +typing/rml_types.cmx : \ + global/rml_misc.cmx \ + global/rml_ident.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_ident.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_ident.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 \ + 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 \ - global/misc.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 \ - global/asttypes.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 \ - global/misc.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 \ - global/asttypes.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 \ - global/misc.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 \ - 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_ident.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_ident.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 -reac/annot.cmo : \ - typing/types_printer.cmo \ - static/static_printer.cmo \ - typing/reactivity_effects.cmo \ - reac/reac_ast.cmo \ - global/misc.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 \ - 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 + parsing/location.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 \ + typing/rml_types.cmo \ + global/rml_misc.cmo \ + global/rml_ident.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 \ + typing/rml_types.cmx \ + global/rml_misc.cmx \ + global/rml_ident.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_ident.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_ident.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 \ + 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/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 \ + 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/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 +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 \ - global/asttypes.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 \ - 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_ident.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_ident.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_ident.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_ident.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_ident.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_ident.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/ident.cmo \ + global/rml_misc.cmo \ + global/rml_ident.cmo \ + global/rml_asttypes.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/ident.cmx \ + global/rml_misc.cmx \ + global/rml_ident.cmx \ + global/rml_asttypes.cmx \ caml/caml_misc.cmx \ - caml/caml_ast.cmx \ - global/asttypes.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 \ - global/asttypes.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 \ - global/asttypes.cmx + typing/def_types.cmx caml/caml_misc.cmo : \ + global/rml_misc.cmo \ + global/rml_ident.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_ident.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_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 \ - global/asttypes.cmo + caml/caml_ast.cmo caml/lk2caml.cmx : \ - global/misc.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 \ - global/asttypes.cmx + caml/caml_ast.cmx caml/print_caml_src.cmo : \ - global/misc.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 \ - global/asttypes.cmo + caml/caml_ast.cmo caml/print_caml_src.cmx : \ - global/misc.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 \ - global/asttypes.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 \ 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 \ + typing/rml_types.cmx \ + global/rml_asttypes.cmx \ reac/reac_misc.cmx \ reac/reac_ast.cmx \ parsing/parse_ident.cmx \ @@ -677,24 +678,28 @@ 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 : \ + 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 \ @@ -703,25 +708,25 @@ main/compiler.cmo : \ parsing/parse_printer.cmo \ parsing/parse_ident.cmo \ reac/parse2reac.cmo \ - parsing/parse.cmo \ global/modules.cmo \ - global/misc.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 \ @@ -730,78 +735,73 @@ main/compiler.cmx : \ parsing/parse_printer.cmx \ parsing/parse_ident.cmx \ reac/parse2reac.cmx \ - parsing/parse.cmx \ global/modules.cmx \ - global/misc.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/misc.cmo + global/rml_misc.cmo main/configure.cmx : \ global/version.cmx \ - global/misc.cmx -main/errors.cmo : \ - global/warnings.cmo \ - parsing/syntaxerr.cmo \ - global/misc.cmo \ - parsing/location.cmo \ - parsing/lexer.cmo -main/errors.cmx : \ - global/warnings.cmx \ - parsing/syntaxerr.cmx \ - global/misc.cmx \ - parsing/location.cmx \ - parsing/lexer.cmx + global/rml_misc.cmx main/interactive.cmo : \ - parsing/parse.cmo \ + parsing/rml_parse.cmo \ + global/rml_misc.cmo \ + parsing/rml_lexer.cmo \ + main/rml_errors.cmo \ global/modules.cmo \ - global/misc.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/parse.cmx \ + parsing/rml_parse.cmx \ + global/rml_misc.cmx \ + parsing/rml_lexer.cmx \ + main/rml_errors.cmx \ global/modules.cmx \ - global/misc.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 : \ +main/options.cmo : \ + global/rml_misc.cmo \ + main/rml_errors.cmo \ + main/configure.cmo +main/options.cmx : \ + global/rml_misc.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 +main/rmlc.cmo : \ + global/rml_misc.cmo \ + main/rml_errors.cmo \ global/modules.cmo \ - global/misc.cmo \ main/interactive.cmo \ - main/errors.cmo \ main/compiler.cmo -main/main.cmx : \ +main/rmlc.cmx : \ + global/rml_misc.cmx \ + main/rml_errors.cmx \ global/modules.cmx \ - global/misc.cmx \ main/interactive.cmx \ - main/errors.cmx \ main/compiler.cmx -main/options.cmo : \ - global/misc.cmo \ - main/errors.cmo \ - main/configure.cmo -main/options.cmx : \ - global/misc.cmx \ - main/errors.cmx \ - main/configure.cmx diff --git a/compiler/Makefile b/compiler/Makefile index a9cbecf8..27323f58 100644 --- a/compiler/Makefile +++ b/compiler/Makefile @@ -3,27 +3,27 @@ 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/rml_ident.ml \ global/initialization.ml \ - global/misc.ml \ + global/rml_misc.ml \ global/modules.ml \ global/def_modules.ml \ global/rzi.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/parser.mly \ - parsing/syntaxerr.ml \ + parsing/rml_parser.mly \ + 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,20 +73,20 @@ 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 \ + main/rmlc.ml \ SRC = $(GLOBAL) $(PARSING) $(REAC) $(TYPING) $(OTHER_ANALYSIS) $(EXTERNAL) $(STATIC) $(LCO) $(LK) $(CAML) $(MAIN) OBJ = global/version.cmo \ - global/asttypes.cmo \ + global/rml_asttypes.cmo \ global/warnings.cmo \ parsing/linenum.cmo \ parsing/location.cmo \ - global/misc.cmo \ - global/ident.cmo \ + global/rml_misc.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/parser.cmo \ - parsing/parse.cmo \ + parsing/rml_parser.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 \ @@ -141,14 +141,14 @@ 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) 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/rml_lexer.ml parsing/rml_parser.ml \ parsing/linenum.ml include ../config @@ -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) @@ -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 +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 2fb278b1..c5023ce3 100644 --- a/compiler/caml/caml2caml.ml +++ b/compiler/caml/caml2caml.ml @@ -25,14 +25,14 @@ (* Source to source transformations *) -open Misc -open Asttypes +open Rml_misc +open Rml_asttypes open Caml_ast open Caml_misc -module Env = Symbol_table.Make (Ident) +module Env = Symbol_table.Make (Rml_ident) (* Constant propagation *) let constant_propagation = @@ -46,9 +46,9 @@ let constant_propagation = expr.cexpr_desc end - | Cexpr_global gl -> expr.cexpr_desc + | Cexpr_global _gl -> expr.cexpr_desc - | Cexpr_constant c -> expr.cexpr_desc + | Cexpr_constant _c -> expr.cexpr_desc | Cexpr_let (Nonrecursive, patt_expr_list, expression) -> let patt_expr_list' = diff --git a/compiler/caml/caml_ast.ml b/compiler/caml/caml_ast.ml index 5a5158b7..4934a5c4 100644 --- a/compiler/caml/caml_ast.ml +++ b/compiler/caml/caml_ast.ml @@ -25,11 +25,11 @@ (* The abstract syntax for CAML *) -open Asttypes +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 3472fbbc..655cbf52 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 *) @@ -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 @@ -287,7 +287,7 @@ let rec make_dummy t = | Type_product te_list -> Cexpr_tuple (List.map make_dummy te_list) - | Type_constr (cstr, te_list) -> + | Type_constr (cstr, _te_list) -> begin try let type_desc = Modules.find_type_desc cstr.gi in if type_desc = Initialization.type_desc_int then @@ -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) @@ -397,10 +397,10 @@ let rec is_value e = | Cexpr_constraint (expr, _) -> is_value expr - | Cexpr_trywith (expr, patt_expr_list) -> + | Cexpr_trywith (expr, _patt_expr_list) -> (is_value expr) - | Cexpr_assert expr -> false + | Cexpr_assert _expr -> false | Cexpr_ifthenelse (e1, e2, e3) -> (is_value e1) && (is_value e2) && (is_value e3) diff --git a/compiler/caml/lco2caml.ml b/compiler/caml/lco2caml.ml index 3869e86f..3467fd7c 100644 --- a/compiler/caml/lco2caml.ml +++ b/compiler/caml/lco2caml.ml @@ -28,10 +28,8 @@ open Lco_ast 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 *) @@ -71,7 +69,7 @@ let pattern_of_signal_global (s,t) = (* Translation of type declatations *) -let rec translate_type_decl typ = +let translate_type_decl typ = match typ with | Cotype_abstract -> Ctype_abstract | Cotype_rebind t -> Ctype_rebind (translate_te t) @@ -303,7 +301,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]) @@ -511,7 +509,7 @@ and translate_proc e = [embed_ml expr;]) | Coproc_until (k, - [{coconf_desc = Coconf_present (s, None)}, None, None]) -> + [{coconf_desc = Coconf_present (s, None); _}, None, None]) -> if Lco_misc.is_value s then Cexpr_apply (make_instruction "rml_until'", @@ -660,7 +658,7 @@ and translate_proc e = [(make_patt_any(), None, make_raise_RML())])) Location.none]) - | Coproc_when ({coconf_desc = Coconf_present (s, None)}, k) -> + | Coproc_when ({coconf_desc = Coconf_present (s, None); _}, k) -> if Lco_misc.is_value s then Cexpr_apply (make_instruction "rml_when'", @@ -679,7 +677,7 @@ and translate_proc e = [cconf; translate_proc k]) - | Coproc_control ({coconf_desc = Coconf_present (s, None)}, None, k) -> + | Coproc_control ({coconf_desc = Coconf_present (s, None); _}, None, k) -> if Lco_misc.is_value s then Cexpr_apply (make_instruction "rml_control'", @@ -690,7 +688,7 @@ and translate_proc e = (make_instruction "rml_control", [embed_ml s; translate_proc k]) - | Coproc_control ({coconf_desc = Coconf_present(s, patt_opt)}, Some e, k) -> + | Coproc_control ({coconf_desc = Coconf_present(s, patt_opt); _}, Some e, k) -> let cpatt = match patt_opt with | None -> make_patt_any() @@ -750,7 +748,7 @@ and translate_proc e = (Cexpr_function [translate_pattern patt, None, translate_proc k]) Location.none]) - | Coproc_present ({coconf_desc = Coconf_present (s, None)}, k1, k2) -> + | Coproc_present ({coconf_desc = Coconf_present (s, None); _}, k1, k2) -> if Lco_misc.is_value s then Cexpr_apply (make_instruction "rml_present'", @@ -792,7 +790,7 @@ and translate_proc e = patt_proc_list)) Location.none]) - | Coproc_await (Nonimmediate, {coconf_desc = Coconf_present (s, None)}) -> + | Coproc_await (Nonimmediate, {coconf_desc = Coconf_present (s, None); _}) -> if Lco_misc.is_value s then Cexpr_apply (make_instruction "rml_await'", @@ -806,7 +804,7 @@ and translate_proc e = Cexpr_apply (make_instruction "rml_await_conf", [cconf]) - | Coproc_await (Immediate, {coconf_desc = Coconf_present (s, None)}) -> + | Coproc_await (Immediate, {coconf_desc = Coconf_present (s, None); _}) -> if Lco_misc.is_value s then Cexpr_apply (make_instruction "rml_await_immediate'", @@ -927,7 +925,7 @@ and translate_conf c = make_expr cexpr c.coconf_loc, cpatt -let translate_impl_item info_chan item = +let translate_impl_item _info_chan item = let citem = match item.coimpl_desc with | Coimpl_expr e -> Cimpl_expr (translate_ml e) @@ -983,7 +981,7 @@ let translate_impl_item info_chan item = in make_impl citem item.coimpl_loc -let translate_intf_item info_chan item = +let translate_intf_item _info_chan item = let citem = match item.cointf_desc with | Cointf_val (gl, typ) -> Cintf_val (gl, translate_te typ) diff --git a/compiler/caml/lk2caml.ml b/compiler/caml/lk2caml.ml index f81a4bb8..f88db690 100644 --- a/compiler/caml/lk2caml.ml +++ b/compiler/caml/lk2caml.ml @@ -28,10 +28,8 @@ open Lk_ast 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 = @@ -103,7 +101,7 @@ let pattern_of_signal_global (s,t) = make_patt (Cpatt_constraint(ps, translate_te t)) Location.none (* Translation of type declatations *) -let rec translate_type_decl typ = +let translate_type_decl typ = match typ with | Ktype_abstract -> Ctype_abstract @@ -344,7 +342,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]) @@ -771,7 +769,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 +786,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 @@ -838,7 +836,7 @@ and translate_proc e = end - | Kproc_start_until(ctrl, {kconf_desc = Kconf_present s}, None, + | Kproc_start_until(ctrl, {kconf_desc = Kconf_present s; _}, None, (ctrl', k1), (patt,k2)) -> if Lk_misc.is_value s then Cexpr_apply @@ -872,7 +870,7 @@ and translate_proc e = [make_expr_var_local ctrl; translate_proc k]) - | Kproc_start_when(ctrl, {kconf_desc = Kconf_present s}, (ctrl', k)) -> + | Kproc_start_when(ctrl, {kconf_desc = Kconf_present s; _}, (ctrl', k)) -> if Lk_misc.is_value s then Cexpr_apply (make_instruction "rml_start_when_v", @@ -901,7 +899,7 @@ and translate_proc e = translate_proc k]) - | Kproc_start_control(ctrl, {kconf_desc = Kconf_present s}, (ctrl', k)) -> + | Kproc_start_control(ctrl, {kconf_desc = Kconf_present s; _}, (ctrl', k)) -> if Lk_misc.is_value s then Cexpr_apply (make_instruction "rml_start_control_v", @@ -949,7 +947,7 @@ and translate_proc e = Location.none; make_expr_var_local ctrl]) - | Kproc_present (ctrl, {kconf_desc = Kconf_present s}, k1, k2) -> + | Kproc_present (ctrl, {kconf_desc = Kconf_present s; _}, k1, k2) -> if Lk_misc.is_value s then Cexpr_apply (make_instruction "rml_present_v", @@ -1042,7 +1040,7 @@ and translate_proc e = (Cexpr_match (translate_ml expr, List.map - (fun (p,when_opt,k) -> + (fun (p,_when_opt,k) -> (translate_pattern p, None, make_expr @@ -1055,7 +1053,7 @@ and translate_proc e = - | Kproc_await (flag, {kconf_desc = Kconf_present s}, k, ctrl) -> + | Kproc_await (flag, {kconf_desc = Kconf_present s; _}, k, ctrl) -> let _immediate = match flag with | Nonimmediate -> "" @@ -1191,7 +1189,7 @@ and translate_conf c = make_expr cexpr c.kconf_loc -let translate_impl_item info_chan item = +let translate_impl_item _info_chan item = let citem = match item.kimpl_desc with | Kimpl_expr e -> Cimpl_expr (translate_ml e) @@ -1252,7 +1250,7 @@ let translate_impl_item info_chan item = in make_impl citem item.kimpl_loc -let translate_intf_item info_chan item = +let translate_intf_item _info_chan item = let citem = match item.kintf_desc with | Kintf_val (gl, typ) -> Cintf_val (gl, translate_te typ) diff --git a/compiler/caml/print_caml_src.ml b/compiler/caml/print_caml_src.ml index 99e72962..2e80a86b 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 @@ -122,24 +122,24 @@ let print_stdlib n = (** Prints a global name *) -let print_global ({ gi = {qual=q; id=n} } as gl) = +let print_global ({ gi = {qual=q; id=n}; _ } as gl) = if gl.gi = Initialization.event_ident then (* special case for event type *) 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] -> @@ -217,7 +217,7 @@ let rec print pri e = pp_print_string !formatter "->"; pp_print_space !formatter (); print 0 e1 - | Cexpr_let(flag, [patt, { cexpr_desc = Cexpr_fun (param_list, e1) }], e) -> + | Cexpr_let(flag, [patt, { cexpr_desc = Cexpr_fun (param_list, e1); _ }], e) -> pp_print_string !formatter (if flag = Recursive then "let rec " else "let "); print_pattern 0 patt; pp_print_space !formatter (); @@ -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 ")" @@ -548,7 +548,7 @@ let print_impl_item item = print 0 e; pp_print_string !formatter ";;"; pp_close_box !formatter () - | Cimpl_let(flag, [patt, { cexpr_desc = Cexpr_fun (param_list, e1) }]) -> + | Cimpl_let(flag, [patt, { cexpr_desc = Cexpr_fun (param_list, e1); _ }]) -> pp_print_string !formatter (if flag = Recursive then "let rec " else "let "); print_pattern 0 patt; pp_print_space !formatter (); 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/external/lucky.ml b/compiler/external/lucky.ml index 79a07f5f..d46f422b 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 @@ -108,7 +108,7 @@ let get_inputs = List.map get_input inputs let make_step inputs = - let input_to_string_val (n,id,ty) = + let input_to_string_val (n,id,_ty) = make_expr (Pexpr_tuple [make_expr (Pexpr_constant (Const_string id.psimple_id)); @@ -219,7 +219,7 @@ let patt_of_in_out_puts patt_of_in_out_put inputs = inputs)) let patt_of_inputs = - let patt_of_input (n,id,ty) = + let patt_of_input (n,id,_ty) = make_var_patt ("evt_"^ id.psimple_id^ "_in_"^(string_of_int n)) @@ -227,7 +227,7 @@ let patt_of_inputs = patt_of_in_out_puts patt_of_input let patt_of_outputs = - let patt_of_output (n,id,ty) = + let patt_of_output (n,id,_ty) = make_var_patt ("evt_"^ id.psimple_id^ "_out_"^(string_of_int n)) 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..d2fbda3d 100644 --- a/compiler/global/global.ml +++ b/compiler/global/global.ml @@ -28,7 +28,7 @@ (* $Id$ *) -open Misc +(* open Rml_misc unused open *) (* values in the symbol table *) 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 3959823f..0bf7e734 100644 --- a/compiler/global/initialization.ml +++ b/compiler/global/initialization.ml @@ -30,8 +30,7 @@ (* the initial module *) -open Misc -open Ident +open Rml_misc open Global_ident open Def_types open Global @@ -39,16 +38,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 +62,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 +102,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 +114,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 +123,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 +149,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 +181,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 a7cd3a67..8d2e3afa 100644 --- a/compiler/global/modules.ml +++ b/compiler/global/modules.ml @@ -28,9 +28,8 @@ (* $Id$ *) -open Misc +open Rml_misc open Global_ident -open Def_types open Global open Parse_ident open Def_modules @@ -149,7 +148,7 @@ let start_compiling_interface modname = reset_opened_modules(); List.iter open_module !default_used_modules;; -let start_compiling_implementation modname intf = +let start_compiling_implementation modname _intf = start_compiling_interface modname let compiled_module_name () = @@ -162,7 +161,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 +208,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/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/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/global/misc.ml b/compiler/global/rml_misc.ml similarity index 99% rename from compiler/global/misc.ml rename to compiler/global/rml_misc.ml index bfe72e08..3281b1ea 100644 --- a/compiler/global/misc.ml +++ b/compiler/global/rml_misc.ml @@ -134,7 +134,7 @@ let const_optimization = ref true let remove_file filename = try Sys.remove filename - with Sys_error msg -> + with Sys_error _msg -> () let find_in_path filename = @@ -168,7 +168,7 @@ class name_assoc_table f = try List.assq var assoc_table with - not_found -> + _not_found -> let n = f counter in counter <- counter + 1; assoc_table <- (var,n) :: assoc_table; diff --git a/compiler/lco/lco_ast.ml b/compiler/lco/lco_ast.ml index 766fe529..f8810426 100644 --- a/compiler/lco/lco_ast.ml +++ b/compiler/lco/lco_ast.ml @@ -25,10 +25,10 @@ (* The abstract syntax for the Lco language *) -open Asttypes +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/lco_misc.ml b/compiler/lco/lco_misc.ml index be952482..aa3d14d6 100644 --- a/compiler/lco/lco_misc.ml +++ b/compiler/lco/lco_misc.ml @@ -49,7 +49,7 @@ let rec is_value e = | Coexpr_trywith (expr, _) -> (is_value expr) - | Coexpr_assert expr -> false + | Coexpr_assert _expr -> false | Coexpr_ifthenelse (e1, e2, e3) -> (is_value e1) && (is_value e2) && (is_value e3) diff --git a/compiler/lco/reac2lco.ml b/compiler/lco/reac2lco.ml index b0258258..02b5acb1 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 = @@ -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 @@ -95,7 +95,7 @@ let rec translate_te typ = make_te cotyp typ.te_loc (* Translation of type declatations *) -let rec translate_type_decl typ = +let translate_type_decl typ = match typ with | Rtype_abstract -> Cotype_abstract | Rtype_rebind typ -> Cotype_rebind (translate_te typ) @@ -540,7 +540,7 @@ and translate_proc_let = | Varpatt_local id -> Reac_misc.make_expr (Rexpr_local id) Location.none, make_patt (Copatt_var (Covarpatt_local id)) Location.none - | Varpatt_global gl -> assert false + | Varpatt_global _gl -> assert false in let rexpr_of_vars, copatt_of_vars = List.fold_left @@ -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 @@ -721,7 +721,7 @@ and translate_proc_let = make_expr (Coexpr_tuple (Array.fold_left - (fun expr_list id -> + (fun expr_list _id -> (make_expr (Coexpr_apply (make_expr @@ -750,7 +750,7 @@ let translate_expr_or_process e = make_expr (Coexpr_exec p) Location.none -let translate_impl_item info_chan item = +let translate_impl_item _info_chan item = let coitem = match item.impl_desc with | Rimpl_expr e -> Coimpl_expr (translate_expr_or_process e) @@ -785,7 +785,7 @@ let translate_impl_item info_chan item = in make_impl coitem item.impl_loc -let translate_intf_item info_chan item = +let translate_intf_item _info_chan item = let coitem = match item.intf_desc with | Rintf_val (gl, typ) -> Cointf_val (gl, translate_te typ) diff --git a/compiler/lk/lk_ast.ml b/compiler/lk/lk_ast.ml index bd629390..40ed423b 100644 --- a/compiler/lk/lk_ast.ml +++ b/compiler/lk/lk_ast.ml @@ -25,10 +25,10 @@ (* The abstract syntax for the Lk language (cf. thesis) *) -open Asttypes +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/lk_misc.ml b/compiler/lk/lk_misc.ml index c35f91b9..0600b7ef 100644 --- a/compiler/lk/lk_misc.ml +++ b/compiler/lk/lk_misc.ml @@ -45,10 +45,10 @@ let rec is_value e = | Kexpr_construct (_, Some expr) -> is_value expr | Kexpr_constraint (expr, _) -> is_value expr - | Kexpr_trywith (expr, patt_expr_list) -> + | Kexpr_trywith (expr, _patt_expr_list) -> (is_value expr) - | Kexpr_assert expr -> false + | Kexpr_assert _expr -> false | Kexpr_ifthenelse (e1, e2, e3) -> (is_value e1) && (is_value e2) && (is_value e3) diff --git a/compiler/lk/reac2lk.ml b/compiler/lk/reac2lk.ml index 755fabda..72434433 100644 --- a/compiler/lk/reac2lk.ml +++ b/compiler/lk/reac2lk.ml @@ -25,11 +25,10 @@ (* The translation of Reac to Lk *) -open Asttypes open Def_static open Reac_ast open Lk_ast -open Misc +open Rml_misc let make_expr e loc = @@ -60,7 +59,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 = @@ -80,7 +79,7 @@ let rec translate_te typ = (* Translation of type declatations *) -let rec translate_type_decl typ = +let translate_type_decl typ = match typ with | Rtype_abstract -> Ktype_abstract | Rtype_rebind typ -> Ktype_rebind (translate_te typ) @@ -371,7 +370,7 @@ and translate_proc e k (ctrl: ident) = match l with | [] -> assert false | [p] -> translate_proc p k ctrl - | ({ expr_static = (ctx, Def_static.Static) } as p)::l' -> + | ({ expr_static = (_ctx, Def_static.Static); _ } as p)::l' -> let k' = f l' in make_proc (Kproc_seq (translate_ml p, k')) Location.none | p::l' -> @@ -438,7 +437,7 @@ and translate_proc e k (ctrl: ident) = Location.none) - | Rexpr_merge (p1, p2) -> + | Rexpr_merge (_p1, _p2) -> not_yet_implemented "merge" (* C_k[signal s in p] = *) @@ -470,7 +469,7 @@ and translate_proc e k (ctrl: ident) = (* bind K = k in *) (* start ctrl C[s] (fun ctrl' -> C_(end.k, ctrl')[p]) (x -> C_k[p']) *) | Rexpr_until (proc, - [ {conf_desc = Rconf_present (_, patt_opt) } as s, + [ {conf_desc = Rconf_present (_, patt_opt); _ } as s, when_opt, proc_opt; ]) -> (* | Rexpr_until (s, proc, patt_proc_opt) -> *) let patt_proc_opt = @@ -480,7 +479,7 @@ and translate_proc e k (ctrl: ident) = | None, Some proc -> let patt = Reac_misc.make_patt Rpatt_any Location.none in Some (patt, proc) - | Some patt, None -> assert false + | Some _patt, None -> assert false in let k_id = make_var "k" in let k_var = make_proc (Kproc_var k_id) Location.none in @@ -507,7 +506,7 @@ and translate_proc e k (ctrl: ident) = translate_proc proc' k_var ctrl) end)) Location.none) - | Rexpr_until (proc, conf_when_opt_expr_opt_list) -> + | Rexpr_until (_proc, _conf_when_opt_expr_opt_list) -> not_yet_implemented "Reac2lk.translate_proc(until)" (* C_k[do p when s] = *) @@ -553,8 +552,8 @@ and translate_proc e k (ctrl: ident) = (ctrl_id, translate_proc proc end_control ctrl_id))) Location.none) - | Rexpr_control (s, Some _, proc) -> - Misc.not_yet_implemented "Reac2lk.translate_proc Rexpr_control" + | Rexpr_control (_s, Some _, _proc) -> + 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] *) @@ -682,7 +681,7 @@ and translate_proc e k (ctrl: ident) = (* Translation of let definitions in a PROCESS context *) and translate_proc_let = - let rec is_static = + let is_static = List.for_all (fun (_, expr) -> snd expr.expr_static = Def_static.Static) in fun flag patt_expr_list proc k ctrl -> @@ -800,7 +799,7 @@ let translate_expr_or_process e = in make_expr (Kexpr_exec p) Location.none -let translate_impl_item info_chan item = +let translate_impl_item _info_chan item = let kitem = match item.impl_desc with | Rimpl_expr e -> Kimpl_expr (translate_expr_or_process e) @@ -836,7 +835,7 @@ let translate_impl_item info_chan item = make_impl kitem item.impl_loc -let translate_intf_item info_chan item = +let translate_intf_item _info_chan item = let kitem = match item.intf_desc with | Rintf_val (gl, typ) -> Kintf_val (gl, translate_te typ) diff --git a/compiler/main/compiler.ml b/compiler/main/compiler.ml index e72f1dd5..a7f3b55a 100644 --- a/compiler/main/compiler.ml +++ b/compiler/main/compiler.ml @@ -28,8 +28,8 @@ (* $Id$ *) -open Misc -open Errors +open Rml_misc +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 *) @@ -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 *) @@ -231,7 +231,7 @@ let compile_implementation_back_end info_chan out_chan module_name rml_table = List.iter (output_string out_chan) strings (* the main functions *) -let compile_implementation module_name filename = +let compile_implementation _module_name filename = (* input and output files *) let source_name = filename ^ ".rml" and obj_interf_name = make_output_filename (filename ^ ".rzi") @@ -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();*) @@ -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 *) @@ -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") @@ -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 *) @@ -310,7 +311,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 @@ -330,7 +331,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; @@ -340,14 +341,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 @@ -420,7 +421,7 @@ let compile_interface_back_end info_fmt out_chan module_name rml_table = (* the main functions *) -let compile_interface parse module_name filename filename_end = +let compile_interface parse _module_name filename filename_end = (* input and output files *) let source_name = filename ^ filename_end and obj_interf_name = make_output_filename (filename ^ ".rzi") @@ -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 *) @@ -472,10 +474,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/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/interactive.ml b/compiler/main/interactive.ml index a3250a85..28b087b4 100644 --- a/compiler/main/interactive.ml +++ b/compiler/main/interactive.ml @@ -49,21 +49,21 @@ 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 *) 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 () = Rml_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 *) @@ -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/options.ml b/compiler/main/options.ml index f6aeb3c0..a91468d4 100644 --- a/compiler/main/options.ml +++ b/compiler/main/options.ml @@ -21,63 +21,62 @@ (* created: 2006-08-07 *) (* author: Louis Mandel *) -open Misc +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 -> - 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/errors.ml b/compiler/main/rml_errors.ml similarity index 91% rename from compiler/main/errors.ml rename to compiler/main/rml_errors.ml index 55a95c6c..f316e6b8 100644 --- a/compiler/main/errors.ml +++ b/compiler/main/rml_errors.ml @@ -44,14 +44,14 @@ 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 - | 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 = +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/main.ml b/compiler/main/rmlc.ml similarity index 97% rename from compiler/main/main.ml rename to compiler/main/rmlc.ml index 0a48b79a..d96d35ed 100644 --- a/compiler/main/main.ml +++ b/compiler/main/rmlc.ml @@ -28,10 +28,11 @@ (* $Id$ *) -open Misc -open Modules +open Rml_misc open Compiler +let () = Options.set_options () + (* list of object files passed on the command line *) let object_files = ref [] @@ -60,7 +61,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/optimization/reac_optimization.ml b/compiler/optimization/reac_optimization.ml index bd69cf15..ef844999 100644 --- a/compiler/optimization/reac_optimization.ml +++ b/compiler/optimization/reac_optimization.ml @@ -19,9 +19,8 @@ (* file: reac_optimization.ml *) -open Asttypes +open Rml_asttypes open Reac_ast -open Def_types open Reac_misc @@ -32,7 +31,7 @@ let binary2nary e = | Rexpr_seq e_list -> let rec f left l = match l with - | { expr_desc = Rexpr_seq e_list' } :: l' -> + | { expr_desc = Rexpr_seq e_list'; _ } :: l' -> let left' = left @ e_list' in f left' l' | x :: l' -> @@ -44,7 +43,7 @@ let binary2nary e = | Rexpr_par e_list -> let rec f left l = match l with - | { expr_desc = Rexpr_par e_list' } :: l' -> + | { expr_desc = Rexpr_par e_list'; _ } :: l' -> let left' = left @ e_list' in f left' l' | x :: l' -> @@ -64,8 +63,8 @@ let dynamic2static e = | Rexpr_seq e_list -> let rec f left l = match l with - | ({ expr_static = ctx1, Def_static.Static } as e1) - :: ({ expr_static = ctx2, Def_static.Static } as e2) :: l' -> + | ({ expr_static = ctx1, Def_static.Static; _ } as e1) + :: ({ expr_static = ctx2, Def_static.Static; _ } as e2) :: l' -> let e' = make_expr (Rexpr_seq [e1;e2]) @@ -75,16 +74,16 @@ let dynamic2static e = e'.expr_static <- ctx1, Def_static.Static; f left (e'::l') - | ({ expr_desc = Rexpr_emit _ } as e1) - :: ({ expr_static = ctx2, Def_static.Dynamic _ } as e2) :: l' -> + | ({ expr_desc = Rexpr_emit _; _ } as e1) + :: ({ expr_static = _ctx2, Def_static.Dynamic _; _ } as e2) :: l' -> let ctx1 = fst e1.expr_static in let k1 = Def_static.Dynamic Def_static.Instantaneous in e1.expr_static <- (ctx1, k1); f (left@[e1]) (e2::l') - | [ { expr_static = ctx1, Def_static.Dynamic _ } as e1; - { expr_desc = Rexpr_emit _ } as e2 ] -> + | [ { expr_static = _ctx1, Def_static.Dynamic _; _ } as e1; + { expr_desc = Rexpr_emit _; _ } as e2 ] -> let ctx2 = fst e2.expr_static in let k2 = Def_static.Dynamic Def_static.Instantaneous in e2.expr_static <- (ctx2, k2); @@ -104,7 +103,7 @@ let dynamic2static e = e'.expr_static <- e.expr_static; e' end - | Rexpr_when(_, ({ expr_desc = Rexpr_emit _ } as e2)) -> + | Rexpr_when(_, ({ expr_desc = Rexpr_emit _; _ } as e2)) -> let ctx2 = fst e2.expr_static in let k2 = Def_static.Dynamic Def_static.Instantaneous in e2.expr_static <- (ctx2, k2); @@ -131,9 +130,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 +156,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 f7d5c161..d7049078 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 @@ -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 @@ -92,7 +92,7 @@ module Env : let get env x = try - let (x', n) = List.find (fun (y,_) -> same x y) env in + let (_x', n) = List.find (fun (y,_) -> same x y) env in Some n with Not_found -> None @@ -361,7 +361,7 @@ let instantaneous_loop_expr = | _ -> let vars_right = List.fold_left - (fun vars (p_list, ty, n_opt) -> + (fun vars (p_list, _ty, n_opt) -> begin match n_opt with | None -> vars | Some n -> @@ -427,9 +427,9 @@ let instantaneous_loop_expr = | Rexpr_tuple expr_list -> instantaneous_loop_expr_list analyse id vars expr_list - | Rexpr_construct (const, None) -> Env.empty + | Rexpr_construct (_const, None) -> Env.empty - | Rexpr_construct (const, Some e) -> analyse vars e + | Rexpr_construct (_const, Some e) -> analyse vars e | Rexpr_array expr_list -> instantaneous_loop_expr_list analyse id vars expr_list @@ -437,7 +437,7 @@ let instantaneous_loop_expr = | Rexpr_record lbl_expr_list -> instantaneous_loop_expr_list analyse snd vars lbl_expr_list - | Rexpr_record_access (e, lbl) -> + | Rexpr_record_access (e, _lbl) -> analyse vars e | Rexpr_record_with (e, lbl_expr_list) -> @@ -445,13 +445,13 @@ let instantaneous_loop_expr = let ty' = instantaneous_loop_expr_list analyse snd vars lbl_expr_list in Env.append ty' ty - | Rexpr_record_update (e1, lbl, e2) -> + | Rexpr_record_update (e1, _lbl, e2) -> let ty1 = analyse vars e1 in let ty2 = analyse vars e2 in if not (Env.equal Env.empty ty2) then rec_warning expr; Env.append ty1 ty2 - | Rexpr_constraint (e, ty) -> + | Rexpr_constraint (e, _ty) -> analyse vars e | Rexpr_trywith (e, patt_when_opt_expr_list) -> @@ -502,7 +502,7 @@ let instantaneous_loop_expr = let ty2 = analyse vars e2 in Env.append ty1 ty2 - | Rexpr_for (ident, e1, e2, direction_flag, e) -> + | Rexpr_for (_ident, e1, e2, _direction_flag, e) -> let ty1 = analyse vars e1 in let ty2 = analyse vars e2 in let ty = analyse vars e in @@ -525,7 +525,7 @@ let instantaneous_loop_expr = | Rexpr_process e -> analyse (Env.plus vars 1) e - | Rexpr_pre (pre_kind, e) -> + | Rexpr_pre (_pre_kind, e) -> analyse vars e | Rexpr_last e -> @@ -559,7 +559,7 @@ let instantaneous_loop_expr = let ty = analyse vars e in Env.append ty_n ty - | Rexpr_fordopar (ident, e1, e2, direction_flag, e) -> + | Rexpr_fordopar (_ident, e1, e2, _direction_flag, e) -> let ty1 = analyse vars e1 in let ty2 = analyse vars e2 in let ty = analyse vars e in @@ -573,9 +573,9 @@ let instantaneous_loop_expr = let ty2 = analyse vars e2 in Env.append ty1 ty2 - | Rexpr_signal ((ident, tyexpr_opt), None, e) -> + | Rexpr_signal ((_ident, _tyexpr_opt), None, e) -> analyse vars e - | Rexpr_signal ((ident, tyexpr_opt), Some(k,e1,e2), e) -> + | Rexpr_signal ((_ident, _tyexpr_opt), Some(_k,e1,e2), e) -> let ty1 = analyse vars e1 in let ty2 = analyse vars e2 in let ty2' = Env.plus ty2 (-2) in @@ -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 @@ -616,7 +616,7 @@ let instantaneous_loop_expr = let _ = analyse Env.empty e1 in Env.append ty_config ty - | Rexpr_get (e,patt,e1) -> + | Rexpr_get (e,_patt,e1) -> let ty = analyse vars e in let _ = analyse Env.empty e1 in ty @@ -627,16 +627,16 @@ let instantaneous_loop_expr = let _ = analyse Env.empty e2 in Env.append ty_config ty1 - | Rexpr_await (immediate_flag, config) -> + | Rexpr_await (_immediate_flag, config) -> config_analyse vars config | Rexpr_await_val (Immediate, One, e, None, e1) -> let ty = config_analyse vars e in let ty1 = analyse vars e1 in Env.append ty ty1 - | Rexpr_await_val (immediate, kind, e, when_opt, e1) -> + | 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 @@ -696,7 +696,7 @@ let instantaneous_loop impl = List.iter (fun (_, combine) -> match combine with - | Some(k,e1,e2) -> + | Some(_k,e1,e2) -> let _ty1 = instantaneous_loop_expr Env.empty e1 in let _ty2 = instantaneous_loop_expr Env.empty e2 in () 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/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/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..28bc95c2 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 = @@ -49,7 +49,7 @@ let fmt_location f loc = if loc.loc_ghost then fprintf f " ghost"; ;; -let rec fmt_parseident_aux f x = +let fmt_parseident_aux f x = match x with | Parse_ident.Pident (s) -> fprintf f "%s" s; | Parse_ident.Pdot (m, s) -> fprintf f "%s.%s" m s; @@ -391,7 +391,7 @@ and expression_x_expression i ppf (e1, e2) = expression i ppf e1; expression i ppf e2 -and signal_kind_x_expression_x_expression i ppf (kind, e1, e2) = +and signal_kind_x_expression_x_expression i ppf (_kind, e1, e2) = expression i ppf e1; expression i ppf e2 ;; @@ -447,7 +447,7 @@ let rec impl_item i ppf x = ident i ppf id; | Pimpl_open (s) -> line i ppf "Pimpl_open %s\n" s; - | Pimpl_lucky (id, in_ty_list, out_ty_list, files) -> + | Pimpl_lucky (_id, _in_ty_list, _out_ty_list, _files) -> line i ppf "Pimpl_lucky ... A FAIRE ...\n"; diff --git a/compiler/parsing/lexer.mll b/compiler/parsing/rml_lexer.mll similarity index 99% rename from compiler/parsing/lexer.mll rename to compiler/parsing/rml_lexer.mll index 55044d9a..54422432 100644 --- a/compiler/parsing/lexer.mll +++ b/compiler/parsing/rml_lexer.mll @@ -44,8 +44,8 @@ { open Lexing -open Misc -open Parser +open Rml_misc +open Rml_parser type error = | Illegal_character of char @@ -194,7 +194,7 @@ let char_for_backslash = | 't' -> '\009' | c -> c end - | x -> fatal_error "Lexer: unknown system type" + | _x -> fatal_error "Lexer: unknown system type" let char_for_decimal_code lexbuf i = let c = 100 * (Char.code(Lexing.lexeme_char lexbuf i) - 48) + @@ -443,7 +443,7 @@ and comment = parse | "*)" { match !comment_start_loc with | [] -> assert false - | [x] -> comment_start_loc := []; + | [_x] -> comment_start_loc := []; | _ :: l -> comment_start_loc := l; comment lexbuf; } diff --git a/compiler/parsing/parse.ml b/compiler/parsing/rml_parse.ml similarity index 72% rename from compiler/parsing/parse.ml rename to compiler/parsing/rml_parse.ml index aa26c4e9..68122137 100644 --- a/compiler/parsing/parse.ml +++ b/compiler/parsing/rml_parse.ml @@ -42,50 +42,48 @@ (* Entry points in the parser *) -open Location - (* Skip tokens to the end of the phrase *) let rec skip_phrase lexbuf = try - match Lexer.token lexbuf with - Parser.SEMISEMI | Parser.EOF -> () + 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 = - 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 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 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/parser.mly b/compiler/parsing/rml_parser.mly similarity index 70% rename from compiler/parsing/parser.mly rename to compiler/parsing/rml_parser.mly index 79e33ba8..09a6bf19 100644 --- a/compiler/parsing/parser.mly +++ b/compiler/parsing/rml_parser.mly @@ -44,51 +44,52 @@ %{ open Location -open Asttypes +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 Parse_error + | [] -> 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 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, - 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 (Syntaxerr.Error(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(Syntaxerr.Error(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(Syntaxerr.Error(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(Syntaxerr.Error(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 (Syntaxerr.Error(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 (Syntaxerr.Error(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,35 +1045,35 @@ 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: 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 - { 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/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/binding_errors.ml b/compiler/reac/binding_errors.ml index dbdda564..6237a119 100644 --- a/compiler/reac/binding_errors.ml +++ b/compiler/reac/binding_errors.ml @@ -23,8 +23,7 @@ (* $Id$ *) -open Misc -open Parse_ast +open Rml_misc open Parse_ident let unbound_variable_err x loc = diff --git a/compiler/reac/parse2reac.ml b/compiler/reac/parse2reac.ml index c0a27ceb..9a0ca4f2 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 @@ -34,7 +34,6 @@ open Reac_ast open Reac_misc open Parse_ident open Def_types -open Types module Env = Symbol_table.Make @@ -71,7 +70,7 @@ let rec translate_te typ = make_te rtyp typ.pte_loc (* Translation of type declatations *) -let rec translate_type_decl typ = +let translate_type_decl typ = match typ with | Ptype_abstract -> Rtype_abstract @@ -81,7 +80,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 +97,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 +124,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 +147,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 @@ -272,7 +271,7 @@ let translate_pattern, translate_pattern_list, translate_pattern_record = (* Translation of identifier *) let translate_ident env x = match x.pident_id with - | Pdot (mod_name,s) -> + | Pdot (_mod_name,_s) -> Rexpr_global (Modules.pfind_value_desc x.pident_id) | Pident s -> @@ -296,7 +295,7 @@ let rec translate env e = | Pexpr_constant im -> Rexpr_constant im - | Pexpr_let (_, [patt, {pexpr_desc= Pexpr_get s;}], expr) -> + | Pexpr_let (_, [patt, {pexpr_desc = Pexpr_get s;_}], expr) -> let vars, rpatt = translate_pattern false patt in let new_env = add_varpatt env vars in Rexpr_get(translate env s, @@ -388,7 +387,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 +430,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 +611,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 +636,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 = @@ -657,13 +656,13 @@ let translate_type_declaration l = l_rename (* Translation of implementation item *) -let translate_impl_item info_fmt item = +let translate_impl_item _info_fmt item = let ritem = match item.pimpl_desc with | Pimpl_expr expr -> Rimpl_expr (translate Env.empty expr) | Pimpl_let (flag, patt_expr_list) -> - let env, rpatt_rexpr_list = + let _env, rpatt_rexpr_list = translate_let true Env.empty flag patt_expr_list in Rimpl_let (flag, rpatt_rexpr_list) @@ -672,7 +671,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 +689,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 @@ -717,11 +716,11 @@ let translate_impl_item info_fmt item = make_impl ritem item.pimpl_loc (* Translation of interfacr item *) -let translate_intf_item info_fmt item = +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 +730,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/reac2reac.ml b/compiler/reac/reac2reac.ml index fea0e91b..198d936e 100644 --- a/compiler/reac/reac2reac.ml +++ b/compiler/reac/reac2reac.ml @@ -25,9 +25,8 @@ (* Source to source transformations *) -open Asttypes +open Rml_asttypes open Reac_ast -open Def_types open Reac_misc (* Generic source to source transformation for Reac_ast *) @@ -72,7 +71,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 @@ -96,7 +95,7 @@ let expr_map = (Rexpr_tuple expr_list') typ static reactivity reactivity_effect loc) - | Rexpr_construct (const, None) -> + | Rexpr_construct (_const, None) -> f expr | Rexpr_construct (const, Some e) -> let e' = expr_map f e in @@ -151,7 +150,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 +175,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 +242,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 +288,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 +338,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 +382,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 +392,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..3ef108c0 100644 --- a/compiler/reac/reac_ast.ml +++ b/compiler/reac/reac_ast.ml @@ -30,10 +30,10 @@ (* The abstract syntax for the reac language *) -open Asttypes +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 c3a812d0..c00ec196 100644 --- a/compiler/reac/reac_misc.ml +++ b/compiler/reac/reac_misc.ml @@ -25,10 +25,9 @@ (* Functions on Reac AST *) -open Asttypes +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 +70,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 @@ -110,9 +109,9 @@ let rec vars_of_patt p = (* Compute the list of variables introduce in an event configuration *) let rec vars_of_config config = match config.conf_desc with - | Rconf_present (e, None) -> [] + | Rconf_present (_e, None) -> [] - | Rconf_present (e, Some p) -> vars_of_patt p + | Rconf_present (_e, Some p) -> vars_of_patt p | Rconf_and (cfg1, cfg2) -> (vars_of_config cfg1) @ (vars_of_config cfg2) @@ -125,7 +124,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' @@ -175,7 +174,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 @@ -186,9 +185,9 @@ let expr_free_vars e = | Rexpr_tuple expr_list -> List.iter (expr_free_vars vars) expr_list - | Rexpr_construct (const, None) -> () + | Rexpr_construct (_const, None) -> () - | Rexpr_construct (const, Some e) -> + | Rexpr_construct (_const, Some e) -> expr_free_vars vars e | Rexpr_array expr_list -> @@ -197,18 +196,18 @@ let expr_free_vars e = | Rexpr_record lbl_expr_list -> List.iter (fun (_,e) -> expr_free_vars vars e) lbl_expr_list - | Rexpr_record_access (e, lbl) -> + | Rexpr_record_access (e, _lbl) -> expr_free_vars vars e | Rexpr_record_with (e, lbl_expr_list) -> expr_free_vars vars e; List.iter (fun (_,e) -> expr_free_vars vars e) lbl_expr_list - | Rexpr_record_update (e1, lbl, e2) -> + | Rexpr_record_update (e1, _lbl, e2) -> expr_free_vars vars e1; expr_free_vars vars e2 - | Rexpr_constraint (e, ty) -> + | Rexpr_constraint (e, _ty) -> expr_free_vars vars e | Rexpr_trywith (e, patt_expr_list) -> @@ -216,7 +215,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 +232,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 @@ -241,7 +240,7 @@ let expr_free_vars e = expr_free_vars vars e1; expr_free_vars vars e2 - | Rexpr_for (ident, e1, e2, direction_flag, e) -> + | Rexpr_for (ident, e1, e2, _direction_flag, e) -> let vars' = (Varpatt_local ident) :: vars in expr_free_vars vars' e1; expr_free_vars vars' e2; @@ -253,7 +252,7 @@ let expr_free_vars e = | Rexpr_process e -> expr_free_vars vars e - | Rexpr_pre (pre_kind, e) -> + | Rexpr_pre (_pre_kind, e) -> expr_free_vars vars e | Rexpr_last e -> @@ -276,10 +275,10 @@ 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) -> + | Rexpr_fordopar (ident, e1, e2, _direction_flag, e) -> let vars' = (Varpatt_local ident) :: vars in expr_free_vars vars' e1; expr_free_vars vars' e2; @@ -292,10 +291,10 @@ let expr_free_vars e = expr_free_vars vars e1; expr_free_vars vars e2 - | Rexpr_signal ((ident, tyexpr_opt), None, e) -> + | Rexpr_signal ((ident, _tyexpr_opt), None, e) -> let vars' = (Varpatt_local ident) :: vars in expr_free_vars vars' e - | Rexpr_signal ((ident, tyexpr_opt), Some(kind, e1,e2), e) -> + | Rexpr_signal ((ident, _tyexpr_opt), Some(_kind, e1,e2), e) -> let vars' = (Varpatt_local ident) :: vars in expr_free_vars vars' e1; expr_free_vars vars' e2; @@ -310,8 +309,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) -> @@ -337,13 +336,13 @@ let expr_free_vars e = expr_free_vars vars e1; expr_free_vars vars e2 - | Rexpr_await (immediate_flag, config) -> + | Rexpr_await (_immediate_flag, config) -> config_free_vars vars config - | Rexpr_await_val (immediate, kind, config, when_opt, e1) -> + | 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/reac/annot.ml b/compiler/reac/rml_annot.ml similarity index 93% rename from compiler/reac/annot.ml rename to compiler/reac/rml_annot.ml index 5e63e10c..bc4c86a9 100644 --- a/compiler/reac/annot.ml +++ b/compiler/reac/rml_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: @@ -129,8 +129,8 @@ let rec printtyp_reset_maybe loc = let print_info oc pp ti = match ti with - | Ti_patt {patt_loc = loc;} - | Ti_expr {expr_loc = loc;} -> + | Ti_patt {patt_loc = loc; _ } + | Ti_expr {expr_loc = loc; _ } -> let typ = T.get_type ti in print_position pp loc.loc_start; Format.fprintf pp " "; @@ -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 @@ -171,8 +171,8 @@ module Stypes = let get_type ti = begin match ti with - | Ti_patt {patt_type = typ;} - | Ti_expr {expr_type = typ;} -> typ + | Ti_patt {patt_type = typ; _ } + | Ti_expr {expr_type = typ; _ } -> typ end (* let output = Types_printer.output *) @@ -191,9 +191,9 @@ module Sstatic = let get_type ti = begin match ti with | Ti_patt _ -> (Def_static.Static, [], Reactivity_effects.no_react) - | Ti_expr {expr_static = (ctx, typ); + | Ti_expr {expr_static = (_ctx, typ); expr_reactivity = pi; - expr_reactivity_effect = k; } -> (typ, pi, k) + expr_reactivity_effect = k; _ } -> (typ, pi, k) end let output oc (k, pi, r) = diff --git a/compiler/static/static.ml b/compiler/static/static.ml index 4e04ab0a..718fa258 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 @@ -114,16 +114,16 @@ let static_patt_when_opt_expr_list static_expr combine ctx l = let rec static_expr ctx e = let t = match e.expr_desc with - | Rexpr_local x -> Static + | Rexpr_local _x -> Static - | Rexpr_global x -> Static + | Rexpr_global _x -> Static - | Rexpr_constant im -> Static + | Rexpr_constant _im -> Static | 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,18 +382,18 @@ 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 - | Rexpr_signal (_, Some(k,e1,e2), p) -> + | Rexpr_signal (_, Some(_k,e1,e2), p) -> let typ1 = static_expr ML e1 in let typ2 = static_expr ML e2 in 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; @@ -550,12 +550,12 @@ let static impl = List.iter (fun (_, combine) -> match combine with - | Some(k,e1,e2) -> + | 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..70349bf9 100644 --- a/compiler/static/static_printer.ml +++ b/compiler/static/static_printer.ml @@ -23,8 +23,6 @@ (* $Id$ *) -open Asttypes -open Reac_ast open Def_static let print ty = 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..8e657695 100644 --- a/compiler/typing/reactivity_check.ml +++ b/compiler/typing/reactivity_check.ml @@ -19,22 +19,21 @@ (* file: reactivity_effects.ml *) -open Misc -open Asttypes +open Rml_misc open Reac_ast open Def_types (* Warnings *) -let rec_warning expr k = - if !Misc.reactivity_warning then ( +let rec_warning expr _k = + if !Rml_misc.reactivity_warning then ( Format.fprintf !err_fmt "%aWarning: This expression may produce an instantaneous recursion.@." Location.print expr.expr_loc ) (* (Types_printer.print_to_string Types_printer.print_reactivity k) *) -let loop_warning expr k = - if !Misc.reactivity_warning then ( +let loop_warning expr _k = + if !Rml_misc.reactivity_warning then ( Format.fprintf !err_fmt "%aWarning: This expression may be an instantaneous loop.@." Location.print expr.expr_loc @@ -112,7 +111,7 @@ let well_formed = well_formed Env.empty k -let rec check_expr_one expr = +let check_expr_one expr = let k = expr.expr_reactivity_effect in begin match expr.expr_desc with | Rexpr_loop _ -> @@ -124,19 +123,19 @@ let rec check_expr_one expr = loop_warning expr k; k.react_desc <- React_rec (true, k_body) end - | React_rec (true, k_body) -> () + | React_rec (true, _k_body) -> () | _ -> assert false end | Rexpr_while _ -> begin match k.react_desc with - | React_or [ { react_desc = React_epsilon }; k' ] -> + | React_or [ { react_desc = React_epsilon; _ }; k' ] -> begin match k'.react_desc with | React_rec (false, k_body) -> if not (well_formed k) then begin loop_warning expr k; k.react_desc <- React_rec (true, k_body) end - | React_rec (true, k_body) -> () + | React_rec (true, _k_body) -> () | _ -> assert false end | React_epsilon -> () diff --git a/compiler/typing/reactivity_effects.ml b/compiler/typing/reactivity_effects.ml index 435841e9..069b6b9a 100644 --- a/compiler/typing/reactivity_effects.ml +++ b/compiler/typing/reactivity_effects.ml @@ -19,15 +19,13 @@ (* file: reactivity_effects.ml *) -open Misc -open Asttypes -open Reac_ast +open Rml_misc 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;; @@ -50,7 +48,7 @@ let react_pause () = let react_epsilon () = make_react React_epsilon -let rec react_seq kl = +let react_seq kl = match kl with | [] -> react_epsilon () | [k] -> k @@ -306,7 +304,7 @@ let react_simplify = | [ k' ] -> k' | kl -> { k with react_desc = React_or kl; } end - | React_raw(k1, { react_desc = React_pause }) -> + | React_raw(k1, { react_desc = React_pause; _ }) -> simplify k1 | React_raw (k1, k2) -> { k with react_desc = React_raw(simplify k1, simplify k2) } @@ -400,7 +398,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 = @@ -441,7 +439,7 @@ let react_equal = (* the occur check *) let visited_list, visited = mk_visited () -let rec occur_check_react level index k = +let occur_check_react level index k = let rec check k = let k = react_effect_repr k in match k.react_desc with diff --git a/compiler/typing/types.ml b/compiler/typing/rml_types.ml similarity index 96% rename from compiler/typing/types.ml rename to compiler/typing/rml_types.ml index 5f4bc464..20b54626 100644 --- a/compiler/typing/types.ml +++ b/compiler/typing/rml_types.ml @@ -30,7 +30,7 @@ (* Basic operations over types *) -open Misc +open Rml_misc open Def_types open Reactivity_effects open Global @@ -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 *) @@ -141,7 +141,7 @@ let free_type_vars level ty = free_vars t1; free_vars t2 | Type_product(ty_list) -> List.iter free_vars ty_list - | Type_constr(c, ty_list) -> + | Type_constr(_c, ty_list) -> List.iter free_vars ty_list | Type_link(link) -> free_vars link @@ -202,7 +202,7 @@ and copy_proc_info info = (* instanciation *) -let instance { ts_desc = ty } = +let instance { ts_desc = ty; _ } = let ty_i = copy ty in cleanup (); ty_i @@ -232,7 +232,7 @@ let label_instance { lbl_arg = ty_arg; lbl_res = ty_res; lbl_mut = mut } = (* the occur check *) -let rec occur_check level index ty = +let occur_check level index ty = let rec check ty = let ty = type_repr ty in match ty.type_desc with @@ -242,7 +242,7 @@ let rec occur_check level index ty = else if ty.type_level > level then ty.type_level <- level | Type_arrow(ty1,ty2) -> check ty1; check ty2 | Type_product(ty_list) -> List.iter check ty_list - | Type_constr(name, ty_list) -> + | Type_constr(_name, ty_list) -> List.iter check ty_list | Type_link(link) -> check link | Type_process(ty, info) -> @@ -300,12 +300,12 @@ let rec unify expected_ty actual_ty = | Invalid_argument _ -> raise Unify end | Type_constr - ({ info = Some { constr_abbr=Constr_abbrev(params,body) } }, args), + ({ info = Some { constr_abbr=Constr_abbrev(params,body) }; _ }, args), _ -> unify (expand_abbrev params body args) actual_ty | _, Type_constr - ({ info = Some { constr_abbr=Constr_abbrev(params,body) } },args) -> + ({ info = Some { constr_abbr=Constr_abbrev(params,body) }; _ },args) -> unify expected_ty (expand_abbrev params body args) | Type_process(ty1, pi1), Type_process(ty2, pi2) -> begin try @@ -321,7 +321,7 @@ let rec filter_arrow ty = let ty = type_repr ty in match ty.type_desc with Type_arrow(ty1, ty2) -> ty1, ty2 - | Type_constr({info=Some{constr_abbr=Constr_abbrev(params,body)}},args) -> + | Type_constr({info=Some{constr_abbr=Constr_abbrev(params,body)}; _},args) -> filter_arrow (expand_abbrev params body args) | _ -> let ty1 = new_var () in @@ -334,7 +334,7 @@ let rec filter_product arity ty = match ty.type_desc with Type_product(l) -> if List.length l = arity then l else raise Unify - | Type_constr({info=Some{constr_abbr=Constr_abbrev(params,body)}},args) -> + | Type_constr({info=Some{constr_abbr=Constr_abbrev(params,body)}; _},args) -> filter_product arity (expand_abbrev params body args) | _ -> let ty_list = new_var_list arity in diff --git a/compiler/typing/types_printer.ml b/compiler/typing/types_printer.ml index 5af24e96..f77940ce 100644 --- a/compiler/typing/types_printer.ml +++ b/compiler/typing/types_printer.ml @@ -32,9 +32,7 @@ open Format open Def_types -open Asttypes -open Misc -open Ident +open Rml_misc open Modules open Global_ident open Global @@ -47,7 +45,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 @@ -65,7 +63,7 @@ let max r1 r2 = match r1, r2 with | Cycle, _ | _, Cycle -> Cycle | NoCycle, NoCycle -> NoCycle -let rec max_list rl = +let max_list rl = List.fold_left max NoCycle rl let rec find_root check first k = @@ -111,7 +109,7 @@ let rec print_reactivity ff k = | React_seq l -> fprintf ff "(%a)" (print_reactivity_list "; ") l | React_par l -> fprintf ff "(%a)" (print_reactivity_list " || ") l | React_or l -> fprintf ff "(%a)" (print_reactivity_list " + ") l - | React_raw (k1, { react_desc = React_var }) -> + | React_raw (k1, { react_desc = React_var; _ }) -> fprintf ff "(%a + ..)" print_reactivity k1 | React_raw (k1, k2) -> @@ -187,7 +185,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 = @@ -209,7 +207,7 @@ let print ff ty = react_name#reset; print ff 0 ty; pp_print_flush ff () -let print_scheme ff { ts_desc = ty } = print ff ty +let print_scheme ff { ts_desc = ty; _ } = print ff ty let print_value_type_declaration ff global = let prefix = "val" in @@ -253,7 +251,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 = @@ -297,7 +295,7 @@ let rec print_label_list ff = function let print_type_declaration ff gl = let q = Global.gi gl in let { type_kind = td; - type_arity = ta; } = Global.info gl in + type_arity = ta; _ } = Global.info gl in pp_open_box ff 2; print_type_name ff q ta; begin match td with diff --git a/compiler/typing/typing.ml b/compiler/typing/typing.ml index 18b83821..c3e2f2e6 100644 --- a/compiler/typing/typing.ml +++ b/compiler/typing/typing.ml @@ -31,16 +31,16 @@ (* The type synthesizer *) open Def_types -open Types +open Rml_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 Annot +open Rml_misc +open Rml_annot let unify_expr expr expected_ty actual_ty = try @@ -132,7 +132,7 @@ let rec gen_react is_gen k = (min (gen_react is_gen k1) (gen_react is_gen k2)) | React_run k_body -> k.react_level <- min generic (gen_react is_gen k_body) - | React_rec (checked, k_body) -> + | React_rec (_checked, k_body) -> if not (visited k) then ( if not (Reactivity_check.well_formed k) then begin k.react_desc <- React_rec (true, k_body) @@ -161,7 +161,7 @@ let rec gen_ty is_gen ty = ty.type_level <- List.fold_left (fun level ty -> min level (gen_ty is_gen ty)) notgeneric ty_list - | Type_constr(name, ty_list) -> + | Type_constr(_name, ty_list) -> ty.type_level <- List.fold_left (fun level ty -> min level (gen_ty is_gen ty)) @@ -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 @@ -208,11 +208,11 @@ let check_type_constr_defined loc gl arity = ty_desc.type_constr (* find the type of the constructor C *) -let get_type_of_constructor c loc = +let get_type_of_constructor c _loc = constr_instance (Global.info c) (* find the type of a label *) -let get_type_of_label label loc = +let get_type_of_label label _loc = label_instance (Global.info label) (* tests if an expression is expansive *) @@ -224,8 +224,8 @@ let rec is_nonexpansive expr = | Rexpr_tuple l -> List.for_all is_nonexpansive l | Rexpr_construct (_, None) -> true | Rexpr_construct(_, Some e) -> is_nonexpansive e - | Rexpr_let(rec_flag, bindings, body) -> - List.for_all (fun (pat, expr) -> is_nonexpansive expr) bindings && + | Rexpr_let(_rec_flag, bindings, body) -> + List.for_all (fun (_pat, expr) -> is_nonexpansive expr) bindings && is_nonexpansive body | Rexpr_function _ -> true (* @@ -234,15 +234,15 @@ let rec is_nonexpansive expr = List.for_all (fun (pat, expr) -> is_nonexpansive expr) pat_expr_list | Rexpr_seq(e1, e2) -> is_nonexpansive e2 *) - | Rexpr_ifthenelse(cond, ifso, ifnot) -> + | Rexpr_ifthenelse(_cond, ifso, ifnot) -> is_nonexpansive ifso && is_nonexpansive ifnot - | Rexpr_constraint(e, ty) -> is_nonexpansive e + | Rexpr_constraint(e, _ty) -> is_nonexpansive e | Rexpr_array [] -> true | Rexpr_record lbl_expr_list -> List.for_all (fun (lbl, expr) -> (Global.info lbl).lbl_mut == Immutable && is_nonexpansive expr) lbl_expr_list - | Rexpr_record_access(e, lbl) -> is_nonexpansive e + | Rexpr_record_access(e, _lbl) -> is_nonexpansive e | Rexpr_process _ -> true | Rexpr_pre (_, e) -> is_nonexpansive e | Rexpr_last e -> is_nonexpansive e @@ -299,10 +299,10 @@ let type_of_immediate i = match i with | Const_unit -> type_unit | Const_bool _ -> type_bool - | Const_int(i) -> type_int - | Const_float(i) -> type_float - | Const_char(c) -> type_char - | Const_string(c) -> type_string + | Const_int(_i) -> type_int + | Const_float(_i) -> type_float + | Const_char(_c) -> type_char + | Const_string(_c) -> type_string (* Typing of type expressions *) let type_of_type_expression typ_vars react_vars typexp = @@ -334,7 +334,7 @@ let type_of_type_expression typ_vars react_vars typexp = in constr name (List.map type_of ty_list) - | Rtype_process (ty,k) -> + | Rtype_process (ty,_k) -> process (type_of ty) { proc_react = react_raw (react_epsilon()) (get_react_var ()); } in @@ -356,7 +356,7 @@ let free_of_type ty = let v, rv = vars (v, rv) t in let rv = react_vars rv proc_info in (v, rv) - and react_vars rv k = (new_generic_react_var()) :: rv + and react_vars rv _k = (new_generic_react_var()) :: rv in vars ([], []) ty (* translating a declared type expression into an internal type *) @@ -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 @@ -449,11 +449,11 @@ let rec type_of_pattern global_env local_env patt ty = global_env1; List.iter (fun (x1,ty1) -> - let (x2,ty2) = + let (_x2,ty2) = try - List.find (fun (x,ty) -> (x1 = x)) local_env2 + 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; @@ -466,7 +466,7 @@ let rec type_of_pattern global_env local_env patt ty = [] -> global_env, local_env | (label,label_pat) :: label_pat_list -> let { lbl_arg = ty_arg; - lbl_res = ty_res } = get_type_of_label label patt.patt_loc + lbl_res = ty_res; _ } = get_type_of_label label patt.patt_loc in (* check that the label appears only once *) if List.mem label label_list @@ -514,7 +514,7 @@ let rec type_of_expression env expr = instance (Global.info n).value_typ, react_epsilon() | Rexpr_let (flag, patt_expr_list, e) -> - let gl_env, new_env, k = + let _gl_env, new_env, k = type_let (flag = Recursive) env patt_expr_list in let ty, k' = type_of_expression new_env e in @@ -570,7 +570,7 @@ let rec type_of_expression env expr = in match ty_arg_opt with | None -> ty, react_epsilon() - | Some ty_arg -> constr_arity_err c.gi expr.expr_loc + | Some _ty_arg -> constr_arity_err c.gi expr.expr_loc end | Rexpr_construct (c, Some arg) -> begin @@ -596,7 +596,7 @@ let rec type_of_expression env expr = [] -> () | (label,label_expr) :: label_expr_list -> let { lbl_arg = ty_arg; - lbl_res = ty_res } = get_type_of_label label expr.expr_loc + lbl_res = ty_res; _ } = get_type_of_label label expr.expr_loc in (* check that the label appears only once *) if List.mem label label_list @@ -609,7 +609,7 @@ let rec type_of_expression env expr = ty, react_epsilon() | Rexpr_record_access (e, label) -> - let { lbl_arg = ty_arg; lbl_res = ty_res } = + let { lbl_arg = ty_arg; lbl_res = ty_res; _ } = get_type_of_label label expr.expr_loc in type_expect_eps env e ty_arg; @@ -622,7 +622,7 @@ let rec type_of_expression env expr = [] -> () | (label,label_expr) :: label_expr_list -> let { lbl_arg = ty_arg; - lbl_res = ty_res } = get_type_of_label label expr.expr_loc + lbl_res = ty_res; _ } = get_type_of_label label expr.expr_loc in (* check that the label appears only once *) if List.mem label label_list @@ -708,7 +708,7 @@ let rec type_of_expression env expr = type_unit, react_or [ react_epsilon (); react_loop k ] end - | Rexpr_for(i,e1,e2,flag,e3) -> + | Rexpr_for(i,e1,e2,_flag,e3) -> type_expect_eps env e1 type_int; type_expect_eps env e2 type_int; let k = type_statement (Env.add i (forall [] [] type_int) env) e3 in @@ -823,7 +823,7 @@ let rec type_of_expression env expr = (constr_notabbrev event_ident [ty_emit; (constr_notabbrev list_ident [ty_emit])]) ty_s - | Some (kind,default,comb) -> + | Some (_kind,default,comb) -> type_expect_eps env default ty_get; type_expect_eps env comb (arrow ty_emit (arrow ty_get ty_get)) end; @@ -850,7 +850,7 @@ let rec type_of_expression env expr = let k = remove_local_react_var k in type_unit, k - | Rexpr_fordopar(i,e1,e2,flag,p) -> + | Rexpr_fordopar(i,e1,e2,_flag,p) -> type_expect_eps env e1 type_int; type_expect_eps env e2 type_int; let k = type_statement (Env.add i (forall [] [] type_int) env) p in @@ -968,7 +968,7 @@ let rec type_of_expression env expr = | Rconf_present (s, Some patt) -> let ty_s, k_s = type_of_expression env s in check_epsilon k_s; - let ty_emit, ty_get = + let ty_emit, _ty_get = try filter_event ty_s with Unify -> @@ -1020,7 +1020,7 @@ and type_of_event_config env conf = | Rconf_present (s, Some patt) -> let ty, k = type_of_expression env s in check_epsilon k; - let ty_emit, ty_get = + let _ty_emit, ty_get = try filter_event ty with Unify -> @@ -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 @@ -1045,11 +1045,11 @@ and type_of_event_config env conf = let loc_env2 = type_of_event_config env c2 in List.iter (fun (x1,ty1) -> - let (x2,ty2) = + let (_x2,ty2) = try - List.find (fun (x,ty) -> (x1 = x)) loc_env2 + 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; @@ -1070,7 +1070,7 @@ and type_let is_rec env patt_expr_list = in let kl = List.map2 - (fun (patt,expr) ty -> type_expect let_env expr ty) + (fun (_patt,expr) ty -> type_expect let_env expr ty) patt_expr_list ty_list in @@ -1126,10 +1126,10 @@ let check_no_repeated_constructor loc l = let rec checkrec cont 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 + | ({ gi = name; _ }, _) :: 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 @@ -1137,10 +1137,10 @@ let check_no_repeated_label loc l = let rec checkrec cont 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 + | ({ gi = name; _ },_ , _) :: 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 @@ -1213,7 +1213,7 @@ let check_nongen_values impl_item_list = (fun impl_item -> match impl_item.impl_desc with | Rimpl_let (_, patt_expr_list) -> - List.iter (fun (patt,expr) -> + List.iter (fun (_patt,expr) -> if fst (free_type_vars notgeneric expr.expr_type) <> [] then cannot_generalize_err expr) @@ -1240,7 +1240,7 @@ let type_impl_item info_fmt item = Reactivity_check.check_expr e | Rimpl_let (flag, patt_expr_list) -> - let global_env, local_env, k = + let global_env, _local_env, k = type_let (flag = Recursive) Env.empty patt_expr_list in check_epsilon k; @@ -1265,7 +1265,7 @@ let type_impl_item info_fmt item = unify_event s.gi.id (constr_notabbrev list_ident [ty_emit]) ty_get - | Some (kind,default,comb) -> + | Some (_kind,default,comb) -> let k_default = type_expect Env.empty default ty_get in check_epsilon k_default; let k_gather = diff --git a/compiler/typing/typing_errors.ml b/compiler/typing/typing_errors.ml index aa31bbc3..001e9e1d 100644 --- a/compiler/typing/typing_errors.ml +++ b/compiler/typing/typing_errors.ml @@ -30,9 +30,8 @@ (* Printing of error messages during typing *) -open Misc -open Def_types -open Types +open Rml_misc +open Rml_types open Reac_ast (* type clash *) @@ -58,7 +57,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 +148,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/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/interpreter/lco_ctrl_tree.ml b/interpreter/lco_ctrl_tree.ml index 5dd351f6..0e4d6019 100644 --- a/interpreter/lco_ctrl_tree.ml +++ b/interpreter/lco_ctrl_tree.ml @@ -66,7 +66,7 @@ module Rml_interpreter : Lco_interpreter.S = and 'a step = 'a -> unit and next = unit step list - and current = unit step list + (*and current = unit step list*) and 'a expr = 'a step -> control_tree -> unit step and 'a process = unit -> 'a expr @@ -218,7 +218,7 @@ module Rml_interpreter : Lco_interpreter.S = (**************************************************) (* sched *) (**************************************************) - let rec sched = + let sched = fun () -> match !current with | f :: c -> @@ -291,7 +291,7 @@ module Rml_interpreter : Lco_interpreter.S = (* nothing *) (**************************************) let rml_nothing = - fun f_k ctrl -> + fun f_k _ctrl -> let f_nothing = fun _ -> f_k unit_value @@ -301,7 +301,7 @@ module Rml_interpreter : Lco_interpreter.S = (* compute *) (**************************************) let rml_compute e = - fun f_k ctrl -> + fun f_k _ctrl -> let f_compute = fun _ -> let v = e() in @@ -323,14 +323,14 @@ module Rml_interpreter : Lco_interpreter.S = (* pause_kboi *) (**************************************) let rml_pause_kboi = - fun f_k ctrl -> + fun _f_k _ctrl -> fun _ -> raise RML (**************************************) (* halt *) (**************************************) let rml_halt = - fun f_k ctrl -> + fun _f_k _ctrl -> let f_halt = fun _ -> sched () @@ -344,7 +344,7 @@ module Rml_interpreter : Lco_interpreter.S = (**************************************) (* emit *) (**************************************) - let step_emit f_k ctrl (n,wa,wp) e _ = + let step_emit f_k _ctrl (n,wa,wp) e _ = Event.emit n (e()); wakeUp wa; wakeUp wp; @@ -463,7 +463,7 @@ module Rml_interpreter : Lco_interpreter.S = f_k unit_value else let ref_f = ref None in - let rec f w step_wake_up = + let f w step_wake_up = if is_true() then (ref_f := None; f_k unit_value) @@ -741,7 +741,7 @@ module Rml_interpreter : Lco_interpreter.S = (* present *) (**************************************) - let step_present f_k ctrl (n,_,wp) f_1 f_2 = + let step_present _f_k ctrl (n,_,wp) f_1 f_2 = let rec f_present = fun _ -> if Event.status n @@ -762,7 +762,7 @@ module Rml_interpreter : Lco_interpreter.S = fun f_k ctrl -> let f_1 = p_1 f_k ctrl in let f_2 = p_2 f_k ctrl in - let rec f_present = + let f_present = fun _ -> let evt = expr_evt () in step_present f_k ctrl evt f_1 f_2 unit_value @@ -824,7 +824,7 @@ module Rml_interpreter : Lco_interpreter.S = let rml_seq p_1 p_2 = fun f_k ctrl -> let f_2 = p_2 f_k ctrl in - let f_1 = p_1 (fun x -> f_2 ()) ctrl in + let f_1 = p_1 (fun _x -> f_2 ()) ctrl in f_1 (**************************************) @@ -834,7 +834,7 @@ module Rml_interpreter : Lco_interpreter.S = (* applications partielles. *) let join cpt = - fun f_k ctrl -> + fun f_k _ctrl -> let f_join = fun _ -> incr cpt; @@ -864,8 +864,8 @@ module Rml_interpreter : Lco_interpreter.S = (* merge *) (**************************************) - let rml_merge p_1 p_2 = - fun f_k ctrl -> + let rml_merge _p_1 _p_2 = + fun _f_k _ctrl -> fun _ -> raise RML @@ -889,7 +889,7 @@ let rml_loop p = *) let rml_loop p = - fun f_k ctrl -> + fun _f_k ctrl -> let f_1 = ref dummy_step in let f_loop = p (fun _ -> !f_1 unit_value) ctrl in f_1 := f_loop; @@ -1050,7 +1050,7 @@ let rml_loop p = cond = (fun () -> false); next = [] } - let start_ctrl f_k ctrl f new_ctrl = + let start_ctrl _f_k ctrl f new_ctrl = let f_ctrl = fun _ -> if new_ctrl.alive @@ -1291,7 +1291,7 @@ let rml_loop p = (* when *) (**************************************) - let step_when f_k ctrl (n,wa,wp) f new_ctrl dummy = + let step_when _f_k ctrl (n,wa,wp) f new_ctrl dummy = let w = if ctrl.kind = Top then wa else wp in new_ctrl.cond <- (fun () -> Event.status n); let rec f_when = @@ -1360,8 +1360,8 @@ let rml_loop p = (**************************************) (* when_conf *) (**************************************) - let rml_when_conf expr_cfg = - fun f_k ctrl -> + let rml_when_conf _expr_cfg = + fun _f_k _ctrl -> fun _ -> raise RML @@ -1428,7 +1428,7 @@ let rml_loop p = (* for_dopar *) (**************************************) let join_n cpt = - fun f_k ctrl -> + fun f_k _ctrl -> let f_join_n = fun _ -> decr cpt; @@ -1636,7 +1636,7 @@ let rml_loop p = let term_cpt = ref 0 in fun () -> incr term_cpt; - let f x = + let f _x = decr term_cpt; if !term_cpt > 0 then sched() @@ -1684,7 +1684,7 @@ let rml_loop p = let term_cpt = ref 0 in fun () -> incr term_cpt; - let f x = + let f _x = decr term_cpt; if !term_cpt > 0 then sched() diff --git a/interpreter/lco_ctrl_tree_n.ml b/interpreter/lco_ctrl_tree_n.ml index 6f44795b..05dcae0f 100644 --- a/interpreter/lco_ctrl_tree_n.ml +++ b/interpreter/lco_ctrl_tree_n.ml @@ -65,7 +65,7 @@ module Rml_interpreter : Lco_interpreter.S = and 'a step = 'a -> unit and next = unit step list - and current = unit step list + (*and current = unit step list*) and join_point = int ref option and 'a expr = 'a step -> control_tree -> join_point -> unit step and 'a process = unit -> 'a expr @@ -225,7 +225,7 @@ module Rml_interpreter : Lco_interpreter.S = (**************************************************) (* sched *) (**************************************************) - let rec sched = + let sched = fun () -> match !current with | f :: c -> @@ -297,7 +297,7 @@ module Rml_interpreter : Lco_interpreter.S = (* nothing *) (**************************************) let rml_nothing = - fun f_k ctrl jp -> + fun f_k _ctrl _jp -> let f_nothing = fun _ -> f_k unit_value @@ -307,7 +307,7 @@ module Rml_interpreter : Lco_interpreter.S = (* compute *) (**************************************) let rml_compute e = - fun f_k ctrl jp -> + fun f_k _ctrl _jp -> let f_compute = fun _ -> let v = e() in @@ -318,7 +318,7 @@ module Rml_interpreter : Lco_interpreter.S = (* pause *) (**************************************) let rml_pause = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let f_pause = fun _ -> ctrl.next <- f_k :: ctrl.next; @@ -329,7 +329,7 @@ module Rml_interpreter : Lco_interpreter.S = (* pause_kboi *) (**************************************) let rml_pause_kboi = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let f_pause = fun _ -> ctrl.next_boi <- f_k :: ctrl.next_boi; @@ -340,7 +340,7 @@ module Rml_interpreter : Lco_interpreter.S = (* halt *) (**************************************) let rml_halt = - fun f_k ctrl jp -> + fun _f_k _ctrl _jp -> let f_halt = fun _ -> sched () @@ -354,14 +354,14 @@ module Rml_interpreter : Lco_interpreter.S = (**************************************) (* emit *) (**************************************) - let step_emit f_k ctrl (n,wa,wp) e _ = + let step_emit f_k _ctrl (n,wa,wp) e _ = Event.emit n (e()); wakeUp wa; wakeUp wp; f_k unit_value let rml_emit_val expr_evt e = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let f_emit_val = fun _ -> let evt = expr_evt() in @@ -369,7 +369,7 @@ module Rml_interpreter : Lco_interpreter.S = in f_emit_val let rml_emit_val' evt e = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let f_emit_val = step_emit f_k ctrl evt e in f_emit_val @@ -418,7 +418,7 @@ module Rml_interpreter : Lco_interpreter.S = in f_await_not_top let rml_await_immediate expr_evt = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let f_await = fun _ -> let evt = expr_evt() in @@ -426,7 +426,7 @@ module Rml_interpreter : Lco_interpreter.S = in f_await let rml_await_immediate' evt = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let f_await = step_await_immediate f_k ctrl evt in f_await @@ -435,7 +435,7 @@ module Rml_interpreter : Lco_interpreter.S = (* await_immediate_conf *) (**************************************) let rml_await_immediate_conf expr_cfg = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> if ctrl.kind = Top then let f_await_top = fun _ -> @@ -473,7 +473,7 @@ module Rml_interpreter : Lco_interpreter.S = f_k unit_value else let ref_f = ref None in - let rec f w step_wake_up = + let f w step_wake_up = if is_true() then (ref_f := None; f_k unit_value) @@ -750,7 +750,7 @@ module Rml_interpreter : Lco_interpreter.S = (* present *) (**************************************) - let step_present f_k ctrl (n,_,wp) f_1 f_2 = + let step_present _f_k ctrl (n,_,wp) f_1 f_2 = let rec f_present = fun _ -> if Event.status n @@ -771,7 +771,7 @@ module Rml_interpreter : Lco_interpreter.S = fun f_k ctrl jp -> let f_1 = p_1 f_k ctrl jp in let f_2 = p_2 f_k ctrl jp in - let rec f_present = + let f_present = fun _ -> let evt = expr_evt () in step_present f_k ctrl evt f_1 f_2 unit_value @@ -833,7 +833,7 @@ module Rml_interpreter : Lco_interpreter.S = let rml_seq p_1 p_2 = fun f_k ctrl jp -> let f_2 = p_2 f_k ctrl jp in - let f_1 = p_1 (fun x -> f_2 ()) ctrl None in + let f_1 = p_1 (fun _x -> f_2 ()) ctrl None in f_1 (**************************************) @@ -843,7 +843,7 @@ module Rml_interpreter : Lco_interpreter.S = (* applications partielles. *) let join_n cpt = - fun f_k ctrl -> + fun f_k _ctrl -> let f_join_n = fun _ -> decr cpt; @@ -899,7 +899,7 @@ let rml_loop p = *) let rml_loop p = - fun f_k ctrl jp -> + fun _f_k ctrl _jp -> let f_1 = ref dummy_step in let f_loop = p (fun _ -> !f_1 unit_value) ctrl None in f_1 := f_loop; @@ -910,7 +910,7 @@ let rml_loop p = (**************************************) let rml_loop_n e p = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let cpt = ref 0 in let f_1 = ref dummy_step in let f_loop = @@ -1063,7 +1063,7 @@ let rml_loop p = next = []; next_boi = []; } - let start_ctrl f_k ctrl f new_ctrl = + let start_ctrl _f_k ctrl f new_ctrl = let f_ctrl = fun _ -> if new_ctrl.alive @@ -1085,7 +1085,7 @@ let rml_loop p = (* ---------------------------------------------------------------- *) let rml_until expr_evt p = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let new_ctrl = new_ctrl (Kill f_k) in let f = p (end_ctrl f_k new_ctrl) new_ctrl None in let f_until = @@ -1096,7 +1096,7 @@ let rml_loop p = in f_until let rml_until' (n,_,_) p = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let new_ctrl = new_ctrl (Kill f_k) in let f = p (end_ctrl f_k new_ctrl) new_ctrl None in new_ctrl.cond <- (fun () -> Event.status n); @@ -1107,7 +1107,7 @@ let rml_loop p = (**************************************) let rml_until_conf expr_cfg p = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let new_ctrl = new_ctrl (Kill f_k) in let f = p (end_ctrl f_k new_ctrl) new_ctrl None in let f_until = @@ -1233,7 +1233,7 @@ let rml_loop p = (* control *) (**************************************) let rml_control expr_evt p = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let new_ctrl = new_ctrl Susp in let f = p (end_ctrl f_k new_ctrl) new_ctrl None in let f_control = @@ -1244,7 +1244,7 @@ let rml_loop p = in f_control let rml_control' (n, _, _) p = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let new_ctrl = new_ctrl Susp in let f = p (end_ctrl f_k new_ctrl) new_ctrl None in new_ctrl.cond <- (fun () -> Event.status n); @@ -1254,7 +1254,7 @@ let rml_loop p = (* control_match *) (**************************************) let rml_control_match expr_evt matching p = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let new_ctrl = new_ctrl Susp in let f = p (end_ctrl f_k new_ctrl) new_ctrl None in let f_control = @@ -1266,14 +1266,14 @@ let rml_loop p = in f_control let rml_control_match' (n, _, _) matching p = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let new_ctrl = new_ctrl Susp in let f = p (end_ctrl f_k new_ctrl) new_ctrl None in new_ctrl.cond <- (fun () -> Event.status n && matching (Event.value n)); start_ctrl f_k ctrl f new_ctrl let rml_control_match_conf expr_cfg matching p = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let new_ctrl = new_ctrl Susp in let f = p (end_ctrl f_k new_ctrl) new_ctrl None in let f_control = @@ -1289,7 +1289,7 @@ let rml_loop p = (**************************************) let rml_control_conf expr_cfg p = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let new_ctrl = new_ctrl Susp in let f = p (end_ctrl f_k new_ctrl) new_ctrl None in let f_control = @@ -1304,7 +1304,7 @@ let rml_loop p = (* when *) (**************************************) - let step_when f_k ctrl (n,wa,wp) f new_ctrl dummy = + let step_when _f_k ctrl (n,wa,wp) f new_ctrl dummy = let w = if ctrl.kind = Top then wa else wp in new_ctrl.cond <- (fun () -> Event.status n); let rec f_when = @@ -1352,7 +1352,7 @@ let rml_loop p = start_when let rml_when expr_evt p = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let dummy = ref dummy_step in let new_ctrl = new_ctrl (When dummy) in let f = p (end_ctrl f_k new_ctrl) new_ctrl None in @@ -1364,7 +1364,7 @@ let rml_loop p = start_when let rml_when' evt p = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let dummy = ref dummy_step in let new_ctrl = new_ctrl (When dummy) in let f = p (end_ctrl f_k new_ctrl) new_ctrl None in @@ -1376,8 +1376,8 @@ let rml_loop p = (**************************************) (* when_conf *) (**************************************) - let rml_when_conf expr_cfg = - fun f_k ctrl -> + let rml_when_conf _expr_cfg = + fun _f_k _ctrl -> fun _ -> raise RML @@ -1403,7 +1403,7 @@ let rml_loop p = (**************************************) let rml_while e p = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let f_body = ref dummy_step in let f_while = fun _ -> @@ -1421,7 +1421,7 @@ let rml_loop p = let rml_for e1 e2 dir p = let (incr, cmp) = if dir then incr, (<=) else decr, (>=) in - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let rec f_for i v2 = fun _ -> incr i; @@ -1445,7 +1445,7 @@ let rml_loop p = (**************************************) let rml_fordopar e1 e2 dir p = - fun f_k ctrl jp -> + fun f_k ctrl _jp -> let cpt = ref 0 in let j = join_n cpt f_k ctrl in let f_fordopar = @@ -1656,7 +1656,7 @@ let rml_loop p = Some term_cpt, fun () -> incr term_cpt; - let f x = + let f _x = decr term_cpt; if !term_cpt > 0 then sched() @@ -1705,7 +1705,7 @@ let rml_loop p = Some term_cpt, fun () -> incr term_cpt; - let f x = + let f _x = decr term_cpt; if !term_cpt > 0 then sched() diff --git a/interpreter/lco_ctrl_tree_thread_safe.ml b/interpreter/lco_ctrl_tree_thread_safe.ml index ff0f3213..765a1d60 100644 --- a/interpreter/lco_ctrl_tree_thread_safe.ml +++ b/interpreter/lco_ctrl_tree_thread_safe.ml @@ -24,12 +24,12 @@ (* Remark: taken from lco_ctrl_tree.ml *) (* Description : *) -(* Gestion de plusieur scheduler executé dans des threads *) +(* Gestion de plusieur scheduler executé dans des threads *) (* differents. *) (* *) (* A FAIRE: *) -(* - Vérifier qu'un processus ne peut pas changer de ctrl en cours *) -(* d'exécution (cf pb de pause par exemple). *) +(* - Vérifier qu'un processus ne peut pas changer de ctrl en cours *) +(* d'exécution (cf pb de pause par exemple). *) module Rml_interpreter (* : Lco_interpreter.S *) = @@ -88,7 +88,7 @@ module Rml_interpreter (* : Lco_interpreter.S *) = alive = true; susp = false; children = []; - cond = (fun sched -> false); + cond = (fun _sched -> false); next = []; } in let sched = @@ -105,7 +105,7 @@ module Rml_interpreter (* : Lco_interpreter.S *) = sched -(* récuperer le scheduler courrant *) +(* récuperer le scheduler courrant *) let get_current_sched () = let self = Thread.id (Thread.self()) in Mutex.lock m_sched; @@ -252,7 +252,7 @@ module Rml_interpreter (* : Lco_interpreter.S *) = (**************************************************) (* sched *) (**************************************************) - let rec schedule sched = + let schedule sched = match sched.current with | f :: c -> sched.current <- c; @@ -331,7 +331,7 @@ module Rml_interpreter (* : Lco_interpreter.S *) = (* nothing *) (**************************************) let rml_nothing = - fun f_k ctrl -> + fun f_k _ctrl -> let f_nothing = fun sched _ -> f_k sched unit_value @@ -341,7 +341,7 @@ module Rml_interpreter (* : Lco_interpreter.S *) = (* compute *) (**************************************) let rml_compute e = - fun f_k ctrl -> + fun f_k _ctrl -> let f_compute = fun sched _ -> let v = e() in @@ -363,7 +363,7 @@ module Rml_interpreter (* : Lco_interpreter.S *) = (* halt *) (**************************************) let rml_halt = - fun f_k ctrl -> + fun _f_k _ctrl -> let f_halt = fun sched _ -> schedule sched @@ -372,7 +372,7 @@ module Rml_interpreter (* : Lco_interpreter.S *) = (**************************************) (* emit *) (**************************************) - let step_emit f_k ctrl (sid,n,wa,wp) e sched _ = + let step_emit f_k _ctrl (sid,n,wa,wp) e sched _ = if sid = sched.id then (Event.emit n (e()); wakeUp sched wa; @@ -504,7 +504,7 @@ module Rml_interpreter (* : Lco_interpreter.S *) = f_k sched unit_value else let ref_f = ref None in - let rec f w step_wake_up sched _ = + let f w step_wake_up sched _ = if is_true sched then (ref_f := None; f_k sched unit_value) @@ -704,7 +704,7 @@ module Rml_interpreter (* : Lco_interpreter.S *) = (* present *) (**************************************) - let step_present f_k ctrl (sid,n,_,wp) f_1 f_2 = + let step_present _f_k ctrl (sid,n,_,wp) f_1 f_2 = let rec f_present = fun sched _ -> if sid = sched.id then @@ -726,7 +726,7 @@ module Rml_interpreter (* : Lco_interpreter.S *) = fun f_k ctrl -> let f_1 = p_1 f_k ctrl in let f_2 = p_2 f_k ctrl in - let rec f_present = + let f_present = fun sched _ -> let evt = expr_evt () in step_present f_k ctrl evt f_1 f_2 sched unit_value @@ -788,7 +788,7 @@ module Rml_interpreter (* : Lco_interpreter.S *) = let rml_seq p_1 p_2 = fun f_k ctrl -> let f_2 = p_2 f_k ctrl in - let f_1 = p_1 (fun sched x -> f_2 sched ()) ctrl in + let f_1 = p_1 (fun sched _x -> f_2 sched ()) ctrl in f_1 (**************************************) @@ -798,7 +798,7 @@ module Rml_interpreter (* : Lco_interpreter.S *) = (* applications partielles. *) let join cpt = - fun f_k ctrl -> + fun f_k _ctrl -> let f_join = fun sched _ -> incr cpt; @@ -828,9 +828,9 @@ module Rml_interpreter (* : Lco_interpreter.S *) = (* merge *) (**************************************) - let rml_merge p_1 p_2 = - fun f_k ctrl -> - fun sched _ -> raise RML + let rml_merge _p_1 _p_2 = + fun _f_k _ctrl -> + fun _sched _ -> raise RML (**************************************) @@ -853,7 +853,7 @@ let rml_loop p = *) let rml_loop p = - fun f_k ctrl -> + fun _f_k ctrl -> let f_1 = ref dummy_step in let f_loop = p (fun sched _ -> !f_1 sched unit_value) ctrl in f_1 := f_loop; @@ -999,10 +999,10 @@ let rml_loop p = alive = true; susp = false; children = []; - cond = (fun sched -> false); + cond = (fun _sched -> false); next = [] } - let start_ctrl f_k ctrl f new_ctrl = + let start_ctrl _f_k ctrl f new_ctrl = let f_ctrl = fun sched _ -> if new_ctrl.alive @@ -1205,7 +1205,7 @@ let rml_loop p = (* when *) (**************************************) - let step_when f_k ctrl (sid,n,wa,wp) f new_ctrl dummy = + let step_when _f_k ctrl (sid,n,wa,wp) f new_ctrl dummy = let w = if ctrl.kind = Top then wa else wp in new_ctrl.cond <- (fun sched -> @@ -1283,9 +1283,9 @@ let rml_loop p = (**************************************) (* when_conf *) (**************************************) - let rml_when_conf expr_cfg = - fun f_k ctrl -> - fun sched _ -> raise RML + let rml_when_conf _expr_cfg = + fun _f_k _ctrl -> + fun _sched _ -> raise RML (**************************************) @@ -1351,7 +1351,7 @@ let rml_loop p = (* for_dopar *) (**************************************) let join_n cpt = - fun f_k ctrl -> + fun f_k _ctrl -> let f_join_n = fun sched _ -> decr cpt; @@ -1529,7 +1529,7 @@ let rml_loop p = let term_cpt = ref 0 in fun () -> incr term_cpt; - let f sched x = + let f sched _x = decr term_cpt; if !term_cpt > 0 then schedule sched @@ -1581,7 +1581,7 @@ let rml_loop p = let term_cpt = ref 0 in fun () -> incr term_cpt; - let f sched x = + let f sched _x = decr term_cpt; if !term_cpt > 0 then schedule sched diff --git a/interpreter/lco_rewrite.ml b/interpreter/lco_rewrite.ml index ca4ae910..08260212 100644 --- a/interpreter/lco_rewrite.ml +++ b/interpreter/lco_rewrite.ml @@ -23,7 +23,7 @@ (* created: 2005-04-29 *) (* Description : *) -(* Implantation à la Rewrite de Junior pour lco. *) +(* Implantation à la Rewrite de Junior pour lco. *) (* Ajout des valeurs pour traiter def_dyn et def_and_dyn *) (* $Id: lco_rewrite.ml,v 1.1 2005/04/30 16:49:15 mandel Exp $ *) @@ -151,7 +151,7 @@ module Rml_interpreter : Lco_interpreter.S = (**************************************) (* halt_kboi *) (**************************************) - let rec rml_halt_kboi = rml_halt + let rml_halt_kboi = rml_halt (**************************************) (* emit *) @@ -519,7 +519,7 @@ module Rml_interpreter : Lco_interpreter.S = let status, p = body_array.(i) in match status with | SUSP -> - let (alpha, p') as body = p() in + let (alpha, _p') as body = p() in body_array.(i) <- body; par_status := gamma !par_status alpha | _ -> @@ -975,7 +975,7 @@ module Rml_interpreter : Lco_interpreter.S = let status, p = body_array.(i) in match status with | SUSP -> - let (alpha, p') as body = p() in + let (alpha, _p') as body = p() in body_array.(i) <- body; par_status := gamma !par_status alpha | _ -> @@ -1161,7 +1161,7 @@ module Rml_interpreter : Lco_interpreter.S = eoi := false; move := false; None - | TERM v, _ -> Some () + | TERM _v, _ -> Some () | SUSP, _ -> assert false in rml_react diff --git a/interpreter/lk_implem.ml b/interpreter/lk_implem.ml index b141add2..698a19cb 100644 --- a/interpreter/lk_implem.ml +++ b/interpreter/lk_implem.ml @@ -222,7 +222,7 @@ module Lk_interpreter: Lk_interpreter.S = (**************************************) (* pause_kboi *) (**************************************) - let rml_pause_kboi k ctrl _ = + let rml_pause_kboi _k _ctrl _ = raise RML (**************************************) @@ -277,7 +277,7 @@ module Lk_interpreter: Lk_interpreter.S = (* await_immediate *) (**************************************) let step_await_immediate_top (n,wa,_) k = - let rec self _ = + let self _ = if Event.status n then k () diff --git a/interpreter/sig_env.ml b/interpreter/sig_env.ml index 7f2db824..136dc399 100644 --- a/interpreter/sig_env.ml +++ b/interpreter/sig_env.ml @@ -175,7 +175,7 @@ module Class : S = (* maj de l'etat de l'objet si necessaire et revoie "true" - s'il doit etre mis a jour à l'instant suivant *) + s'il doit etre mis a jour à l'instant suivant *) method update = if to_update then begin diff --git a/rml.opam b/rml.opam new file mode 100644 index 00000000..224b5069 --- /dev/null +++ b/rml.opam @@ -0,0 +1,28 @@ +version: "rml-1.09.08-dev" +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] + ["dune" "test" "-j" jobs] {with-test} +] + +install: [ + ["dune" "install" "-j" jobs] +] + +depends: [ + "ocaml" {>= "4.13.0"} + "dune" {>= "1.6.3"} + "menhir" + "alcotest" {with-test} +] + +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/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..7ef8ac60 --- /dev/null +++ b/test/dune @@ -0,0 +1,7 @@ +(rule (target await.ml) (deps (file await.rml) ../compiler/rmlc.exe) (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 diff --git a/tools/rmldep/Makefile b/tools/rmldep/Makefile index 8a82667a..bdd94d9f 100644 --- a/tools/rmldep/Makefile +++ b/tools/rmldep/Makefile @@ -7,17 +7,17 @@ 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/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/parser.cmo \ - ../../compiler/parsing/parse.cmo \ + ../../compiler/parsing/rml_syntaxerr.cmo \ + ../../compiler/parsing/rml_lexer.cmo \ + ../../compiler/parsing/rml_parser.cmo \ + ../../compiler/parsing/rml_parse.cmo \ depend.cmo \ rmldep.cmo diff --git a/tools/rmldep/depend.ml b/tools/rmldep/depend.ml index 6fa2e93c..863d46d7 100644 --- a/tools/rmldep/depend.ml +++ b/tools/rmldep/depend.ml @@ -41,8 +41,6 @@ (* $Id$ *) -open Format -open Location open Parse_ident open Parse_ast @@ -52,7 +50,7 @@ module StringSet = Set.Make(struct type t = string let compare = compare end) let free_structure_names = ref StringSet.empty -let rec addmodule bv lid = +let addmodule bv lid = match lid with Pdot (s,_) -> if not (StringSet.mem s bv) @@ -78,9 +76,9 @@ let add_type_declaration bv td = | Ptype_abstract -> () | Ptype_rebind te -> add_type bv te | Ptype_variant cstrs -> - List.iter (fun (c, args) -> add_opt add_type bv args) cstrs + List.iter (fun (_c, args) -> add_opt add_type bv args) cstrs | Ptype_record lbls -> - List.iter (fun (l, mut, ty) -> add_type bv ty) lbls + List.iter (fun (_l, _mut, ty) -> add_type bv ty) lbls let rec add_pattern bv pat = match pat.ppatt_desc with @@ -138,8 +136,8 @@ let rec add_expr bv exp = | Pexpr_par(e1, e2) -> add_expr bv e1; add_expr bv e2 | 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; + List.iter (fun (_i, oe) -> add_opt add_type bv oe) ioel; + 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 +146,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 +161,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 +170,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 +181,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 @@ -193,11 +191,11 @@ and add_signature bv = function and add_sig_item bv item = match item.pintf_desc with - Pintf_val(id, vd) -> + Pintf_val(_id, vd) -> add_type bv vd; bv | Pintf_type dcls -> List.iter (fun (_, _, td) -> add_type_declaration bv td) dcls; bv - | Pintf_exn(id, oty) -> + | Pintf_exn(_id, oty) -> add_opt add_type bv oty; bv | Pintf_open s -> if not (StringSet.mem s bv) @@ -214,14 +212,14 @@ and add_struct_item bv item = | Pimpl_let(_, pel) -> 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; + List.iter (fun (_i, oe) -> add_opt add_type bv oe) ioel; + 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 - | Pimpl_exn(id, oty) -> + | Pimpl_exn(_id, oty) -> add_opt add_type bv oty; bv - | Pimpl_exn_rebind(id, l) -> + | Pimpl_exn_rebind(_id, l) -> add bv l; bv | Pimpl_open s -> if not (StringSet.mem s bv) diff --git a/tools/rmldep/rmldep.ml b/tools/rmldep/rmldep.ml index 6ea2ee85..f3cddf7e 100644 --- a/tools/rmldep/rmldep.ml +++ b/tools/rmldep/rmldep.ml @@ -41,9 +41,6 @@ (* $Id$ *) open Format -open Location -open Parse_ast - (* Print the dependencies *) @@ -69,7 +66,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 +190,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,19 +198,19 @@ 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 *) 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 *) @@ -232,7 +229,7 @@ let ml_file_dependencies source_file = if List.exists (fun ext -> Sys.file_exists (basename ^ ext)) !mli_synonyms then let cmi_name = basename ^ ".rzi" in ([cmi_name], [cmi_name]) else ([], []) in - let (byt_deps, opt_deps) = + let (byt_deps, _opt_deps) = Depend.StringSet.fold find_dependency !Depend.free_structure_names init_deps in print_dependencies (basename ^ ".ml") byt_deps @@ -252,7 +249,7 @@ let mli_file_dependencies source_file = print_raw_dependencies source_file !Depend.free_structure_names end else begin let basename = Filename.chop_extension source_file in - let (byt_deps, opt_deps) = + let (byt_deps, _opt_deps) = Depend.StringSet.fold find_dependency !Depend.free_structure_names ([], []) in print_dependencies (basename ^ ".rzi") byt_deps @@ -273,12 +270,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 -> 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_controller.rml b/toplevel/rmltop_controller.rml index 24234f50..a1dbf361 100644 --- a/toplevel/rmltop_controller.rml +++ b/toplevel/rmltop_controller.rml @@ -23,7 +23,7 @@ signal suspend, resume default () gather (fun () () -> ());; -signal step default 1 gather (fun x y -> x);; +signal step default 1 gather (fun x _y -> x);; let ref_to_sig ref_s s = match !ref_s with 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_main.ml b/toplevel/rmltop_main.ml index 5ce2c4e7..3d2ea30f 100644 --- a/toplevel/rmltop_main.ml +++ b/toplevel/rmltop_main.ml @@ -22,7 +22,7 @@ (* created: 2005-10-25 *) let exec_machine_controller () = - let _ = Sys.signal Sys.sigalrm (Sys.Signal_handle (fun x -> ())) in + let _ = Sys.signal Sys.sigalrm (Sys.Signal_handle (fun _x -> ())) in let debut = ref 0.0 in let sleep = ref 0.0 in let react = diff --git a/toplevel/rmltop_reactive_machine.ml b/toplevel/rmltop_reactive_machine.ml index 3b1d8024..03a19095 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 = @@ -42,8 +42,8 @@ let rml_react x = Rmltop_global.unlock() -let sampling_hook min () = () -let n_hook n () = () +let sampling_hook _min () = () +let n_hook _n () = () let debug_hook () = () let rml_exec boi_hook p =