1
1
mirror of https://github.com/anoma/juvix.git synced 2025-01-05 22:46:08 +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 a9995b8e1c
Add nockma evaluator (#2564)
This PR adds an parser, pretty printer, evaluator, repl and quasi-quoter
for Nock terms.

## Parser / Pretty Printer

The parser and pretty printer handle both standard Nock terms and
'pretty' Nock terms (where op codes and paths can be named). Standard
and pretty Nock forms can be mixed in the same term.

For example instead of `[0 2]` you can write `[@ L]`.

See
a6028b0d92/src/Juvix/Compiler/Nockma/Language.hs (L79)
for the correspondence between pretty Nock and Nock operators.

In pretty Nock, paths are represented as strings of `L` (for head) and
`R` (for tail) instead of the number encoding in standard nock. The
character `S` is used to refer to the whole subject, i.e it is sugar for
`1` in standard Nock.

See
a6028b0d92/src/Juvix/Compiler/Nockma/Language.hs (L177)
for the correspondence between pretty Nock path and standard Nock
position.

## Quasi-quoter

A quasi-quoter is added so Nock terms can be included in the source, e.g
`[nock| [@ LL] |]`.

## REPL

Launch the repl with `juvix dev nockma repl`.

A Nock `[subject formula]` cell is input as `subject / formula` , e.g:

```
nockma>  [1 0] / [@ L]
1
```

The subject can be set using `:set-stack`.

```
nockma> :set-stack [1 0]
nockma> [@ L]
1
```

The subject can be viewed using `:get-stack`.

```
nockma> :set-stack [1 0]
nockma> :get-stack
[1 0]
```

You can assign a Nock term to a variable and use it in another
expression:

```
nockma> r := [@ L]
nockma> [1 0] / r
1
```

A list of assignments can be read from a file:

```
$ cat stack.nock
r := [@ L]
$ juvix dev nockma repl
nockma> :load stack.nock
nockma> [1 0] / r
1
```

* Closes https://github.com/anoma/juvix/issues/2557

---------

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
Co-authored-by: Lukasz Czajka <lukasz@heliax.dev>
2024-01-11 12:04:38 +00:00
.devcontainer Update pre-commit to check JSON formatting (#2400) 2023-09-28 14:55:35 +02:00
.github Update the Juvix lock file when the Package file changes (#2522) 2023-11-22 23:21:29 +01:00
app Add nockma evaluator (#2564) 2024-01-11 12:04:38 +00:00
assets Fix typos (#2573) 2024-01-08 13:27:18 +01:00
bench Bump up version to v0.5.5 (#2547) 2023-12-01 20:48:35 +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 Require semicolon to separate case/if branches in JuvixAsm syntax (#2574) 2024-01-11 09:19:36 +00:00
src/Juvix Add nockma evaluator (#2564) 2024-01-11 12:04:38 +00:00
test Add nockma evaluator (#2564) 2024-01-11 12:04:38 +00:00
tests Add nockma evaluator (#2564) 2024-01-11 12:04:38 +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 Update stackage resolver to LTS 21.6 (#2275) 2023-08-11 11:49:33 +02:00
cabal.project.freeze Update stackage resolver to LTS 21.6 (#2275) 2023-08-11 11:49:33 +02:00
CHANGELOG.md Bump up version to v0.5.5 (#2547) 2023-12-01 20:48:35 +01:00
cntlines.sh Add nockma evaluator (#2564) 2024-01-11 12:04:38 +00:00
CONTRIBUTING.md Fix baseUrl for juvix docs in Doctor command (#2122) 2023-05-24 12:14:30 +02:00
LICENSE.md Add new README and md files (#1904) 2023-03-21 20:01:48 +01:00
Makefile Add Makefile to hyperfine benchmarks (#2533) 2023-12-01 18:39:39 +01:00
migrate-juvix-yaml.sh Migrate all Juvix projects from juvix.yaml to Package.juvix in the repository (#2503) 2023-11-07 18:11:02 +00:00
package.yaml Per-module compilation (#2468) 2023-12-30 20:15:35 +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 Update stackage resolver to LTS 21.6 (#2275) 2023-08-11 11:49:33 +02: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.