Commit Graph

185 Commits (f7e62ab5b75baba542edd6966ec18387dc3ade05)

Author SHA1 Message Date
ychenfo f7e62ab5b7 nac3ast/parser/core: use i128 for u64 constants 2022-03-08 18:21:14 +08:00
ychenfo 142e99a0f1 nac3core: fix broken tests 2022-03-08 13:34:08 +08:00
ychenfo 79c469301a basic unsigned integer support 2022-03-08 13:34:02 +08:00
ychenfo 42fbe8e383 nac3core: fix err msg of too many args 2022-03-05 03:59:45 +08:00
pca006132 63b0f29728 Fix broken tests 2022-03-05 00:27:51 +08:00
Sebastien Bourdeauducq 59ac5aae8a fix error message string (2) 2022-03-02 08:33:13 +08:00
pca006132 846d1726ef nac3core: fixed keyword arguments handling 2022-02-26 16:34:30 +08:00
pca006132 0686e83f4c nac3core/typecheck: fixed incorrect rollback 2022-02-25 20:01:11 +08:00
pca006132 cc769a7006 nac3core: reset unification table state before printing errors
Fixes nondeterministic error messages due to nondeterministic
unification order. As all unification operations will be restored, the
error messages should not be affected by the unification order before
the failure operation.
2022-02-25 14:47:19 +08:00
Sebastien Bourdeauducq 5cd4fe6507 update tests 2022-02-23 11:50:03 +08:00
Sebastien Bourdeauducq 75fde1bbf7 update tests 2022-02-23 11:39:47 +08:00
pca006132 d3cb5d6e52 Fixed type error messages 2022-02-22 17:22:15 +08:00
pca006132 ede3706ca8 type_inferencer: special case tuple index error message 2022-02-21 18:41:42 +08:00
pca006132 f97f93d92c applied rustfmt and clippy auto fix 2022-02-21 18:27:46 +08:00
pca006132 d9cb506f6a nac3core: refactored for better error messages 2022-02-21 18:24:19 +08:00
pca006132 352831b2ca nac3core: removed legacy location definition 2022-02-13 22:39:24 +08:00
pca006132 b18626b149 Fix compilation and test failures 2022-02-12 22:50:32 +08:00
pca006132 e303248261 nac3core: exception type check and codegen 2022-02-12 22:50:32 +08:00
pca006132 b267a656a8 nac3core: added exception type and fixed primitive representation
- Added `Exception` primitive type and some builtin exception types.
  Note that all exception types share the same layout, and should
  inherit from the base `Exception` type. There are some hacks in the
  toplevel module for handling exception types, we should revisit and
  fix them later.
- Added new primitive types to concrete type module, otherwise there
  would be some weird type errors.
- Changed the representation of strings to CSlice<u8>, instead of
  CString.
2022-02-12 22:13:59 +08:00
Sebastien Bourdeauducq fd4bf12808 fix grammar of some type error messages 2022-01-14 16:56:23 +08:00
ychenfo ae8f82ccb0 nac3core: fix broken tests 2022-01-14 16:28:37 +08:00
ychenfo 4a1a4dc076 nac3core/artiq/standalone: symbol resolver return error msg for type error of host variables 2022-01-14 16:28:34 +08:00
ychenfo eba9fc8a69 nac3core: add missing location for type inference 2022-01-14 03:05:11 +08:00
ychenfo 1ee857de6a nac3core: format, fix clippy warning 2022-01-09 01:12:18 +08:00
Sebastien Bourdeauducq 4a65d82db5 introduce IRRT, implement power
based on code by Yijia
M-Labs/nac3#160
2022-01-09 00:57:50 +08:00
ychenfo 9b3b47ce50 fix broken tests 2021-12-28 01:38:16 +08:00
Sebastien Bourdeauducq 80d3ab1b0f remove bigints 2021-12-26 00:23:54 +08:00
Sebastien Bourdeauducq 0ff995722c Revert "nac3core: add missing expr concrete type check"
This reverts commit cb450372d6.
2021-12-20 18:13:45 +08:00
ychenfo cb450372d6 nac3core: add missing expr concrete type check 2021-12-19 18:01:49 +08:00
ychenfo ff27a1697e nac3core: fix for loop type inference 2021-12-19 18:01:49 +08:00
Sebastien Bourdeauducq 142f82f987 remove debug prints 2021-12-01 22:48:06 +08:00
pca006132 4b17511b4a Merge branch 'master' into KernelInvariant 2021-11-27 21:29:27 +08:00
ychenfo 4587088835 Constant Default Parameter Support (#98)
Add support for constant default parameter

Reviewed-on: M-Labs/nac3#98
Co-authored-by: ychenfo <yc@m-labs.hk>
Co-committed-by: ychenfo <yc@m-labs.hk>
2021-11-23 07:32:09 +08:00
ychenfo 49476d06e1 nac3core: clearer comments 2021-11-22 15:06:16 +08:00
ychenfo c2706fa720 nac3core: fix polymorphic class method partial instantiation 2021-11-21 06:11:55 +08:00
pca006132 ba08deada6 nac3core: refactor codegen 2021-11-20 19:50:25 +08:00
ychenfo 8ab3ee9cce nac3core: AugAssign support (#82) 2021-11-13 12:24:22 +08:00
Sebastien Bourdeauducq 96607432c1 nac3core: use Python 3.9 list/tuple annotations in test
Closes #85
2021-11-11 20:05:08 +08:00
pca006132 b1e83a1fd4 nac3core: type check invariants
This rejects code that tries to assign to KernelInvariant fields and
methods.
2021-11-06 22:48:08 +08:00
pca006132 99b29d8ded Merge branch 'master' into with_nac3comment 2021-11-05 20:46:29 +08:00
pca006132 8dbb4ad58a nac3core/toplevel: make test less fragile
test results should not depend on internal states if possible
2021-11-05 20:28:21 +08:00
ychenfo b239806558 nac3core: adapt to ast change due to comment support 2021-11-04 15:02:51 +08:00
Sebastien Bourdeauducq bf7e2c295a integrate nac3parser 2021-11-03 17:11:00 +08:00
Sebastien Bourdeauducq 47f563908a basic string support (#30) 2021-11-02 23:22:49 +08:00
Sebastien Bourdeauducq 613020a717 test: add missing id_to_name entry 2021-11-02 18:34:48 +08:00
pca006132 083eacc268 with parallel/sequential support
Behavior of parallel and sequential:
Each function call (indirectly, can be inside a sequential block) within a parallel
block will update the end variable to the maximum now_mu in the block.
Each function call directly inside a parallel block will reset the timeline after
execution. A parallel block within a sequential block (or not within any block) will
set the timeline to the max now_mu within the block (and the outer max now_mu will also
be updated).

Implementation: We track the start and end separately.
- If there is a start variable, it indicates that we are directly inside a
parallel block and we have to reset the timeline after every function call.
- If there is a end variable, it indicates that we are (indirectly) inside a
parallel block, and we should update the max end value.

Note: requires testing, it is difficult to inspect the output IR
2021-10-31 23:54:37 +08:00
pca006132 fb92b6d364 nac3core: supports range iterator 2021-10-23 23:53:36 +08:00
pca006132 2f6ba69770 nac3core/typecheck: check if value is none 2021-10-23 21:31:14 +08:00
pca006132 279f47f633 nac3core/codegen: avoid sending unifiers
Previously, we have to copy types from one unification table to another,
and make the table sendable. This requires cloning (processing) the
whole table 3 times per function call which is not efficient and uses
more memory than required when the unification table is large.

We now use a concrete type table to only copy the type we need. This
reduces the overhead as we only need to process the unification table
for once (when we do the function codegen), and reduces memory usage by
a bit (but not noticeable when the unification table is small, i.e. the
types are simple).
2021-10-17 13:02:18 +08:00
pca006132 c4259d14d1 fixed some clippy warnings 2021-10-16 18:08:13 +08:00