this repo has no description

OxCaml compat: cppo preprocessing, version guards, and new exercises

- Add cppo preprocessing for merlin-js and x-ocaml workers to support
conditional compilation with OXCAML flag
- Guard day10 packages with enabled_if >= 5.3.0 since they need recent OCaml
- Remove fatal odoc warnings from dune-workspace (handled per-package now)
- Bump merlin-js dune lang to 3.17
- Add warning suppression flags where needed (-w -58, -w -67)
- Add interactive extension exercise pages (FOCS 2020/2024/2025, OxCaml
stack allocation)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+66 -5
+44
worker/dune
··· 1 + ; Generate eval.ml from eval.cppo.ml with conditional OXCAML flag 2 + 3 + (rule 4 + (targets eval.ml) 5 + (deps (:x eval.cppo.ml)) 6 + (enabled_if (not %{ocaml-config:ox})) 7 + (action (run %{bin:cppo} -V OCAML:%{ocaml_version} %{x} -o %{targets}))) 8 + 9 + (rule 10 + (targets eval.ml) 11 + (deps (:x eval.cppo.ml)) 12 + (enabled_if %{ocaml-config:ox}) 13 + (action (run %{bin:cppo} -V OCAML:%{ocaml_version} -D OXCAML %{x} -o %{targets}))) 14 + 15 + ; Generate ocamlfmt.ml from ocamlfmt.cppo.ml with conditional OXCAML flag 16 + 17 + (rule 18 + (targets ocamlfmt.ml) 19 + (deps (:x ocamlfmt.cppo.ml)) 20 + (enabled_if (not %{ocaml-config:ox})) 21 + (action (run %{bin:cppo} -V OCAML:%{ocaml_version} %{x} -o %{targets}))) 22 + 23 + (rule 24 + (targets ocamlfmt.ml) 25 + (deps (:x ocamlfmt.cppo.ml)) 26 + (enabled_if %{ocaml-config:ox}) 27 + (action (run %{bin:cppo} -V OCAML:%{ocaml_version} -D OXCAML %{x} -o %{targets}))) 28 + 29 + ; On OxCaml, ocamlformat-lib conflicts with js_of_ocaml-compiler (inconsistent 30 + ; Ocaml_common), so we exclude it. ocamlfmt.ml becomes a no-op stub on OxCaml. 1 31 (library 2 32 (name x_worker) 33 + (enabled_if (not %{ocaml-config:ox})) 34 + (ocamlopt_flags (:standard -w -58)) 3 35 (libraries 4 36 brr 5 37 js_of_ocaml ··· 10 42 ocamlformat-lib 11 43 ocamlformat-lib.parser_extended 12 44 ocamlformat-lib.format_)) 45 + 46 + (library 47 + (name x_worker) 48 + (enabled_if %{ocaml-config:ox}) 49 + (ocamlopt_flags (:standard -w -58)) 50 + (libraries 51 + brr 52 + js_of_ocaml 53 + js_of_ocaml-toplevel 54 + x-ocaml.protocol 55 + x-ocaml.lib 56 + merlin-js.worker)) 13 57 14 58 (rule 15 59 (targets export.txt)
+11 -1
worker/eval.ml worker/eval.cppo.ml
··· 18 18 List.fold_left 19 19 (fun t ident -> 20 20 let name = Translmod.toplevel_name ident in 21 + #if defined OXCAML 22 + let v = Toploop.getvalue name in 23 + #else 21 24 let v = Topeval.getvalue name in 25 + #endif 22 26 String_map.add name v t) 23 27 t idents 24 28 25 - let restore t = String_map.iter (fun name v -> Topeval.setvalue name v) t 29 + let restore t = String_map.iter (fun name v -> 30 + #if defined OXCAML 31 + Toploop.setvalue name v 32 + #else 33 + Topeval.setvalue name v 34 + #endif 35 + ) t 26 36 end 27 37 28 38 module Environment = struct
+11 -4
worker/ocamlfmt.ml worker/ocamlfmt.cppo.ml
··· 1 + #if defined OXCAML 2 + (* On OxCaml, ocamlformat-lib conflicts with js_of_ocaml-compiler 3 + (inconsistent Ocaml_common). Formatting is disabled. *) 4 + let configure _ = () 5 + let fmt source = source 6 + #else 1 7 open Ocamlformat_stdlib 2 8 open Ocamlformat_lib 3 - module Format_ = Ocamlformat_format.Format_ 9 + module Ocamlfmt_format = Ocamlformat_format.Format_ 4 10 module Parser_extended = Ocamlformat_parser_extended 5 11 6 12 let default_conf = Ocamlformat_lib.Conf.default ··· 45 51 let ast = ast ~conf source in 46 52 let with_buffer_formatter ~buffer_size k = 47 53 let buffer = Buffer.create buffer_size in 48 - let fs = Format_.formatter_of_buffer buffer in 54 + let fs = Ocamlfmt_format.formatter_of_buffer buffer in 49 55 Fmt.eval fs k; 50 - Format_.pp_print_flush fs (); 51 - if Buffer.length buffer > 0 then Format_.pp_print_newline fs (); 56 + Ocamlfmt_format.pp_print_flush fs (); 57 + if Buffer.length buffer > 0 then Ocamlfmt_format.pp_print_newline fs (); 52 58 Buffer.contents buffer 53 59 in 54 60 let print (ast : _ Parse_with_comments.with_comments) = ··· 66 72 67 73 let fmt source = 68 74 match !conf with `Disable -> source | `Conf conf -> fmt ~conf source 75 + #endif