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

142 Commits

Author SHA1 Message Date
Łukasz Czajka
73c8bafd09
Add pretty printing to JuvixAsm code (#1650) 2022-12-08 17:09:56 +01:00
Łukasz Czajka
f5de5faaef
Translation from JuvixAsm to C (#1619) 2022-12-06 11:33:20 +01:00
janmasrovira
ebfe412d6f
Auto complete argument of 'dev core read -t' (#1616)
autocomplete transformation list in 'dev core read -t'
2022-11-14 16:29:48 +00: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
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
Paul Cadman
6d66d0ab13
Add juvix-repl-mode for emacs (#1612)
* Adds a major mode for juvix-repl

* juvix-mode: C-c C-l loads file into REPL, if the REPL is running

* Detect ANSI support in Emacs REPL / shell by using hSupportsANSIColor API

* Disable comint echo handling. Juvix REPL does not echo

* repl: whitespace strip input to compile/eval/infer commands
2022-11-09 16:36:40 +01:00
Łukasz Czajka
9d4f843262
Precompute maximum heap allocation (#1608) 2022-11-08 13:42:40 +01:00
Paul Cadman
5d0123beba
Improvements to Juvix REPL (#1607)
* REPL support reloading

* Reformat :help and add :version command

* repl: Display the currently loaded module in the banner

* repl: Load the Prelude at launch unless --no-prelude or --no-stdlib are set
2022-11-07 17:43:30 +00:00
Paul Cadman
a3b2aa6940
Add translation from Internal to Core (#1567) 2022-11-07 14:47:56 +01:00
Łukasz Czajka
74bfe592f5
Juvix C runtime (#1580) 2022-11-03 09:38:09 +01:00
janmasrovira
b02f2f8e82
Letrec lifting (#1579) 2022-10-21 19:13:06 +02:00
Paul Cadman
9e7a8a98d4
Support go to definition for the standard library (#1592)
* Remove ParserParams

ParserParams is only used to record the root of the project, which is
used to prefix source file paths. However source file paths are always
absolute so this is not required.

* Add GetAbsPath to Files effect

The Files effect is not responsible for resolving a relative module
path into an absolute path on disk. This will allow us to resolve
relative module paths to alternative paths, for example to point to the
standard library on disk.

* Files effect getAbsPath returns paths within the registered standard
library

This means that the standard library can exist on disk at a different
location to the Juvix project.

A command line flag --stdlib-path can be specified to point to a
standard library, otherwise the embedded standard library is written to
disk at $PROJ_DIR/.juvix-build/stdlib and this is used instead.

* Recreate stdlib dir only when juvix version changes

* Add UpdateStdlib to the Files effect

* Add comment for stdlibOrFile

* Remove spurious import
2022-10-19 15:55:16 +01:00
janmasrovira
2062d3d8e5
Properly newline expressions in the pretty printer (#1581) 2022-10-18 17:38:31 +02:00
Łukasz Czajka
f0ade4be7c
JuvixAsm (#1432) 2022-09-29 17:44:55 +02:00
Paul Cadman
a246d57bff
Autocomplete ".jvc" input files for core {eval, read} commands (#1542)
Complete ".jvc" input files for core {eval, read} commands
2022-09-15 16:02:20 +01:00
Paul Cadman
b6f1ecac73
Add --show-de-bruijn to core eval command (#1540)
This option was removed as part of one of the cli refactors
2022-09-15 15:26:02 +01:00
janmasrovira
60d4f0433a
Refactor CLI (#1527) 2022-09-14 16:16:15 +02:00
janmasrovira
380ade56dc
Add CanonicalProjection (#1526)
add CanonicalProjection
2022-09-12 09:44:00 +01:00
janmasrovira
42d8c6fcf6
Enable autocompletion for the --theme flag (#1519) 2022-09-06 16:15:57 +02:00
janmasrovira
4f05ba2531
Add internal core read command (#1517) 2022-09-06 15:26:48 +02:00
Łukasz Czajka
708a4032c6
Add an option to show name ids in errors (#1486) 2022-09-01 13:22:32 +02:00
Paul Cadman
105188b53f
Make juvix compile default to native target (#1502) 2022-08-31 19:29:06 +02:00
Jonathan Cubides
65489ff092
Remove Monomorphization from the Pipeline (#1497) 2022-08-31 18:05:16 +02:00
Jonathan Cubides
e9fa4fcbc2
Remove Haskell support (#1496) 2022-08-31 17:14:37 +02:00
Łukasz Czajka
3db92fa286
Add the JuvixCore framework and its evaluator (#1421) 2022-08-30 11:24:15 +02:00
Jonathan Cubides
4298b6be6e Add missing nodefaultlibs to standalone args 2022-08-19 22:59:57 +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
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
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
Paul Cadman
4b7fad9304
Add doctor subcommand (#1436) 2022-08-06 20:13:06 +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
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
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
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
Łukasz Czajka
65a44e0bb5
Direct translation from MicroJuvix to MiniC (#1386) 2022-07-19 15:04:10 +02:00
Jonathan Cubides
eb6819f0c7
Add typecheck and internal command (#270)
* Closes #269

* Add internal command

* w.i.p

* Fix shell tests.

* Rename check command and add shell-tests
2022-07-12 19:08:03 +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
Łukasz Czajka
4d5aaa6b32
Enforce C99 standard in the generated C files (#252)
Add '-std=c99' to clang options
2022-07-07 12:13:03 +02:00
Łukasz Czajka
dee2357214
Removes the minihaskell command from CLI (#244)
The command is internal now.
2022-07-05 15:39:45 +02:00
Łukasz Czajka
f1921bbf91
Fix a bug with the path to walloc.c (#237) 2022-07-04 17:53:06 +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
janmasrovira
6eb16c74c1
Add support for built in types (#192)
* match inductive definitions

* progress towards builtins

* more progress towards builtin types

* add more builtins

* add some errors

* add reverse table to builtins

* Squashed commit of the following:

commit 93333de502d8dd546eb8edf697ca7eef972ea105
Author: Paul Cadman <git@paulcadman.dev>
Date:   Mon Jun 27 18:21:30 2022 +0100

    Use builtin names for match and project functions

    Add an implementation of nat for the standalone backend

commit 868d2098ee57b7acbca84512b6e096650eeeb22d
Author: Jan Mas Rovira <janmasrovira@gmail.com>
Date:   Mon Jun 27 18:15:29 2022 +0200

    add builtin information to ClosureInfo

commit 32c78aceb19ee4010d66090a3c4e6025621b5c1f
Author: Paul Cadman <git@paulcadman.dev>
Date:   Mon Jun 27 12:52:10 2022 +0100

    Refactor BuiltinEnum to sum type of each Builtin

commit 55bb72ab12a8fb7d10070c2dee5875482453b7c6
Author: Paul Cadman <git@paulcadman.dev>
Date:   Fri Jun 24 14:44:28 2022 +0100

    Add Builtin information to Mono InfoTable

commit a72368f2e3af20baaf44c5e21fa7e6a469cf1ac5
Author: Paul Cadman <git@paulcadman.dev>
Date:   Fri Jun 24 14:41:51 2022 +0100

    Add Bitraversable to Prelude

commit afa3153d82a9509b0882e7ca99830040fad9ef65
Author: Paul Cadman <git@paulcadman.dev>
Date:   Fri Jun 24 14:41:39 2022 +0100

    Remove unused import

commit ea0b7848fb80970e03a0561be3fb4448486a89a9
Author: Paul Cadman <git@paulcadman.dev>
Date:   Thu Jun 23 13:54:58 2022 +0100

    Use projection functions instead of direct member access

* Avoid shadowing C runtime names in foreign block

* Fix formatting

* Update C names for builtin functions

* Add prim_ prefix to builtin C names

Implement builtins for standalone and libc backends

* Update ormolu action

* ci: run all tests for draft PRs

Co-authored-by: Paul Cadman <git@paulcadman.dev>
2022-06-28 13:31:31 +02:00
Jonathan Cubides
a749575734
Add minijuvix version info and date to HTML output (#186)
* Add minijuvix version info and date to HTML output

* Fix pre-commit
2022-06-21 17:03:22 +02:00
Jonathan Cubides
cc4566f4a6
Add an option to specify the path where to put the HTML output (#179)
* Add --output-dir option for html generation

* minor

* Add html test for output-dir flag with (no) recursive gen
2022-06-20 18:12:45 +02:00
janmasrovira
6b6da9fd09
Use Abstract name in Abstract syntax and Micro/MonoJuvix (#181) 2022-06-20 09:19:57 +02:00