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

468 Commits

Author SHA1 Message Date
Paul Cadman
a608e26e6a
[docs] Add usage example and move emacs docs (#96) 2022-05-13 09:40:04 +02:00
Jonathan Cubides
f9d9b10fc9
New target syntax and modular VP examples (#92)
* New target syntax and modular VP examples

* [ .gitignore ] updated

* Fix spaces new lines

* Remove outdated lab folder
2022-05-06 12:45:09 +02:00
janmasrovira
a24e0379d3
87 refactor warning related stuff (#91)
* remove all field selectors

* add local type signatures

* delete Wno-monomorphism-restriction and fix warnings

* [tests] inline two error messages

* remove Wno-missing-exported-signatures

* remove Wno-all-missed-specialisations

* remove Wno-missed-specialisations
2022-05-06 11:48:07 +02:00
Jonathan Prieto-Cubides
cb8e0fb911 v0.1.3 Update CHANGELOG 2022-05-05 18:37:06 +02:00
Jonathan Cubides
3004d1a404
Stricter stack builds and pedantic mode for CI (#78)
* Make CI even more pedantic

* remove aeson dependency

Co-authored-by: Paul Cadman <pcadman@gmail.com>
Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2022-05-05 15:21:04 +01:00
Paul Cadman
1d236f7007
[parser] Remove agda backend code (#86) 2022-05-05 15:11:18 +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
077e53cfb1
84 monomorphisation naming inconsistency (#85)
* fix monomorphisation of constructor applications in patterns

* clean code

* hlint
2022-05-05 13:10:14 +02:00
Jonathan Cubides
7b1371c4b9
Change terminating keyword behavior (#82) 2022-05-04 18:17:16 +02:00
janmasrovira
8146b2a91d
[monojuvix] remove unused constructor ExpressionTyped (#80) 2022-05-04 18:03:59 +02:00
Jonathan Cubides
2b4cc3ee36
Add automatically updates/issues/merged PRs to the changelog (#74)
* [ .gitignore ] updated

* Add updated changelog waiting for new PRs

* Fixed minor typos
2022-05-04 14:06:29 +02:00
Jonathan Cubides
038042b733
Add terminating keyword (#71)
* Parsing terminating keyword

* cosmetics

* Add support for `terminating` keyword to function decl.

* Minor replacement

* Fix .mjuxix to .mjuvix and the module name
2022-05-04 14:05:58 +02:00
janmasrovira
13ce663fe1
bump stackage version and remove allow-newer (#76)
* bump stackage version and remove allow-newer

* update ci

* [chore] Invalidate CI cache

Co-authored-by: Paul Cadman <git@paulcadman.dev>
2022-05-04 12:57:42 +02:00
Jan Mas Rovira
fe8969b074 [monojuvix] properly print constructor parameters as atoms 2022-05-04 12:14:42 +02:00
janmasrovira
3acade4072
Monomorphization (#70)
* add TypeCallsBuilder and others

* implement propagation of type calls

* improve type propagation

* polymorphize fungible token

* sort type calls map pretty output

* use HashSet in TypeCallsMap

* renaming

* rename module

* improve indexing in type propagation

* draft monomorphization generation algorithm

* fix draft

* wip mono code generation

* wip code generation

* finish first candidate for code generation

* add monojuvix command

* fix MonoJuvix pretty printer to properly display name ids

* [monojuvix] improve clause pretty printing

* add support for function types in expressions

* properly translate function expressions

* ormolu

* add a basic positive test for monomorphization

* cleanup effect constraints

* collect type applications in axiom types

* apply some style improvements

* fix PolySimpleFungibleToken and add it to the test suite

* ignore polymorphic inductive definitions that are never used
2022-05-04 10:50:03 +02:00
Paul Cadman
c694388c9c
Merge pull request #69 from heliaxdev/rm-statement-compile
Remove StatementCompile in AST after scoping
2022-04-29 15:05:27 +01:00
Paul Cadman
541a9771d2 [chore] Remove StatementCompile in AST after scoping
The scoped -> abstract translation does not emit StatementCompile and so
any code dealing with StatementCompile after scoping was no-op.
2022-04-29 14:14:23 +01:00
janmasrovira
7392e8cc20
check if stderr supports ANSI and print accordingly (#67) 2022-04-29 12:18:09 +02:00
Paul Cadman
dc6fce8820
Add support for compile (by Jonathan) (#66)
* Add support for compile (by Jonathan)

* Remove error related to unsopported backend

Co-authored-by: Jonathan Prieto-Cubides <jonathan.cubides@uib.no>
2022-04-28 17:42:15 +02:00
janmasrovira
fb2999eaf1
add NameIdGen effect to the pipeline (#64)
* add NameIdGen effect to the pipeline

* run ormolu
2022-04-25 12:33:04 +02:00
janmasrovira
956b2ba828
Make the --show-name-ids flag global (#63)
* make flag --show-name-ids global

* make use of --show-name-ids flag in the termination commands
2022-04-25 10:40:24 +02:00
janmasrovira
ba47f11189
Implement type checker with polymorphism (#62) 2022-04-22 10:06:34 +02:00
Paul Cadman
c99c1825d1
[emacs] Add copy of agda-input to minijuvix-mode (#57)
This provides agda-input method (under the name `minijuvix`) to
minijuvix-mode.
2022-04-11 17:11:31 +02:00
janmasrovira
c823efb501
remove undefined (#56) 2022-04-11 16:20:26 +02:00
janmasrovira
66c0403544
Merge pull request #53 from heliaxdev/issue29
closes #29
2022-04-11 13:33:26 +02:00
Jan Mas Rovira
bcc18dd204 run ormolu 4 2022-04-11 13:27:57 +02:00
Jan Mas Rovira
48aadbcf3b make my friends hlint and ormolu happy 2022-04-11 13:23:55 +02:00
Paul Cadman
721ea4612d [test] Add Anoma Haskell backend for VP 2022-04-11 13:17:13 +02:00
Paul Cadman
d023ced9e4 [test] Update VP example 2022-04-11 13:17:13 +02:00
caryoscelus
3d3ba9d282 emacs mode: keep buffer saved after highlighting 2022-04-11 13:17:13 +02:00
Jan Mas Rovira
464749de5a fix #29 2022-04-11 13:08:37 +02:00
Paul Cadman
caf4065644 [test] Add Anoma Haskell backend for VP 2022-04-11 11:09:45 +02:00
Paul Cadman
498c6ab087 [test] Update VP example 2022-04-11 11:09:45 +02:00
Jonathan Prieto-Cubides
18c2d4c037 w.i.p refactoring ansi/text pretty printer 2022-04-08 18:54:19 +02:00
Jan Mas Rovira
f31bc6347a add generic pretty utilities 2022-04-08 17:05:32 +02:00
caryoscelus
3f557271bd emacs mode: keep buffer saved after highlighting 2022-04-08 15:46:19 +01:00
Jonathan Prieto-Cubides
048674f807 w.i.p Add global option --no-color 2022-04-08 16:36:48 +02:00
Jonathan Prieto-Cubides
3f1fda221f Merge branch 'dev' of github.com:heliaxdev/minijuvix into FixREADME 2022-04-08 14:40:09 +02:00
Jonathan Prieto-Cubides
1f98240e49 [ README ] Add badges and grammar 2022-04-08 13:35:04 +02:00
Paul Cadman
90f607e6ce [typecheck] Shortcircuit clause pattern check errors
In the following case:

```
module WrongConstructorArity;
  inductive T {
    A : T;
  };

  f : T → T;
  f (A i) ≔ i;
end;
```

The typechecker fails when checking the clause `f (A i) := i` because of
the extra constructor argument. However if typechecking continues then
the variable `i` on the rhs does not have a type so we must short-circuit.
2022-04-08 13:32:11 +02:00
Paul Cadman
2b283a2b8b [minihaskell] Output ANSI codes only if handle supports it
This adds `ansi-terminal` dependency to the Main target but this is
already a transitive dependency of `prettyprinter-ansi-terminal`.

We want to add this support globally which we will do in https://github.com/heliaxdev/minijuvix/issues/38.
2022-04-08 12:23:20 +01:00
Paul Cadman
a476de53ec [minihaskell] Do not add id suffix to top-level modules and main
For minihaskell the name of the output file needs to match the module
name. So we must not add the usual '_<nameid>' suffix to top level
names.

Additionally the main function in a haskell file is the entry-point to
the haskell program. So the suffix must not be added in this case also.
2022-04-08 13:06:59 +02:00
Jonathan Prieto-Cubides
4779cba90e Merge branch 'parserInfoTable' into dev 2022-04-08 12:54:53 +02:00
Jonathan Prieto-Cubides
e6ea03a6eb Fix test suite 2022-04-08 12:46:37 +02:00
Jonathan Prieto-Cubides
beb2556111 w.i.p Fixing test suite 2022-04-07 18:10:53 +02:00
Jonathan Prieto-Cubides
4c58b82588 Make Ormolu happy and Hlint 2022-04-07 12:53:05 +02:00
Jonathan Prieto-Cubides
7c9fdb656a Fix compilation 2022-04-07 12:49:08 +02:00
Jonathan Prieto-Cubides
86162090ce merging conflicts 2022-04-07 12:13:03 +02:00
Jonathan Prieto-Cubides
0137ef264e w.i.p 2022-04-07 11:59:23 +02:00
Jan Mas Rovira
d9b1a6a0b5 wip 2022-04-07 09:43:41 +02:00