1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-11 08:25:46 +03:00
Commit Graph

24 Commits

Author SHA1 Message Date
janmasrovira
5de0026d83
Add juvix global project under xdg directory and other improvements (#1963)
Co-authored-by: Paul Cadman <git@paulcadman.dev>
2023-04-13 11:27:39 +02:00
Łukasz Czajka
c9b8cdd5e9
Pattern matching compilation (#1874)
This implements a basic version of the algorithm from: Luc Maranget,
[Compiling pattern matching to good decision
trees](http://moscova.inria.fr/~maranget/papers/ml05e-maranget.pdf). No
heuristics are used - the first column is always chosen.

* Closes #1798 
* Closes #1225 
* Closes #1926 
* Adds a global `--no-coverage` option which turns off coverage checking
in favour of generating runtime failures
* Changes the representation of Match patterns in JuvixCore to achieve a
more streamlined implementation
* Adds options to the Core pipeline
2023-03-27 10:42:27 +02:00
janmasrovira
764c6faa80
Improve comma formatting (#1842)
- Closes #1837
2023-02-14 15:27:11 +00:00
janmasrovira
6a571e3d28
Automatized benchmarks (#1673) 2023-01-05 17:48:26 +01:00
janmasrovira
af63c36574
Support basic dependencies (#1622) 2022-12-20 13:05:40 +01:00
Paul Cadman
657de73b98
WASM import all non-compile axioms with alphanum names in entrypoint (#1426)
* import all non-compile axioms with alphanum names in entrypoint

This commit adds `__attribute__((input_name(<name>)))` to the type
signature of all axioms that do not have a compile block. This indicates
to the compiler that this function should be added to the input table of
the WASM binary.

Adds a test that an imported function can be called from Juvix.

* test: Run node command in same directory as WASM output

* Don't generate importName for non-alphnum axioms

* Add a tutorial on Juvix module to JS interop via Wasm
2022-08-02 18:58:45 +02:00
Paul Cadman
433e882189
Export all functions with alpha numeric names from entrypoint module (#1425)
* Export all functions with alphanum names in entrypoint

Set the export_name attribute on every function signature that has a
fully alpha numeric name.

* Adds a non-WASI target to compile command

WASM libraries we want to run in the browser and in Anoma VM do not have
access to the WASI runtime. For this usecase we need a target runtime
that does not use the WASI runtime.

A `wasi-` prefix is added to existing compile targets and introduce a new
standalone target. This target does not have IO functions like
`putStrLn` and `exit` calls `__builtin_trap` which corresponds to the
`unreachable` WASM instruction.

In the non-exhaustive case error a debug message is emitted to tell the
user which function had the error. This is now abstracted to a `debug`
function in the runtime which calls `putStrLn` in the case of WASI and
is no-op in the case of non-WASI.

Tests are added which check that exported names can be called with the
correct name and result.

* Moves walloc to a common directory
2022-08-01 12:53:19 +02:00
janmasrovira
d70cbc6c94
Add Fail effect (#1409) (#1411)
* Refactor in progress

* Fixing imports and missing references

* add Fail effect

* fix imports

Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
2022-07-25 17:51:42 +02:00
Jonathan Cubides
3b3ea45da9
Rename MiniJuvix to Juvix (#259)
* Renaming MiniJuvix to Juvix

* Make Ormolu happy

* Make Hlint happy

* Remove redundant imports

* Fix shell tests and add target ci to our Makefile

* Make pre-commit happy
2022-07-08 13:59:45 +02:00
Paul Cadman
ed78f2636b
Embed standard library in the minijuvix binary (#210)
* Embed stdlib in minijuvix library

We add a new step at the beginning of the pipeline called Setup that
registers the modules in the standard library with the Files effect. The
standard library is then used when the Scoper queries the Files effect
for modules as it resolves import statements.

Use of the standard library can be disabled using the global
`--no-stdlib` command-line option.

* CI: Checkout submodules recursively for stdlib

* Add a new `--no-stdlib` option to shell check

* Poke CI

* CI: Checkout submodules in the test job
2022-06-30 11:31:08 +02:00
Jonathan Cubides
f16570e546
Add the termination checker to the pipeline (#111)
* [WIP] EntryPoint now has options. --no-termination is a new global opt.

* Add TerminationChecking to the pipeline

* Add TerminationChecking to the pipeline

* Keep GlobalOptions in App

* Fix reviewer's comments

* delete unnecessary parens

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2022-05-30 13:40:52 +02:00
Paul Cadman
5ed3ef34c0
[cbackend] run minic tests with clang+wasi-sdk (#105)
* [cbackend] run minic tests with clang+wasi-sdk

* [docs] Add docs for setting up clang+wasi-sdk

* [doc] Updates README usage with clang

* [docs] Fix LLVM URL in README

* [docs] Fix README

* [doc] Update clang setup docs with wasm-ld
2022-05-16 16:17:28 +01:00
Paul Cadman
60236e7b58
Add C code generation backend (#68)
* [cbackend] Adds an AST for C

This should cover enough C to implement the microjuvix backend.

* [cbackend] Add C serializer using language-c library

We may decide to write our own serializer for the C AST but this
demonstrates that the C AST is sufficient at least.

* [cbackend] Declarations will always be typed

* [cbackend] Add CPP support to AST

* [cbackend] Rename some names for clarity

* [cbackend] Add translation of InductiveDef to C

* [cbackend] Add CLI for C backend

* [cbackend] Add stdbool.h to file header

* [cbackend] Allow Cpp and Verbatim code inline

* [cbackend] Add a newline after printing C

* [cbackend] Support foreign blocks

* [cbackend] Add support for axioms

* [cbackend] Remove code examples

* [cbackend] wip FunctionDef including Expressions

* [parser] Support esacping '}' inside a foreign block

* [cbackend] Add support for patterns in functions

* [cbackend] Add foreign C support to HelloWorld.mjuvix

* hlint fixes

* More hlint fixes not picked up by pre-commit

* [cbackend] Remove CompileStatement from MonoJuvix

* [cbackend] Add support for compile blocks

* [cbackend] Move compileInfo extraction to MonoJuvixResult

* [minihaskell] Fix compile block support

* [chore] Remove ununsed isBackendSupported function

* [chore] Remove unused imports

* [cbackend] Use a Reader for pattern bindings

* [cbackend] Fix compiler warnings

* [cbackend] Add support for nested patterns

* [cbackend] Use functions to instantiate argument names

* [cbackend] Add non-exhaustive pattern error message

* [cbackend] Adds test for c to WASM compile and execution

* [cbackend] Add links to test dependencies in quickstart

* [cbackend] Add test with inductive types and patterns

* [cbackend] Fix indentation

* [cbackend] Remove ExpressionTyped case

https://github.com/heliaxdev/minijuvix/issues/79

* [lexer] Fix lexing of \ inside a foreign block

* [cbackend] PR review fixes

* [chore] Remove unused import

* [cbackend] Rename CJuvix to MiniC

* [cbackend] Rename MonoJuvixToC to MonoJuvixToMiniC

* [cbackend] Add test for polymorphic function

* [cbackend] Add module for string literals
2022-05-05 14:12:17 +01:00
janmasrovira
7392e8cc20
check if stderr supports ANSI and print accordingly (#67) 2022-04-29 12:18:09 +02:00
Jonathan Prieto-Cubides
beb2556111 w.i.p Fixing test suite 2022-04-07 18:10:53 +02:00
Jonathan Prieto-Cubides
86162090ce merging conflicts 2022-04-07 12:13:03 +02:00
Jonathan Prieto-Cubides
4d918cd1fd [ CI ] New jobs: ormolu and hlint 2022-04-05 19:57:21 +02:00
Jan Mas Rovira
5f9887e69c define ParserResult and refactor 2022-04-05 16:12:13 +02:00
Paul Cadman
615f7d11c0 [test] Adds negative typecheck test for constructor 2022-03-31 09:28:20 +01:00
Jonathan Prieto-Cubides
ce30de2dc3 [ scoper ] add InfoTableBuilder effect 2022-03-25 17:44:32 +01:00
Jan Mas Rovira
e241cc7b5b [test] remove fromRightIO to fix ambiguity error 2022-03-25 09:26:40 +01:00
Jan Mas Rovira
bdd155d712 [tests] add support for mocked file system in scope checker. Useful for multi
file tests
2022-02-18 17:48:21 +01:00
Jan Mas Rovira
09bf131990 [tests] setup step-wise positive tests 2022-02-18 13:01:42 +01:00
Jan Mas Rovira
96930352aa [tests] setup basic testing 2022-02-15 14:12:53 +01:00