1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-01 00:04:58 +03:00
Commit Graph

190 Commits

Author SHA1 Message Date
janmasrovira
3b452e7d76
Fix #1693 (#1708) 2023-01-09 18:56:28 +01:00
Łukasz Czajka
f2298bd674
JuvixCore to JuvixAsm translation (#1665)
An implementation of the translation from JuvixCore to JuvixAsm. After
merging this PR, the only remaining step to complete the basic
compilation pipeline (#1556) is the compilation of complex pattern
matching (#1531).

* Fixes several bugs in lambda-lifting.
* Fixes several bugs in the RemoveTypeArgs transformation.
* Fixes several bugs in the TopEtaExpand transformation.
* Adds the ConvertBuiltinTypes transformation which converts the builtin
bool inductive type to Core primitive bool.
* Adds the `juvix dev core strip` command.
* Adds the `juvix dev core asm` command.
* Adds the `juvix dev core compile` command.
* Adds two groups of tests: 
- JuvixCore to JuvixAsm translation: translate JuvixCore tests to
JuvixAsm and run the results with the JuvixAsm interpreter,
- JuvixCore compilation: compile JuvixCore tests to native code and WASM
and execute the results.
* Closes #1520 
* Closes #1549
2023-01-09 18:21:30 +01:00
Jonathan Cubides
f12648954e
Replace --output-dir flag by --internal-build-dir (#1707) 2023-01-09 15:09:02 +01:00
Jonathan Cubides
5b495681c6
Compiler output (#1705)
Add a global flag `--output-dir to specify where to put the compiler output.
2023-01-06 17:54:13 +01:00
janmasrovira
6a571e3d28
Automatized benchmarks (#1673) 2023-01-05 17:48:26 +01:00
Łukasz Czajka
638cd0ebb5
Nat builtins (#1686)
* Fixes #1678.
* Adds the `clean-juvix-build` Makefile target, which removes all
`.juvix-build` directories in the project (necessary to do after
changing the standard library).
* Depends on PR #1688. The tests go through without merging this PR, but
it's a bug. The present PR requires the possibility to use the
`terminating` keyword with the `div` built-in, which possibility is
provided by PR #1688.
2023-01-05 16:39:40 +01:00
Jonathan Cubides
d48e3bd16a
Allow optional pipe before the first constructor for inductive type declarations (#1699) 2023-01-05 11:28:54 +01:00
Paul Cadman
8ef970d3fd
Add printString and printBool support to legacy C backend (#1698)
This PR implements `printString` and `printBool` builtins for the legacy
C backend. Previously IO for strings was done using compile blocks with
included C code.

Fixes https://github.com/anoma/juvix/issues/1696
2023-01-04 18:02:02 +01:00
Łukasz Czajka
c55f04dc46
Convert Nat literals to Core integers (#1681)
Now it's possible to write `1 + 2` in the Juvix REPL and not get an
error.

Closes #1645.

Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
2023-01-03 18:52:20 +01:00
Łukasz Czajka
6908ca9440
Remove unicode cons symbol (#1687) 2023-01-03 14:37:19 +01:00
Jonathan Cubides
3fbc9c7c55
Change syntax for ind. data types and forbid the empty data type (#1684)
Closes #1644 #1635
2023-01-03 13:49:04 +01:00
Jonathan Cubides
8f6eb3ebc7
Remove where syntax (#1674)
Closes #1640 #1354
2022-12-23 11:13:11 +01:00
Jonathan Cubides
9a7b3d33da Update Changelog v0.2.8 🎉 2022-12-20 19:24:24 +01:00
janmasrovira
af63c36574
Support basic dependencies (#1622) 2022-12-20 13:05:40 +01:00
Łukasz Czajka
445376e338
Conversion of Nat representation to JuvixCore integers (#1661)
* nat to int wip

* nat to int wip

* fix condition

* nats in core

* bugfixes

* tests

* make ormolu happy

* fix case
2022-12-20 11:17:39 +01:00
Łukasz Czajka
bfadbae41e
Move applications inside Lets and Cases (#1659)
* Move applications inside lets and cases

* make ormolu happy
2022-12-13 08:50:24 +00:00
Łukasz Czajka
d9b020ec27
Remove type arguments and type abstractions from Nodes (#1655) 2022-12-12 14:58:25 +01:00
Łukasz Czajka
f5de5faaef
Translation from JuvixAsm to C (#1619) 2022-12-06 11:33:20 +01:00
Jonathan Cubides
fb2723cb75 Update Changelog v0.2.7 🎉 2022-12-05 11:48:03 +01:00
janmasrovira
169155690b
Eta expansion at the top of each core function definition (#1481) (#1571) 2022-11-14 16:03:28 +01:00
Paul Cadman
b541972d03
Add types to Core functions and constructors when translating from Internal (#1617)
* Support inductive type and universe expressions

* Support function type expressions

* Add type information to Core function and constructor nodes

* Remove unused do
2022-11-11 12:38:48 +00:00
Paul Cadman
df4036d600
Compute new entrypoint root when loading a file in the REPL (#1615)
* Add shelltests for `juvix repl`

* repl: Compute entrypoint root when loading a file

Previously the REPL would use app root (which could be the current
directory or the project root of the initially loaded file). Thus files
in a different project could not be loaded.

The entrypoint root must be computed each time a new file is `:load`ed.

Adds shell-tests for REPL commands

* Move preludePath to Juvix.Extra.Paths
2022-11-10 11:26:38 +00:00
janmasrovira
aa00d34c8c
Make lambda lifting correct when free variables occur in the types of binders (#1609) 2022-11-09 13:25:00 +01:00
Paul Cadman
a3b2aa6940
Add translation from Internal to Core (#1567) 2022-11-07 14:47:56 +01:00
Murray
5cea26ac7f
Improve As-Pattern parsing (#1603)
* Allow naming nullary constructors without using parentheses
* Negative test cases
2022-11-03 10:02:22 +01:00
Łukasz Czajka
74bfe592f5
Juvix C runtime (#1580) 2022-11-03 09:38:09 +01:00
janmasrovira
59e6712452
Binder refactor (#1598) 2022-10-28 15:40:09 +02:00
Murray
13a1dad107
As-patterns (#1576) 2022-10-27 12:17:03 +02:00
Jonathan Cubides
17e3a37203 Update Changelog v0.2.6 🎉 2022-10-26 00:01:23 +02:00
janmasrovira
2062d3d8e5
Properly newline expressions in the pretty printer (#1581) 2022-10-18 17:38:31 +02:00
Paul Cadman
504b5ec799
Rename builtin natural to nat and boolean to bool (#1588) 2022-10-14 18:42:03 +02:00
Łukasz Czajka
93d5bdcd25
Improve the test for eta-expansion of constructors and builtins (#1583) 2022-10-14 13:25:49 +02:00
Paul Cadman
be9872ea06
Add builtin if (#1585)
```
builtin boolean-if
if : {A : Type} → Bool → A → A → A;
if true x _ := x;
if false _ x := x;
```

This allows a backend to translate if directly, so that only one branch
is evalutated.

An example compilation of if is given for the legacy backend for testing.
2022-10-14 10:06:05 +01:00
Łukasz Czajka
80783cfa3c
Parse optional type info in JVC files (#1575) 2022-10-13 16:54:51 +02:00
Paul Cadman
be5e2b9f2a
Add builtin boolean (#1582)
builtin boolean
inductive MyBool {
  myTrue : Bool;
  myFalse : Bool;
};

The first constructor is mapped to primitive true and the second
constructor is mapped to primitive false.

This also adds compilation of builtin boolean in the legacy backend as
this was trivial to implement.
2022-10-13 14:03:49 +01:00
janmasrovira
d7e208aac1
1569 rewrite the test for lambda lifting to use evaluation (#1572) 2022-10-12 10:19:02 +02:00
Łukasz Czajka
f4ca940c7a
Fix symbol numbering bug (#1574) 2022-10-04 17:06:51 +02:00
janmasrovira
803d2008d9
remove ≔ from the language and replace it by := (#1563)
* remove ≔ from the language and replace it by :=

* revert accidental changes in juvix input mode

* update stdlib submodule

* rename ℕ by Nat in the tests and examples

* fix shell tests
2022-09-30 10:55:32 +10:00
Łukasz Czajka
f0ade4be7c
JuvixAsm (#1432) 2022-09-29 17:44:55 +02:00
janmasrovira
9f80d17fd2
Mutual inference (#1543) 2022-09-26 19:14:17 +02:00
janmasrovira
6a35db7475
Properly handle top lambdas in the termination checker (#1544) 2022-09-26 16:03:36 +02:00
janmasrovira
13b038b5a1
Fix arity checker bug (#1546) 2022-09-26 14:39:37 +02:00
janmasrovira
41ef5f6219
Add lambda expressions to internal and add typechecking support (#1538) 2022-09-23 15:43:18 +02:00
Jonathan Cubides
9e6b823352 Bump version to 0.2.5 2022-09-14 17:41:02 +02:00
janmasrovira
60d4f0433a
Refactor CLI (#1527) 2022-09-14 16:16:15 +02:00
Łukasz Czajka
4396f34be4
'Match' with complex patterns in Core (#1530) 2022-09-14 15:44:13 +02:00
janmasrovira
9e0bbf7351
Replace -> by := in lambda syntax (#1533) 2022-09-14 14:31:28 +02:00
janmasrovira
3262906772
Implement lambda lifting without letrec (#1494)
Co-authored-by: Paul Cadman <git@paulcadman.dev>
Co-authored-by: Łukasz Czajka <62751+lukaszcz@users.noreply.github.com>
2022-09-12 12:45:40 +02:00
Łukasz Czajka
2eb51ce1c3
Make comma a delimiter (#1525) 2022-09-12 11:39:11 +02:00
janmasrovira
e3dbb308d3
Detect nested patterns as smaller in the termination checker (#1524) 2022-09-12 11:21:39 +02:00