Commit Graph

69 Commits

Author SHA1 Message Date
339b74161b core/toplevel: reorganize PrimDef 2024-07-27 21:57:47 +08:00
4948395ca2 core/toplevel/type_annotation: Add handling for mismatching class def
Primitive types only contain fields in its Type and not its TopLevelDef.
This causes primitive object types to lack some fields.
2024-07-19 14:42:14 +08:00
cea7cade51 core: add np_argmax/np_argmin functions 2024-07-12 18:18:28 +08:00
a91602915a core: Fix missing fields in range type 2024-07-09 13:53:50 +08:00
2cfb7a7e10 core: Refactor range function into constructor 2024-07-09 04:44:40 +08:00
2194dbddd5 core/type_annotation: Refactor List type to TObj
In preparation for operators on lists.
2024-07-04 15:32:18 +08:00
7fe2c3496c core: add attribute field to class definition 2024-06-25 16:06:33 +08:00
2abe75d1f4 core: remove code dup with make_exception_fields 2024-06-17 12:01:48 +08:00
fed1361c6a core: rename to_var_map to into_var_map 2024-06-13 16:59:10 +08:00
f026b48e2a core: refactor to use TypeVarId and TypeVar 2024-06-13 16:59:10 +08:00
dc874f2994 core: use PrimDef simple names in make_primitives() 2024-06-13 16:58:32 +08:00
c4420e6ab9 core: refactor get_builtins() 2024-06-12 15:09:20 +08:00
fd36f78005 core: refactor PrimitiveDefinitionId into enum PrimDef 2024-06-12 15:01:01 +08:00
8168692cc3 apply cargo fmt 2024-06-12 14:45:03 +08:00
82bf14785b core: Add multidimensional array helpers 2024-06-11 15:30:06 +08:00
64a3751fc2 core: Remove custom function type definitions for ndarray operators 2024-05-06 13:21:54 +08:00
6af13a8261 core: Implement elementwise binary operators
Including immediate variants of these operators.
2024-04-03 00:07:33 +08:00
8f1497df83 core/helper: Add PrimitiveDefinitionIds::iter 2024-04-02 16:49:12 +08:00
5ca2dbeec8 core/typedef: Add Type::obj_id to replace get_obj_id 2024-04-02 16:49:10 +08:00
c3b122acfc core: Implement ndarray.copy 2024-03-07 14:59:13 +08:00
96b7f29679 core: Implement ndarray.fill 2024-03-07 14:59:13 +08:00
77de24ef74 core: Use BTreeMap for type variable mapping
There have been multiple instances where I had the need to iterate over
type variables, only to discover that the traversal order is arbitrary.

This commit fixes that by adding SortedMapping, which utilizes BTreeMap
internally to guarantee a traversal order. All instances of VarMap are
now refactored to use this to ensure that type variables are iterated in
 the order of its variable ID, which should be monotonically incremented
 by the unifier.
2024-03-04 23:56:04 +08:00
234a6bde2a core: Use TObj for NDArray 2024-03-01 15:41:55 +08:00
c3db6297d9 core: Add primitive definition-id list
So that we have a single ground truth for the definition IDs of
primitive types.
2024-03-01 11:29:10 +08:00
bd792904f9 core: Add size_t to primitive store
Used for ndims in ndarray.
2023-12-21 15:20:31 +08:00
5f692debd8 core: Add PrimitiveStore into Unifier
This will be used during unification between a const generic variable
and a `Literal`.
2023-12-16 18:40:48 +08:00
a19f1065e3 meta: Refactor to use more let-else bindings 2023-12-12 16:31:14 +08:00
32746c37be core: Refactor to return errors by HashSet 2023-12-12 15:41:59 +08:00
02933753ca core: Apply clippy pedantic changes 2023-12-11 15:16:23 +08:00
5182453bd9 meta: Remove redundant path prefixes 2023-12-11 15:16:23 +08:00
b6dfcfcc38 core: Move some SymbolValue functions to symbol_resolver.rs 2023-12-08 18:00:51 +08:00
ffac37dc48 nac3core: fix exception type in primitive store 2022-05-29 19:14:00 +08:00
e94b25f544 spelling (#264)
Co-authored-by: wylited <ds@m-labs.hk>
Co-committed-by: wylited <ds@m-labs.hk>
2022-04-13 11:32:31 +08:00
388c9b7241 nac3core: better check and err msg for default param 2022-03-30 04:05:47 +08:00
6ab73a223c nac3core/artiq: support default param of option type 2022-03-30 04:05:47 +08:00
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
f7e62ab5b7 nac3ast/parser/core: use i128 for u64 constants 2022-03-08 18:21:14 +08:00
79c469301a basic unsigned integer support 2022-03-08 13:34:02 +08:00
f97f93d92c applied rustfmt and clippy auto fix 2022-02-21 18:27:46 +08:00
d9cb506f6a nac3core: refactored for better error messages 2022-02-21 18:24:19 +08:00
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
80d3ab1b0f remove bigints 2021-12-26 00:23:54 +08:00
de8fc264d7 fix unsupported default parameter error message 2021-11-23 15:34:44 +08:00
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
ffa89e9308 fix clippy warnings 2021-11-06 23:00:18 +08:00
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
99b29d8ded Merge branch 'master' into with_nac3comment 2021-11-05 20:46:29 +08:00
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
b239806558 nac3core: adapt to ast change due to comment support 2021-11-04 15:02:51 +08:00
47f563908a basic string support (#30) 2021-11-02 23:22:49 +08:00