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

63 Commits

Author SHA1 Message Date
Jonathan Cubides
7b1371c4b9
Change terminating keyword behavior (#82) 2022-05-04 18:17:16 +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
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
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
ba47f11189
Implement type checker with polymorphism (#62) 2022-04-22 10:06:34 +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
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
Jonathan Prieto-Cubides
86162090ce merging conflicts 2022-04-07 12:13:03 +02:00
Paul Cadman
3af9cb95ac
Restore correct handling of TypeAny and add positive typecheck tests (#34)
* [ format ] AbstractToMicroJuvix

* [ CI ] fixes

* [ CI ] fixes

* [ CI ] Using GHC 9.0 for Hlint

* [ CI ] Use static-checks for Dev as well

* [test] Add positive test for typechecker

* [test] Improve positive typechecker error output

* [typecheck] Restore correct handling of TypeAny

I mistakenly removed the matchTypes function in
https://github.com/heliaxdev/minijuvix/pull/22. This caused the handling
of TypeAny to break.

Literals have type TypeAny and so should be valid when matching against
any other type. The tests have been updated to reflect this.

* [test] Add positive MicroJuvix typecheck tests

* [ ormolu ] fixes

Co-authored-by: Jonathan Prieto-Cubides <jonathan.cubides@uib.no>
2022-04-05 22:02:03 +02:00
Jonathan Prieto-Cubides
4d918cd1fd [ CI ] New jobs: ormolu and hlint 2022-04-05 19:57:21 +02:00
Jan Mas Rovira
5f9887e69c define ParserResult and refactor 2022-04-05 16:12:13 +02:00
Jan Mas Rovira
22b5de42f3 setup InfoTable for parser 2022-04-05 00:46:04 +02:00
Jonathan Cubides
3fe3cc4305
Merge branch 'main' into dev 2022-04-04 19:11:26 +02:00
Jonathan Prieto-Cubides
a224d94709 [ pre-commit ] Add support and hooks 2022-04-04 17:44:08 +02:00
Paul Cadman
5bbe6cbfb2 [test] Add test for multiple type errors
Add test for literals
2022-04-04 14:59:56 +01:00
Jonathan Cubides
fd3622a274
Adds many new features (w.i.p v0.1.2) (#28)
* add references to the syntax and cleanup code

* [make] add .PHONY to Makefile targets

* [parser] add parser / pretty for axiom backends

* Pairing progress

* [scoper] Add support for Axiom backends

* [parser] Fix foreign block parsing

* [ app ] adds --no-colors flag for the scope command

* [ghc] upgrade to ghc 9.2.2

* use GHC2021

* [doc] Remove out-of-date comment

* [test] Add ambiguity tests

* [scoper] Improve resolution of local symbols

* [error] WIP improving ambiguity error messages

* [ clean-up ] new lab folder for experimentation

* [ app ] ixes the lint warning

* [ Termination ] removes Alga dependency

* [error] Add message for ambiguous symbol error

* [error] Add ambiguous module message

* [scoper] Remove ErrGeneric

* [test] Add test to suite

* [test] show diff when ast's are different

* [ lab ] folder organization

* [ Makefile ] add targets with --watch option (stack cmds) and remove unused things

* [ app ] add --version flag and fixed warnings and formatting

* [test] remove fromRightIO to fix ambiguity error

* [test] Add test of shadowing public open

* [scoper] Add visibility annotation for Name

* prepare buildIntoTable

* [ Concrete ] add instance of hashable for refs.

* add InfoTableBuilder effect

* [ scoper ] add InfoTableBuilder effect

* [ CHANGELOG ] updated v0.1.1

* [ README ] org version now

* fix package.yaml

* fix readme

* [microjuvix] implement basic typechecker

* add simple test for MicroJuvix type checker

* fix checking for constructors apps in patterns

* [scope] Move InfoTable to a new module

* [abstract] Make Iden use references instead of Name

* [abstract] Add InfoTable for abstract syntax

* [scoper] Add function clauses to scoped InfoTable

* [abstract] Add InfoTableBuilder for scoped to abstract

* [main] Fix callsites of translateModule

* [doc] Remove empty docs

* [scoper] Update emptyInfoTable with missing field

* rename some functions

* [minihaskell] add compilation to MiniHaskell

* [microjuvix] improve wrong type message

* Add a validity predicate example written in MiniJuvix

* [typecheck] Add error infrastructure for type errors

Add a pretty error for mismatched constructor type in a pattern match

* [test] Adds negative typecheck test for constructor

* [app] Adds microjuvix subcommands for printing / typechecking

* [typecheck] Add error message for ctor match args mistmatch

* [typecheck] Add descriptive messages for remainng errors

* [typecheck] Updates to error message copy

* [typecheck] fix merge conflicts:

* [highlight] add basic support for highlighting symbols

* [minijuvix-mode] add minijuvix-mode and basic description in the readme

* [readme] improve formatting

* automatically detect the root of the project and add --show-root flag

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
Co-authored-by: Paul Cadman <git@paulcadman.dev>
Co-authored-by: Paul Cadman <pcadman@gmail.com>
2022-04-01 13:00:15 +02:00
Jan Mas Rovira
9708dd3fe3 [highlight] add basic support for highlighting symbols 2022-04-01 01:11:55 +02:00
Paul Cadman
a030b97e8f [typecheck] Add descriptive messages for remainng errors 2022-03-31 09:30:54 +01:00
Paul Cadman
b41b4c4e84 [typecheck] Add error message for ctor match args mistmatch 2022-03-31 09:29:27 +01:00
Paul Cadman
615f7d11c0 [test] Adds negative typecheck test for constructor 2022-03-31 09:28:20 +01:00
Jonathan Prieto-Cubides
6ba1a4f4ff Add a validity predicate example written in MiniJuvix 2022-03-30 19:09:43 +02:00
Jan Mas Rovira
f121fe0d39 [minihaskell] add compilation to MiniHaskell 2022-03-30 16:03:56 +02:00
Jan Mas Rovira
153ebe36a2 add simple test for MicroJuvix type checker 2022-03-29 09:46:26 +02:00
Jonathan Cubides
de6fabf625
v0.1.1 (#15)
* add references to the syntax and cleanup code

* [make] add .PHONY to Makefile targets

* [parser] add parser / pretty for axiom backends

* Pairing progress

* [scoper] Add support for Axiom backends

* [parser] Fix foreign block parsing

* [ app ] adds --no-colors flag for the scope command

* [ghc] upgrade to ghc 9.2.2

* use GHC2021

* [doc] Remove out-of-date comment

* [test] Add ambiguity tests

* [scoper] Improve resolution of local symbols

* [error] WIP improving ambiguity error messages

* [ clean-up ] new lab folder for experimentation

* [ app ] ixes the lint warning

* [ Termination ] removes Alga dependency

* [error] Add message for ambiguous symbol error

* [error] Add ambiguous module message

* [scoper] Remove ErrGeneric

* [test] Add test to suite

* [test] show diff when ast's are different

* [ lab ] folder organization

* [ Makefile ] add targets with --watch option (stack cmds) and remove unused things

* [ app ] add --version flag and fixed warnings and formatting

* [test] remove fromRightIO to fix ambiguity error

* [test] Add test of shadowing public open

* [scoper] Add visibility annotation for Name

* prepare buildIntoTable

* [ Concrete ] add instance of hashable for refs.

* add InfoTableBuilder effect

* [ scoper ] add InfoTableBuilder effect

* [ CHANGELOG ] updated v0.1.1

* [ README ] org version now

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
Co-authored-by: Paul Cadman <git@paulcadman.dev>
2022-03-25 18:16:34 +01:00
Paul Cadman
2ec85d39a4 [test] Add test of shadowing public open 2022-03-25 09:30:05 +00:00
Paul Cadman
242275a4e3 [scoper] Remove ErrGeneric 2022-03-24 14:57:10 +00:00
Paul Cadman
e60d307595 [error] Add ambiguous module message 2022-03-24 14:45:49 +00:00
Paul Cadman
459da40ae6 [error] Add message for ambiguous symbol error 2022-03-24 14:27:56 +00:00
Paul Cadman
339cc24541 [scoper] Improve resolution of local symbols 2022-03-24 10:28:15 +00:00
Paul Cadman
86110e063a [test] Add ambiguity tests 2022-03-24 10:22:03 +00:00
Paul Cadman
f527143e67 [parser] Fix foreign block parsing 2022-03-23 15:34:08 +00:00
Paul Cadman
20dfb7b736 [scoper] Add support for Axiom backends 2022-03-23 15:05:52 +00:00
Jan Mas Rovira
c6e3c99225 [scoped] add ScopedIden 2022-03-18 10:16:43 +01:00
Jan Mas Rovira
fa95f8be82 separate MiniHaskell into MicroJuvix and 'new' MiniHaskell 2022-03-17 18:18:10 +01:00
Jan Mas Rovira
fee0055ea0 parse and scope 'foreign' and 'compile' statements 2022-03-16 23:40:44 +01:00
Jan Mas Rovira
df5f6d2df0 [scoper] check that top modules are defined in the correct path 2022-03-16 13:58:07 +01:00
Jan Mas Rovira
09303131a8 [test] improve test for literals 2022-03-16 12:42:06 +01:00
Jan Mas Rovira
271464df04 add integer and string literals 2022-03-15 12:37:33 +01:00
Jonathan Prieto-Cubides
7f501de774 [ tests ] added example about ordinals 2022-03-08 13:25:17 +01:00
Jonathan Prieto-Cubides
02c17c1d1f [ tests ] Uppercase type variables 2022-03-07 17:59:18 +01:00
Jonathan Prieto-Cubides
9ed5db7243 [ tests ] fixed definitions for flat and aux 2022-03-07 17:16:45 +01:00
Jonathan Prieto-Cubides
19c15a1a8e [ tests ] Adds some example of mutual recursion to test the termination checker 2022-03-07 16:39:14 +01:00
Jan Mas Rovira
f7b3d6042f [termination] implement callgraph using sets 2022-03-05 13:32:47 +01:00
Jan Mas Rovira
d6dda61e12 [termination] implement lexical order search 2022-03-04 02:13:43 +01:00
Jan Mas Rovira
95c7e6fa10 [tests] add ackermann function 2022-02-24 01:33:26 +01:00
Jan Mas Rovira
4b16e08b8d add some test files aimed at termination checking 2022-02-24 00:36:22 +01:00
Jan Mas Rovira
7ec3fede62 [tests] fix definition of Data.List.filter 2022-02-24 00:31:21 +01:00
Jan Mas Rovira
028c6ac5c0 [tests] add test and error for missing function clause 2022-02-24 00:29:59 +01:00
Jan Mas Rovira
a8d7f183b8 [tests] add test for parenthesized operators: (+) 2022-02-23 10:59:56 +01:00