Files
rose-ash/lib/ocaml
giles 551ed44f7f
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 35s
ocaml: phase 5.1 array literals [|...|] + lis.ml baseline (LIS = 6)
Added parser support for OCaml array literal syntax:

  [| e1; e2; ...; en |]  -->  Array.of_list [e1; e2; ...; en]
  [||]                   -->  Array.of_list []

Desugaring keeps the array representation unchanged (ref-of-list)
since Array.of_list is a no-op constructor for that backing.

Tokenizer emits [, |, |, ] as separate ops; parser detects [ followed
by | and enters array-literal mode, terminating on |].

Baseline lis.ml exercises the syntax:

  let lis arr =
    let n = Array.length arr in
    let dp = Array.make n 1 in
    for i = 1 to n - 1 do
      for j = 0 to i - 1 do
        if arr.(j) < arr.(i) && dp.(j) + 1 > dp.(i) then
          dp.(i) <- dp.(j) + 1
      done
    done;
    let best = ref 0 in
    for i = 0 to n - 1 do
      if dp.(i) > !best then best := dp.(i)
    done;
    !best

  lis [|10; 22; 9; 33; 21; 50; 41; 60; 80|] = 6

137 baseline programs total.
2026-05-10 03:41:19 +00:00
..