Commit Graph

1109 Commits

Author SHA1 Message Date
KtorZ
6be2a9ed80 Fix formatting of unary operators applied to binary operators.
Add crucial parenthesis...
2023-02-09 13:58:11 +01:00
KtorZ
83a86e6dc0 Fix logical operator precedence in parser.
Whoopsie... || and && were treated with the same precedence, causing very surprising behavior down the line.

  I noticed this because of the auto-formatter adding parenthesis where it really shouldn't. The problem came actually from the parser and how it constructed the AST.
2023-02-09 13:57:12 +01:00
KtorZ
62fe321ddf Add 'Ordering' data-type to the Prelude.
Useful to have around to build comparison functions.
2023-02-09 11:07:30 +01:00
Matthias Benkort
b803332f99 Update crates/aiken-lang/src/tipo/error.rs 2023-02-09 09:25:33 +01:00
rvcas
460da20e4a feat: warn when using expect in a completely safe way 2023-02-09 02:10:22 -05:00
rvcas
e9caa710c4 chore: rename assert_parser to expect_parser 2023-02-09 01:05:11 -05:00
rvcas
9348caab2f feat(expect): update formatter
* Token::Expect should format to expect
* since we still capture assert this means
  we can help users update to the new syntax
2023-02-09 00:57:38 -05:00
rvcas
3f540c7c99 chore: rename assignment kind 2023-02-09 00:47:38 -05:00
rvcas
dbd162e985 feat: handle expect in parser
* map both assert/expect to Token::Expect
* use the new token in the parser
* new unit test to expect
2023-02-09 00:43:29 -05:00
rvcas
5a4a8df727 feat(token): add Token::Expect 2023-02-09 00:25:54 -05:00
Kasey White
f60b7d84c1 clippy fix 2023-02-09 00:09:23 -05:00
Kasey White
076871492b fix: unwrap used in a reachable place. Replaced with alternative option 2023-02-09 00:09:23 -05:00
Kasey White
9ae28aaa88 all nebula tests pass. Had one more fix on listaccessor to finish 2023-02-09 00:09:23 -05:00
Kasey White
986a6009f7 fix: Various fixes for FieldsExpose, ListAccessor, TupleAccessor 2023-02-09 00:09:23 -05:00
alessandrokonrad
3012a0b41d Fix constructor tag range 2023-02-08 13:14:26 +01:00
Kasey White
5d0c5d2a5b remove a redundant type replacement in build_ir 2023-02-05 23:56:44 -05:00
rvcas
3ff927d30a feat: reset the generator when generate finishes 2023-02-05 20:35:39 -05:00
Kasey White
f1b24a5f6d fix: the following issues
fix conversion from inner opaque type for when and assignment
This fixes Clause being used in cases where ListClause or TupleClause should be used
Reset defined and zero arg functions between each code gen
Fixes for optimizations when encountering shadowed variables
2023-02-05 20:35:39 -05:00
Kasey White
c32a9d7b6f commit working changes so far 2023-02-05 20:35:39 -05:00
rvcas
175cd777d8 feat: enable elliptic curve verification builtins 2023-02-04 22:07:56 -05:00
rvcas
ddad05bf51 chore: leave a comment for later 2023-02-04 15:33:18 -05:00
Kasey White
4c8221e439 fix: add is data check to recursive_assert_tipo 2023-02-04 02:47:55 -05:00
Kasey White
86ca466807 feat: some code gen improvements
* fix assert on pattern Var
* fix tuple index unwrapping closes #334
* allow wrapping when casting with let
* allow wrapping when casting via function call
2023-02-04 02:33:10 -05:00
rvcas
c126f6acda feat: invert how casting is controlled
I decided to invert how I'm doing it. I'm passing
in a new argument to unify in environment called
allow_cast: bool and essentially at various
unification sites I can control whether or not I
want to allow casting to even occur. So we can
assume it's false by default always and then we
turn it on in a few places vs. just opening the
flood gates and locking it down at various sites
as they come up# Please enter the commit message
for your changes. Lines starting
2023-02-04 02:33:10 -05:00
rvcas
2b554d105a fix: when Data cast bypass 2023-02-04 02:33:10 -05:00
rvcas
a9ed04ef22 feat: newer rules around casting Data
* you cannot cast FROM Data with a `let`
* you cannot cast FROM Data by passing
  Data to none Data when calling a function
* you MUST use `assert` to cast from data
* you can cast INTO Data with a `let`
* you can cast INTO Data by passing none Data
  to Data when calling a function
* You cannot assert cast Data without an
  annotation
2023-02-04 02:33:10 -05:00
rvcas
ae42dc964a fix: allow var and discard with data on right hand side 2023-02-02 01:16:53 -05:00
rvcas
39e0716f5f feat: better rules around Data casting
* you cannot cast to Data ever
* you can cast from Data to ANY TYPE
* you cannot cast via a function call arg hack
2023-02-02 00:43:45 -05:00
Kasey White
1843b7e73b clippy fix and remove some prints 2023-02-01 23:49:33 -05:00
Kasey White
9dc2bac2c3 fix:minor optimization fixes
Unique only comparison for equals led to strange results
Fixed by interning in a different spot
2023-02-01 23:49:33 -05:00
Kasey White
fdf89b7326 implement optimizations
-Force usage on builtins
-Inline vars used once
-Lambdas that use a var as an arg
-Lambdas that use a const as an arg
2023-02-01 23:49:33 -05:00
rvcas
88ce8ba8b9 feat: remove check assignment 2023-02-01 23:03:35 -05:00
rvcas
21251d6499 fix: remove check from lexer 2023-02-01 20:44:58 -05:00
rvcas
99c1c880b0 chore: more clippy 2023-02-01 18:53:11 -05:00
rvcas
a365649360 chore: clippy autofix 2023-02-01 18:53:11 -05:00
rvcas
c8efe60843 feat: use Rc for more things, fib_iter runs almost 3 seconds faster now 2023-02-01 18:53:11 -05:00
Matthias Benkort
ecc5e13ccd Merge pull request #316 from aiken-lang/cip-0057-blueprints
Blueprints (CIP-0057) as build artifacts
2023-01-31 17:45:56 +01:00
KtorZ
a50b51e086 Fix bytearray literals parsing and formatting.
Weirdly enough, we got the parsing wrong for byte literals in expressions (but did okay in constants). But got the formatting wrong in constants (yet did okay for formatting expressions). I've factored out the code in both cases to avoid the duplication that led to this in the first place. Plus added test coverage to make sure this doesn't happen in the future.
2023-01-31 17:19:40 +01:00
KtorZ
22a1c1dfb4 Use IndexMap throughout
In an ideal world, I should have handlded that directly at the conflicting commit in the rebase, but this would have bubbled up through all commits... which I wasn't really quite keen on going through. So here's an extra ugly commit that comes and 'fix the rebase'.
2023-01-31 09:51:00 +01:00
KtorZ
b3fc2d51cf Fix help on unknown::module error. 2023-01-31 09:48:45 +01:00
KtorZ
d2cc44e5f4 Allow testing blueprint generation from Aiken programs
This is quite something, because now we have a testing pipeline that
  can also be used for testing other compiler-related stuff such as the
  type-checker or the code generator.
2023-01-31 09:48:44 +01:00
KtorZ
547696abde Add title and description to exported types in the blueprint
This also fixes a bug where the documentation of record constructor arguments would be dropped after type-checking. Took me a while to pinpoint.
2023-01-31 09:48:44 +01:00
KtorZ
5683d19a4c Refactor build steps to generate blueprints instead
The blueprint is generated at the root of the repository and is
  intended to be versioned with the rest. It acts as a business card
  that contains many practical information. There's a variety of tools
  we can then build on top of open-source contracts. And, quite
  importantly, the blueprint is language-agnostic; it isn't specific to
  Aiken. So it is really meant as an interop format within the
  ecosystem.
2023-01-31 09:48:38 +01:00
rvcas
60ad3dae50 chore: fmt builder.rs 2023-01-30 12:07:50 -05:00
rvcas
af67f41ead fix: Air::Lam not real, probably meant Air::Let 2023-01-30 12:01:40 -05:00
Lucas
b653714c0c Merge branch 'main' into when-clause-guards 2023-01-30 11:40:29 -05:00
Kasey White
0ea2be0e95 feat: Add codegen for handling clause guards 2023-01-30 05:11:27 -05:00
Kasey White
a638388747 Add more complex test 40.
Add assert for when constr index is given
2023-01-30 04:17:03 -05:00
Kasey White
8c04ab093a update test 40 2023-01-30 03:24:52 -05:00
Kasey White
afd040fda5 feat: Finish up assert feature
Better error reporing on NonFunctionalApplication Error
Refactor redundant code
Add handling of whens with one clause.
2023-01-29 05:21:55 -05:00