1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-26 17:13:35 +03:00
juvix/test/Core
Paul Cadman be24abb0ca
Support compilation to Anoma compatible functions (#2652)
This PR adds a `anoma` target to the `juvix compile`. This target
compiles a Juvix `main` function to a Nockma/Anoma "function". Unlike
the native, wasm, and nockma targets the main function may have any type
signature.

## Anoma calling convention

[Anoma calls
functions](6a4e15fe9c/lib/anoma/resource.ex (L122))
by evaluating the formula `[call L replace [RL args] @ S]` against a
subject equal to the function. Here `args` is a Nockma term that
evaluates to a tuple of arguments that should be passed to the function.

The anoma target compiles the `main` function to Nockma in the same way
as the nockma target. The main function is then
[wrapped](9a658465ae/src/Juvix/Compiler/Nockma/Translation/FromTree.hs (L627))
to make it compatible with the Anoma calling convention.

## Testing

The anoma calling convention is [unit
tested](9a658465ae/test/Nockma/Eval/Positive.hs (L117))
and [smoke
tested](9a658465ae/tests/smoke/Commands/compile.smoke.yaml (L159)).

This PR also adds versions of the end-to-end compilation tests. Most
tests are included, tests for builtin IO operations and string builtins
are omitted. Other tests that use Strings have been adapted to use other
types that are compatible with this backend.

## Nockma REPL

To facilitate testing the Nockma REPL can now load a nockma file as an
initial subject.

---------

Co-authored-by: Lukasz Czajka <lukasz@heliax.dev>
2024-02-23 12:54:22 +00:00
..
Asm Support compilation to Anoma compatible functions (#2652) 2024-02-23 12:54:22 +00:00
Compile Support compilation to Anoma compatible functions (#2652) 2024-02-23 12:54:22 +00:00
Eval Refactor readFile and some parsers to use Path instead of FilePath (#2649) 2024-02-19 17:33:58 +01:00
Normalize Per-module compilation (#2468) 2023-12-30 20:15:35 +01:00
Print Refactor readFile and some parsers to use Path instead of FilePath (#2649) 2024-02-19 17:33:58 +01:00
Recursor JuvixTree recursors and transformation framework (#2594) 2024-01-29 16:43:08 +00:00
Transformation Support compilation to Anoma compatible functions (#2652) 2024-02-23 12:54:22 +00:00
VampIR Per-module compilation (#2468) 2023-12-30 20:15:35 +01:00
Asm.hs JuvixCore to JuvixAsm translation (#1665) 2023-01-09 18:21:30 +01:00
Compile.hs JuvixCore to JuvixAsm translation (#1665) 2023-01-09 18:21:30 +01:00
Eval.hs Add internal core read command (#1517) 2022-09-06 15:26:48 +02:00
Normalize.hs Normalization by Evaluation (#2038) 2023-05-15 18:01:40 +02:00
Print.hs Print JuvixCore correctly (#1875) 2023-03-15 16:41:39 +01:00
Recursor.hs The rmap recursor (#1893) 2023-03-16 14:47:21 +01:00
Transformation.hs Recursion unrolling for functions (#1912) 2023-03-24 15:05:37 +01:00
VampIR.hs Implement core transformation let-hoisting (#2076) 2023-05-16 13:42:44 +02:00