Commit Graph

54 Commits

Author SHA1 Message Date
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
fb92b6d364 nac3core: supports range iterator 2021-10-23 23:53:36 +08:00
c4259d14d1 fixed some clippy warnings 2021-10-16 18:08:13 +08:00
f0fdfe42cb nac3core: better impl of #24 2021-09-30 17:07:48 +08:00
105d605e6d nac3core: fix clippy warnings 2021-09-22 18:04:06 +08:00
084efe92af nac3core: use string interning 2021-09-22 18:04:06 +08:00
20905a9b67 nac3core: better field initialization check 2021-09-21 03:02:12 +08:00
dd1be541b8 nac3core: allow class to have no __init__, function/method name with module path added to ensure uniqueness 2021-09-20 23:36:19 +08:00
4939ff4dbd simple implementation of classes 2021-09-19 22:54:06 +08:00
471547855e nac3core: toplevel change class method name handling, cleanup comments 2021-09-12 13:14:46 +08:00
2ce507964c nac3core: fix broken top level test due to hashmap order 2021-09-09 00:44:56 +08:00
87f25e1c5d nac3core: remove mutex on dyn symbol resolve 2021-09-08 19:27:32 +08:00
55335fc05d nac3core: top level simple type var handled 2021-09-08 02:27:12 +08:00
247b364191 nac3core: top level fix cyclic ancestor analysis, add tests 2021-09-07 17:30:15 +08:00
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
7bbd608492 nac3core: top level cleanup, rewrite ancestors handling, __init__ occruence check 2021-08-31 13:54:16 +08:00