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

769 Commits

Author SHA1 Message Date
Paul Cadman
a2a911a98a
Add a github action to build a static linux binary (#1488)
This uses a custom docker image build using Dockerfile-ghc-alpine-9.2.4
2022-08-30 12:18:34 +01:00
Łukasz Czajka
488a1f1cee
Fix developBeta in Core/Extra.hs (#1487)
fix developBeta
2022-08-30 12:50:20 +02:00
Łukasz Czajka
3db92fa286
Add the JuvixCore framework and its evaluator (#1421) 2022-08-30 11:24:15 +02:00
janmasrovira
57da75b1a5
Properly type check patterns that need normalization (#1472)
properly type check patterns that need normalization
2022-08-21 12:16:26 +02:00
Jonathan Cubides
9dc32717a0 Update Changelog v0.2.4 🎉 2022-08-19 23:02:05 +02:00
Jonathan Cubides
ff30fe9d05 Bump to version v0.2.4 2022-08-19 23:00:34 +02:00
Jonathan Cubides
4298b6be6e Add missing nodefaultlibs to standalone args 2022-08-19 22:59:57 +02:00
janmasrovira
74e89258a0
use --stdin in flycheck mode (#1460) 2022-08-19 20:08:16 +02:00
janmasrovira
bcaf319b90
Add --stdin flag (#1459) 2022-08-19 16:57:07 +02:00
Paul Cadman
ea6191b5a4
Add a native compile target for demos (#1457) 2022-08-19 12:16:02 +02:00
janmasrovira
3f787338e1
Fix typechecker (#1458) 2022-08-19 11:53:03 +02:00
Jonathan Cubides
c6a43e63b1
Small changes for the presentation (#1456) 2022-08-17 18:27:42 +02:00
janmasrovira
963d48857a
Upgrade to ghc-9.2.4 (#1451) 2022-08-15 16:58:26 +02:00
Paul Cadman
6ea7da9990
Fixes TicTacToe Web example (#1454)
Now that integer literals have the builtin int type we need an actual
IOUnit value to use in the IO sequence implementation.

This commit also adds the TicTacToe web example to the test suite. It is
a typecheck / C generation only test because it uses the Wasm browser APIs.
2022-08-15 14:11:30 +02:00
Jonathan Cubides
54a204a19b Update Changelog v0.2.3 🎉 2022-08-15 12:24:42 +02:00
Jonathan Cubides
ef4ddaf4dc Bump version to 0.2.3 2022-08-15 11:08:36 +02:00
janmasrovira
8e1a4dc8b6
Give a proper type to literal natural numbers (#1453) 2022-08-12 17:31:15 +02:00
Paul Cadman
7bf337217d
Allow _ in Wasm exported names to support Anoma signature (#1449)
Allow _ in Wasm exported names

The Anoma validity predicate Wasm signature is:

"_validate_tx": [I64, I64, I64, I64, I64, I64, I64, I64] -> [I64]

So we need to allow exported names containing '_'.

This PR adds a Juvix module that exports a function with this signature
and a test that the resulting Wasm function can be called.
2022-08-12 09:06:14 +01:00
janmasrovira
7187b41084
Add the option to output json in the juvix internal highlight command (#1450)
* json output for the highlight command

* adapt json output to fit vscode

* add --format flag
2022-08-12 09:48:06 +02:00
janmasrovira
22fc19371f
Add juvix init command (#1445) 2022-08-11 23:05:38 +02:00
janmasrovira
52b2a26047
Refactor pretty to reduce duplication (#1443)
* unify pretty Ann

* refactor keywords

* refactor some auxiliary functions

* remove unused indent option

* add Fixity to Juvix.Data

* move juvixYamlFile
2022-08-11 10:45:54 +02:00
Paul Cadman
1ba72b4d9b
Add Towers of Hanoi and Pascal triangle examples (#1446)
* Add new examples of Juvix programs

* Build documentation for Hanoi and Pascal examples
2022-08-10 12:02:14 +01:00
janmasrovira
7bf729a9b5
Properly handle paragraphs in judoc (#1447) 2022-08-10 12:43:01 +02:00
janmasrovira
5c754846aa
Add initial support for examples in Html documentation (#1442)
* support examples in judoc

* fix line jumps

* make --open depend on the os
2022-08-09 19:09:47 +02:00
Jonathan Cubides
9543b06cf5 Add HelloWorld example and minor other fixes README 2022-08-08 12:13:27 +02:00
Paul Cadman
4b7fad9304
Add doctor subcommand (#1436) 2022-08-06 20:13:06 +02:00
Jonathan Cubides
821c88a6c5
Add revisions to README (#1440)
* Add revisions to README
2022-08-06 11:52:01 +01:00
Paul Cadman
afecd94f90
CI: Run build on push to main (#1437) 2022-08-04 18:12:49 +01:00
Paul Cadman
36ec912779
CI checkout repo before cache and use recommended cache strategy (#1435)
See
https://github.com/actions/cache/blob/main/examples.md#linux-or-macos
for recommendation
2022-08-04 16:14:29 +02:00
Paul Cadman
41af0f5394
Various documentation adjustments (#1434) 2022-08-04 12:50:30 +02:00
Paul Cadman
512211da8e
Setup Clang before building docs in CI (#1433)
* Setup Clang before building docs in CI

* Debug CI

* Debug CI

* Debug CI

* Debug CI

* Fix JS name

* Fix copying of webapp resources to output folder
2022-08-04 09:19:03 +01:00
Paul Cadman
98776997db
Add a Web version of TicTacToe (#1427)
* Add a Web version of TicTacToe

The web version demonstrates injecting host functions into the WASM
import table and call exported Juvix functions from JS.

The web version and the CLI version of the TicTacToe game use the same
game logic backend Juvix module.

* Build and publish web apps in documentation

* Add a link to the TicTacToe web app in example documentation

* Update Makefile to match the new format
2022-08-03 16:14:38 +02:00
Jonathan Cubides
6a4b0e36df
Major revisions to Makefile (#1431)
* Major revisions to Makefile

* Remove from the CI the use of make install-shelltest

* Remove comment
2022-08-03 14:44:48 +02:00
Jonathan Cubides
01a44e436d
Refactor (#1420)
* Big refactor in process

* remove unnecessary functions from the prelude

* remove comments
2022-08-03 13:20:40 +02: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
d6034ba3c8
Do not add -src suffix to links in HTML when running juvix html (#1429)
The `juvix internal doc` command generates 2 files per Juvix module.
One for the main documentation and one for the HTML source file.
The HTML source file is given the prefix `-src` and so links have this
prefix.

However when HTML is generated using `juvix html` only one file is
generated per Juvix module. The filenames do not have the `-src` suffix
and so the links should not have this suffix either.
2022-08-02 18:29:17 +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
a47ade818a
add name and version to juvix.yaml (#1422)
* add name and version to package.yaml

* allow empty juvix.yaml file
2022-07-29 13:35:48 +02:00
janmasrovira
2532b34041
Implement an html documentation generator similar to haddock (#1413) (#1416) 2022-07-28 17:19:07 +02:00
Paul Cadman
c6307173dc
Permit axiom without a compile block (#1418)
An axiom without a compile block generates a C function signature
without a corresponding body. This allows implementations to be injected
at link time (JS, Anoma).
2022-07-27 10:36:53 +02:00
Paul Cadman
6a45484e24
Remove Int from stdlib and update SimpleFungibleToken example (#1414)
* Update SimpleFungibleToken to use stdlib

We do not want to put an Int type into the standard library before we
have builtin support for arbitrary precision integers. So we include the
Int type locally in the project for now.

* Update reference to stdlib

* Fix shell-tests for SimpleFungibleToken
2022-07-27 10:24:25 +02:00
Paul Cadman
4a7009acfb
Fix version shell test for 0.2.2 (#1415) 2022-07-26 13:52:17 +02:00
Jonathan Cubides
6be62a0d72 v0.2.2 2022-07-25 18:54:48 +02:00
Łukasz Czajka
4c5fee3e95
Compute name dependency graph and filter unreachable definitions (#1408)
* Compute name dependency graph and filter unreachable declarations

* bugfix: recurse into type signatures

* positive tests

* make ormolu happy

* get starting nodes from ExportInfo

* make ormolu happy

* cosmetic refactoring of DependencyInfo

* fix tests & style
2022-07-25 18:38:44 +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
a6ac12cdca
Refactor of typechecking and other checking processes (#1410)
* Refactor in progress

* Fixing imports and missing references

* Remove unnecessary import
2022-07-25 17:14:13 +02:00
janmasrovira
39a300eaa2
Support type aliases (#1404)
* add a simple positive test

* add lambda expressions to microjuvix language

* add basic normalization of type aliases

* fix test name

* normalize only functions on types

* normalize when matching

* fix type of inductive names

* improve detection of normalizing functions

* remove obsolete comment

* match constructor return type

* add test for issue 1333

* fix existing tests

* use lambda case

* add strong normalization

* Add test cases for type aliases and another fix

Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
2022-07-25 12:30:18 +02:00
Jonathan Cubides
423ccec70a
Add positivity check for inductive types (#1393)
* w.i.p

* Added strict positivity condition for datatypes w.i.p

* Add negative test for str.postivity check

* Add some revisions

* the branch is back to feet

* w.i.p add lots of traces to check alg.

* Add more test and revisions

* Add negative and positive test to the new flag and the keyword

* Fix shell tests.

* Make pre-commit happy

* Fix rebase conflicts

* Make pre-commit happy

* Add shell test, rename keyword, fix error msg

* Revert change

* Necessary changes

* Remove wrong unless

* Move the positivity checker to its own folder

* Add missing juvix.yaml

* Add a negative test thanks to jan

* make some style changes

* Make ormolu happy

* Remove unnecessary instance of Show

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2022-07-23 09:27:12 +02:00
janmasrovira
e939f8fe9f
Keep qualified names (#1392)
* keep qualified names

* add comment

* add pretty field to Abstract Name

* add test

* Add shell test

* Add another test

* fix shell test

Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
2022-07-21 15:54:08 +02:00
janmasrovira
c1f4987aaa
Use bold for code in scoper error messages (#1403)
use bold for code in scoper error messages
2022-07-21 15:22:55 +02:00