Skip to content

Adjust desugaring of OCaml to CakeML AST#1345

Merged
tanyongkiam merged 5 commits intomasterfrom
ocaml-parser
Mar 8, 2026
Merged

Adjust desugaring of OCaml to CakeML AST#1345
tanyongkiam merged 5 commits intomasterfrom
ocaml-parser

Conversation

@dnezam
Copy link
Copy Markdown
Contributor

@dnezam dnezam commented Mar 2, 2026

Summary:
(-) => (~-) instead of Int.(~)
(-.) => (~-.) instead of Double.(~)
OCaml indexing => Array.get instead of Array.sub
true => Cake.Bool.true (instead of True)
false => Cake.Bool.false (instead of False)

The idea is to desugar into the OCaml interface (which is defined early in
Candle), instead of the CakeML interface (which Candle shadows as soon as
possible), enabling a more consistent interface.

Hopefully by desugaring {true,false} to "Cake.Bool.{true,false}" users can use
"True" and "False" as constructor names without making the boolean literals unusable.

@dnezam dnezam added the test failing regression test failed on the latest commit of this pull request label Mar 3, 2026
Summary:
(-)  => (~-)  instead of Int.(~)
(-.) => (~-.) instead of Double.(~)
OCaml indexing => Array.get instead of Array.sub
true => Cake.Bool.true (instead of True)
false => Cake.Bool.false (instead of False)

The idea is to desugar into the OCaml interface (which is defined early in
Candle), instead of the CakeML interface (which Candle shadows as soon as
possible), enabling a more consistent interface.

Hopefully by desugaring {true,false} to "Cake.Bool.{true,false}" users can use
"True" and "False" as constructor names without making the boolean literals unusable.
@dnezam dnezam changed the title Modify OCaml desugaring Adjust desugaring of OCaml to CakeML AST Mar 3, 2026
@dnezam dnezam added test failing regression test failed on the latest commit of this pull request and removed test failing regression test failed on the latest commit of this pull request labels Mar 3, 2026
@dnezam dnezam added test failing regression test failed on the latest commit of this pull request and removed test failing regression test failed on the latest commit of this pull request labels Mar 4, 2026
dnezam added 2 commits March 6, 2026 23:31
With the change to how booleans are desugared, very early files
need to use the CakeML constructor directly.
@dnezam dnezam removed the test failing regression test failed on the latest commit of this pull request label Mar 6, 2026
@tanyongkiam tanyongkiam merged commit dba45a2 into master Mar 8, 2026
1 check passed
@dnezam dnezam deleted the ocaml-parser branch March 21, 2026 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants