1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-03 09:41:10 +03:00
Juvix empowers developers to write code in a high-level, functional language, compile it to gas-efficient output VM instructions, and formally verify the safety of their contracts prior to deployment and execution.
Go to file
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
.devcontainer upgrade to Ghc 9.8.1 (#2624) 2024-02-07 09:47:48 +00:00
.github Fix linux static binary build workflow (#2634) 2024-02-12 10:25:44 +00:00
app Support compilation to Anoma compatible functions (#2652) 2024-02-23 12:54:22 +00:00
assets Fix typos (#2573) 2024-01-08 13:27:18 +01:00
bench Refactor readFile and some parsers to use Path instead of FilePath (#2649) 2024-02-19 17:33:58 +01:00
bench2 Effect benchmarks (#2640) 2024-02-14 15:12:39 +01:00
examples Fix typos (#2573) 2024-01-08 13:27:18 +01:00
gnuplot Automatized benchmarks (#1673) 2023-01-05 17:48:26 +01:00
include Extract builtin definitions for loading a Package into bundled package-base package (#2535) 2023-11-30 16:22:18 +00:00
juvix-stdlib@183d4e9329 Update to the latest juvix-stdlib (#2546) 2023-12-01 15:12:54 +01:00
licenses Remove unused files (#2398) 2023-09-28 14:20:19 +02:00
runtime Replace egrep with grep -E (#2618) 2024-02-05 10:27:46 +01:00
scripts Nockma compile (#2570) 2024-01-17 11:15:38 +01:00
src/Juvix Support compilation to Anoma compatible functions (#2652) 2024-02-23 12:54:22 +00:00
test Support compilation to Anoma compatible functions (#2652) 2024-02-23 12:54:22 +00:00
tests Support compilation to Anoma compatible functions (#2652) 2024-02-23 12:54:22 +00:00
.clang-format Juvix C runtime (#1580) 2022-11-03 09:38:09 +01:00
.github_changelog_generator Update Changelog v0.2.3 🎉 2022-08-15 12:24:42 +02:00
.gitignore Add support for Literate Juvix Markdown (#2448) 2023-11-10 13:55:36 +01:00
.gitmodules Rename MiniJuvix to Juvix (#259) 2022-07-08 13:59:45 +02:00
.hlint.yaml Add default arguments (#2408) 2023-10-10 23:28:06 +02:00
.pre-commit-config.yaml Update clang formatting (#2465) 2023-10-23 19:12:56 +02:00
cabal.hie.yaml Automatized benchmarks (#1673) 2023-01-05 17:48:26 +01:00
cabal.project upgrade to Ghc 9.8.1 (#2624) 2024-02-07 09:47:48 +00:00
cabal.project.freeze upgrade to Ghc 9.8.1 (#2624) 2024-02-07 09:47:48 +00:00
CHANGELOG.md Bump up version to v0.5.5 (#2547) 2023-12-01 20:48:35 +01:00
cntlines.sh JuvixTree "apply" transformation (#2595) 2024-01-30 15:46:10 +00:00
CONTRIBUTING.md Fix baseUrl for juvix docs in Doctor command (#2122) 2023-05-24 12:14:30 +02:00
justfile Add -XBangPatterns to the justfile (#2627) 2024-02-08 08:31:11 +00:00
LICENSE.md Add new README and md files (#1904) 2023-03-21 20:01:48 +01:00
Makefile Remove BangPattern pragmas (#2626) 2024-02-07 11:46:13 +00:00
package.yaml Effect benchmarks (#2640) 2024-02-14 15:12:39 +01:00
README.md Fix tara url svg (#2406) 2023-09-28 19:05:05 +02:00
stack.hie.yaml Refactor hie.yaml and add entry in the readme (#1672) 2022-12-20 16:45:48 +01:00
stack.yaml upgrade to Ghc 9.8.1 (#2624) 2024-02-07 09:47:48 +00:00

Juvix

Tara the Juvix mascot

CI Status

The Juvix compiler CI

Nightly build, release and benchmark

Codebase
Open the Juvix Standard Lib in Github Codespace

This repository is specifically dedicated to the compiler of the Juvix programming language.

For any Juvix-related inquiries, we strongly advise visiting the following resources.

Our documentation offers an in-depth understanding of the Juvix programming language. It encompasses a language reference, examples, blog posts, and numerous other resources to facilitate effective use of Juvix.