Commit Graph

75 Commits (164edd266eac311751174ef5b78d92f26e747858)

Author SHA1 Message Date
David Nadlinger 164edd266e core/typecheck: Explicitly give errors on "advanced" (subset) indexing 2022-04-22 22:28:59 +01:00
David Nadlinger c74b7992f6 core/typecheck: Basic ndarray indexing support 2022-04-22 21:56:35 +01:00
David Nadlinger 72cb693e2e core/typecheck: First btis of NumPy-like array type inference
For readability of the codebase, I chose ndarray for the name of the
type, while [numpy.]array() is the name of the most commonly used
constructor.
2022-04-22 21:56:35 +01:00
David Nadlinger 8454741f9e cargo fmt the world 2022-04-22 21:56:35 +01:00
ychenfo 711c3d3303 nac3core: support custom operators 2022-04-18 15:31:56 +08:00
ychenfo a38cc04444 nac3core: assert statement 2022-03-29 06:56:40 +08:00
ychenfo 80631fc92b Option type support (#224)
Co-authored-by: ychenfo <yc@m-labs.hk>
Co-committed-by: ychenfo <yc@m-labs.hk>
2022-03-26 15:09:15 +08:00
ychenfo f7e62ab5b7 nac3ast/parser/core: use i128 for u64 constants 2022-03-08 18:21:14 +08:00
ychenfo 79c469301a basic unsigned integer support 2022-03-08 13:34:02 +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 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 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 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 80d3ab1b0f remove bigints 2021-12-26 00:23:54 +08:00
ychenfo ff27a1697e nac3core: fix for loop type inference 2021-12-19 18:01:49 +08:00
ychenfo 8ab3ee9cce nac3core: AugAssign support (#82) 2021-11-13 12:24:22 +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
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
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 c4259d14d1 fixed some clippy warnings 2021-10-16 18:08:13 +08:00
pca006132 26076c37ba nac3core/typecheck: supports recursive type inference 2021-10-16 15:56:49 +08:00
pca006132 11144301ca nac3artiq: added simple host value support 2021-10-06 16:07:42 +08:00
pca006132 799ed58d21 nac3core/type_inferencer: avoid type var for assign 2021-09-22 19:25:47 +08:00
pca006132 105d605e6d nac3core: fix clippy warnings 2021-09-22 18:04:06 +08:00
pca006132 97f5b7c324 fixed performance regression 2021-09-22 18:04:06 +08:00
pca006132 7d48883583 fixed tests 2021-09-22 18:04:06 +08:00
pca006132 084efe92af nac3core: use string interning 2021-09-22 18:04:06 +08:00
pca006132 1b5ac3cd25 nac3core: do not alloc call if it is monomorphic 2021-09-22 18:04:06 +08:00
pca006132 5ed2b450d3 nac3core/typecheck: no type variable for monomorphic functions 2021-09-22 18:04:06 +08:00
ychenfo 1c170f5c41 nac3core: type inferencer fix the pass statement 2021-09-21 13:19:13 +08:00
pca006132 3c930ae9ab fixed #12 2021-09-20 15:51:42 +08:00
ychenfo 1300b5ebdd nac3core: clean up and format 2021-09-08 19:45:36 +08:00
ychenfo 87f25e1c5d nac3core: remove mutex on dyn symbol resolve 2021-09-08 19:27:32 +08:00
ychenfo 55335fc05d nac3core: top level simple type var handled 2021-09-08 02:27:12 +08:00
ychenfo 54b4572c5f nac3core: allow interior mutability to dyn symbolresolver, add add_id_def to symbolresolver trait, remove primitive from top level def list 2021-09-06 19:23:04 +08:00
pca006132 6633eabb89 nac3core: optimized by using HashSet 2021-08-27 12:36:51 +08:00
pca006132 a24e204824 type_inferencer: check defined identifiers during inference 2021-08-27 11:13:43 +08:00
pca006132 173102fc56 codegen/expr: function codegen and refactoring 2021-08-25 15:29:58 +08:00
ychenfo 32773c14e0 move top level related things to a separate module 2021-08-24 17:19:17 +08:00