1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-13 19:49:20 +03:00
Commit Graph

808 Commits

Author SHA1 Message Date
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
Jonathan Cubides
a2fd976d78
Replace ppSimple by ppTrace (#1402) 2022-07-20 19:52:20 +02:00
Jonathan Cubides
ca2f3c4b13
Add debugging custom function to Prelude (#1401)
* Add custom functions for tracing

* Renaming debugging functions

* Add minor fixes

* Fix missing names

* Revert changes for ppSimple
2022-07-20 18:13:23 +02:00
Łukasz Czajka
e19fbf489f
Implement some error messages (#1396) (#1400)
* Implement error message for double braces
* Implement error message for implicit pattern on the left of an application
* Implement error message for constructor expected on the left of an application 

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2022-07-20 16:24:03 +02:00
janmasrovira
ac9c460523
Refactor childs of pattern parentheses and braces (#1398) 2022-07-20 15:18:15 +02:00
janmasrovira
a8f4acaca2
Curly braces are allowed nested in patterns (#1380) 2022-07-20 10:33:52 +02:00
Jonathan Cubides
30ae6c76c4 Update some docs (#1391)
* Documment a few language features

* Add an example for foreign example

* Fix pre-commit warnings

* remove what-is-org

* Ignore README.org in docs folder

* Add fixes for revisions
2022-07-19 21:13:35 +02:00
Łukasz Czajka
65a44e0bb5
Direct translation from MicroJuvix to MiniC (#1386) 2022-07-19 15:04:10 +02:00
mariari
d7ad6915d2
Widens the accepted symbol list (#1385)
* Changed the valid symbols from inclusvie to exclusive

* Add test using the new valid symbols
2022-07-18 13:32:43 +02:00
janmasrovira
2ea049cea9
Refine hole in type signature to function type (#1379)
* infer hole in type from pattern

* Refine hole in signature when patterns are found

* fix
2022-07-15 18:39:11 +02:00
janmasrovira
32059965a9
Type checking fails when the type of a pattern is not given by the signature (#1378)
* infer hole in type from pattern

* refactor

* fix error message

* format

* fix matching of identifiers

* improve error message
2022-07-15 17:57:04 +02:00
Jonathan Cubides
34c6dd478d
Fix documentation generation (#1387)
* testing

* Add --print-metadata flag

* Minor fix
2022-07-15 17:20:31 +02:00