Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
b9d8ed6
enabling native-compiler
IBBXEF Jun 5, 2026
33e6df3
Created placeholder functions for compiling to mlf
IBBXEF Jun 5, 2026
a8e57bd
Is now able to compile strings, floats and sequences of mllambda to m…
IBBXEF Jun 5, 2026
94ae065
the generated mlf code is now syntaxically correct
IBBXEF Jun 5, 2026
cb7f597
Now compiles lambda functions
IBBXEF Jun 5, 2026
032618d
Now compiles primitives
IBBXEF Jun 5, 2026
90d59b1
the mlf compiler is now called by the general compile function
IBBXEF Jun 8, 2026
cb50f17
fixed two naming errors
IBBXEF Jun 8, 2026
8371873
Now compiles local and global variable names, applications and let st…
IBBXEF Jun 8, 2026
016f56b
Now compiles if and letrec statements, and fixed a bug with global names
IBBXEF Jun 8, 2026
b7b2e58
Now compiles (at least define) let cases
IBBXEF Jun 8, 2026
71ce888
Now compiles global table fix types (whatever that is)
IBBXEF Jun 8, 2026
3c82ab5
Now compiles global table norm and fixed a few bugs
IBBXEF Jun 8, 2026
3096888
Fixed a capitalization error and a few inconsistencies
IBBXEF Jun 8, 2026
e44f3fa
Now compiles arrays and reference assignment
IBBXEF Jun 8, 2026
986d909
Fixed an arror where global names where wrongly assumed to come from …
IBBXEF Jun 8, 2026
3cb4324
Fixed a bug introduced by the last fix where some global variable wou…
IBBXEF Jun 8, 2026
ae5d9df
refactored some of the code and fixed a bug where () would be transla…
IBBXEF Jun 8, 2026
9758486
rt1 and rt2 are now correctly marked as coming from the Nativelib module
IBBXEF Jun 8, 2026
8c7d090
refactored pp_gname_plf
IBBXEF Jun 8, 2026
65bcffb
Fixed an error whith double dollar signs before variables
IBBXEF Jun 9, 2026
4958f1c
Now compiles match statements
IBBXEF Jun 9, 2026
4418d86
Now compiles primitives Mk_fix and Mk_var
IBBXEF Jun 9, 2026
a69e51a
Fixed a double dollar bug and some values being wrongly compiled as f…
IBBXEF Jun 9, 2026
75dac4f
Fixed multiple cases where definition would be compiled as functions,…
IBBXEF Jun 9, 2026
8b53077
Now compiles global cofix tables and all global declaration !
IBBXEF Jun 9, 2026
cbfbc65
Now compiles MLconstruct and MLisaccu, and thus, all mllambda express…
IBBXEF Jun 9, 2026
9b61c4f
Now compiles lazy values correctly
IBBXEF Jun 9, 2026
ca7c357
Started to make a function to call the mlf compiler
IBBXEF Jun 9, 2026
373d76d
Now correctly compiles uints and floats in 32 and 64 bits architectures
IBBXEF Jun 9, 2026
a1da20f
Now correctly compiles negative ints
IBBXEF Jun 9, 2026
a798691
Refactored code and improved generated code identation
IBBXEF Jun 9, 2026
e51d2a4
fixed bugs with uint compilation, refactored code, removed useless pa…
IBBXEF Jun 9, 2026
5e0e06e
refactored and fixed typos
IBBXEF Jun 10, 2026
ae06017
Now compiles field access correctly
IBBXEF Jun 10, 2026
be19eed
the malfunction compiler is now called
IBBXEF Jun 10, 2026
8d8948b
letrec are now compiled properly
IBBXEF Jun 10, 2026
8725663
imports from generated ml file now imports from the equivalent mlf file
IBBXEF Jun 10, 2026
1363bea
writing a mlf program now also generate a .mli file specifying its in…
IBBXEF Jun 10, 2026
7c6ad82
The mlf compilation now works
IBBXEF Jun 10, 2026
47d769d
Cleaned code and did a small fix
IBBXEF Jun 10, 2026
7838606
ML primitives without arguments are now correctly compiled as values …
IBBXEF Jun 10, 2026
ce8db18
Compilation now works perfectly
IBBXEF Jun 10, 2026
5fdd3d6
Cleaned generated code and fixed ml primitives being imported from th…
IBBXEF Jun 11, 2026
edf6f4e
Fixed Lazy.force being incorrectly compiled
IBBXEF Jun 11, 2026
34c00ee
Fixed an error in string compilation
IBBXEF Jun 11, 2026
f8b276e
Generated interface is now compatible with Ocaml native compilation
IBBXEF Jun 11, 2026
30775d3
.mli interfaces now contains defined types
IBBXEF Jun 11, 2026
6bfea20
refactored code, and generated interfaces now have types more coheren…
IBBXEF Jun 12, 2026
6f9b70f
Now correctly compiles floats, Array.get and cofix
IBBXEF Jun 12, 2026
984529b
Now correctly compiles cofix
IBBXEF Jun 13, 2026
ca19c09
removed now unecessary code
IBBXEF Jun 15, 2026
de0fe96
Now correctly handles nan and infinity
IBBXEF Jun 15, 2026
f888a51
Now handles decode_string and compilation in specific folders
IBBXEF Jun 15, 2026
c731fa3
Went back to simpler mli generation as interfacing with Ocaml will no…
IBBXEF Jun 15, 2026
fb1135e
removed Ocaml compilation
IBBXEF Jun 16, 2026
20f7b06
Added cleaner debug messages and error handling
IBBXEF Jun 16, 2026
5da2bc1
removed most of Ocaml code generation
IBBXEF Jun 16, 2026
69ba091
More cleanup, reused now free function names, and moved Lazy.force in…
IBBXEF Jun 16, 2026
6e46e62
more renaming
IBBXEF Jun 16, 2026
f0f9fbd
fixed identation
IBBXEF Jun 16, 2026
4f54bc5
pp_lname now adds truly returns the variable name in mlf (with the do…
IBBXEF Jun 16, 2026
456c5d5
replaced arrays with normal memory blocks
IBBXEF Jun 16, 2026
46f7191
removed Obj_magic primitive as it is no longer needed
IBBXEF Jun 16, 2026
490074a
The compilation of logical and is now cleaner
IBBXEF Jun 16, 2026
2fc7811
fixed a comment
IBBXEF Jun 16, 2026
6863127
removed some support for the creation of clotures on primitives
IBBXEF Jun 16, 2026
958a006
added a space to make code generation clearer
IBBXEF Jun 16, 2026
f5bd314
added a MLmatch_noaccu contructor to mllambda
IBBXEF Jun 17, 2026
9ddba0a
removed annotations from matches as they are no longer needed
IBBXEF Jun 17, 2026
b293a83
removed annotations from Gletcase as they are no longer needed
IBBXEF Jun 17, 2026
580cd79
vendor malfunction
IBBXEF Jun 17, 2026
6f83b24
updated docker files
IBBXEF Jun 17, 2026
11b4496
removed malfunction vendor
IBBXEF Jun 17, 2026
0a54420
updated Dockerfile
IBBXEF Jun 17, 2026
2a56529
The compilation of Uint, float, and pstring into mlf is now separated…
IBBXEF Jun 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ variables:
# The $hash is the first 10 characters of the md5 of the Dockerfile. e.g.
# echo $(md5sum dev/ci/docker/old_ubuntu_lts/Dockerfile | head -c 10)
# echo $(md5sum dev/ci/docker/edge_ubuntu/Dockerfile | head -c 10)
BASE_CACHEKEY: "old_ubuntu_lts-V2026-06-10-d4125f9d9e"
EDGE_CACHEKEY: "edge_ubuntu-V2026-06-10-0c389ac2f4"
BASE_CACHEKEY: "old_ubuntu_lts-V2026-06-17-3f4ccef838"
EDGE_CACHEKEY: "edge_ubuntu-V2026-06-17-d451657c63"
BASE_IMAGE: "$CI_REGISTRY_IMAGE:$BASE_CACHEKEY"
EDGE_IMAGE: "$CI_REGISTRY_IMAGE:$EDGE_CACHEKEY"

Expand Down
2 changes: 1 addition & 1 deletion config/dune
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
%{project_root}/dev/header.c
; Needed to generate include lists for coq_makefile
plugin_list)
(action (chdir %{project_root} (run %{project_root}/tools/configure/configure.exe -quiet -relocatable))))
(action (chdir %{project_root} (run %{project_root}/tools/configure/configure.exe -quiet -relocatable -native-compiler yes))))
3 changes: 2 additions & 1 deletion dev/ci/docker/edge_ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ RUN mkdir -p ~/.config/dune && printf '(lang dune 2.1)\n(jobs %s)\n' $NJOBS > ~/

# Edge opam is the set of edge packages required by Coq
ENV COMPILER="4.14.2" \
BASE_OPAM="zarith.1.14 ounit2.2.2.7 camlzip.1.14" \
BASE_OPAM="zarith.1.14 ounit2.2.2.7 camlzip.1.14 ocaml-compiler-libs" \
CI_OPAM="ocamlgraph.2.0.0 cppo.1.8.0" \
BASE_OPAM_EDGE="dune.3.23.1 dune-build-info.3.23.1 dune-release.2.2.1 ocamlfind.1.9.8 odoc.3.2.1" \
CI_OPAM_EDGE="memprof-limits.0.3.0 elpi.3.7.1 ppx_import.1.12.0 cmdliner.2.1.1 sexplib.v0.16.0 ppx_sexp_conv.v0.16.0 ppx_hash.v0.16.0 ppx_compare.v0.16.0 ppx_deriving_yojson.3.9.1 yojson.2.2.2 uri.4.4.0 ppx_yojson_conv.v0.16.0 ppx_inline_test.v0.16.1 ppx_assert.v0.16.0 ppx_optcomp.v0.16.0 lsp.1.26.0 sel.0.8.0" \
Expand All @@ -68,6 +68,7 @@ RUN opam init -a --disable-sandboxing --bare && eval $(opam env) && \
opam repo add archive git+https://github.com/ocaml/opam-repository-archive && \
opam update && \
opam install $BASE_OPAM $BASE_OPAM_EDGE $COQIDE_OPAM_EDGE $CI_OPAM $CI_OPAM_EDGE && \
opam pin add git+https://github.com/IBBXEF/malfunction#recusive_types && \
opam clean -a -c

# set the locale for the benefit of Python
Expand Down
4 changes: 3 additions & 1 deletion dev/ci/docker/old_ubuntu_lts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ RUN mkdir -p ~/.config/dune && printf '(lang dune 2.1)\n(jobs %s)\n' $NJOBS > ~/
ENV COMPILER="4.14.0"

# Common OPAM packages
ENV BASE_OPAM="zarith.1.11 ounit2.2.2.6 yojson.1.7.0 camlzip.1.10" \
ENV BASE_OPAM="zarith.1.11 ounit2.2.2.6 yojson.1.7.0 camlzip.1.10 ocaml-compiler-libs" \
CI_OPAM="ocamlgraph.2.0.0 cppo.1.6.9" \
BASE_ONLY_OPAM="dune.3.21.1 stdlib-shims.0.1.0 ocamlfind.1.9.1 odoc.3.2.1 num.1.4"

Expand All @@ -65,6 +65,7 @@ RUN opam init -a --disable-sandboxing --compiler="$COMPILER" default https://opa
opam repo add archive git+https://github.com/ocaml/opam-repository-archive && \
opam update && \
opam install $BASE_OPAM $COQIDE_OPAM $CI_OPAM $BASE_ONLY_OPAM && \
opam pin add git+https://github.com/IBBXEF/malfunction#recusive_types && \
opam clean -a -c && \
find ~ '(' -name '*.cmt' -o -name '*.cmti' ')' -delete

Expand All @@ -76,6 +77,7 @@ RUN opam switch create "${COMPILER}+32bit" \
opam update && \
i386 env CC='gcc -m32' opam install zarith.1.11 && \
opam install $BASE_OPAM && \
opam pin add git+https://github.com/IBBXEF/malfunction#recusive_types && \
opam clean -a -c && \
find ~ '(' -name '*.cmt' -o -name '*.cmti' ')' -delete

Expand Down
2 changes: 2 additions & 0 deletions kernel/float64.mli
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ val to_string : t -> string

val compile : t -> string

val compile_mlf : t -> string

val of_float : float -> t

(** All NaNs are normalized to [Stdlib.nan].
Expand Down
9 changes: 9 additions & 0 deletions kernel/float64_common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ let of_string = float_of_string
let compile f =
Printf.sprintf "Float64.of_float (%s)" (to_hex_string f)

(* Compiles a float to malfunction code *)
let compile_mlf f = (* malfunction does not support writing -1.1, so we have to be careful *)
if Float.is_nan f then "(apply (global $Float64 $of_float) nan)"
else if Float.is_infinite f then begin
if f < 0. then Printf.sprintf "(apply (global $Float64 $of_float) neg_infinity)"
else Printf.sprintf "(apply (global $Float64 $of_float) infinity)"
end else if f < 0. then Printf.sprintf "(apply (global $Float64 $of_float) (neg.f64 %.17e))" (-. f) (* malfunction supports scientific notation *)
else Printf.sprintf "(apply (global $Float64 $of_float) %.17e)" f

let of_float f = f

let to_float f = if is_nan f then nan else f
Expand Down
2 changes: 2 additions & 0 deletions kernel/float64_common.mli
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ val to_string : t -> string

val compile : t -> string

val compile_mlf : t -> string

val of_float : float -> t

(** All NaNs are normalized to [Stdlib.nan].
Expand Down
Loading
Loading