Commit Graph

70 Commits

Author SHA1 Message Date
a98f33e6d1 [meta] Reorganize order of use declarations - Phase 2
Some more rules:

- For module-level imports, prefer no prefix > super > crate.
- Use crate instead of super if super refers to the crate-level module
2024-10-17 15:57:33 +08:00
65a12d9ab3 [core] Refactor registration of top-level variables 2024-10-07 17:05:48 +08:00
c7697606e1 [core] Add TopLevelDef::Variable 2024-10-04 13:09:25 +08:00
fe06b2806f [meta] Reorganize order of use declarations
Use declarations are now grouped into 4 groups:

- Declarations from the standard library
- Declarations from external crates
- Declarations from other crates in this project
- Declarations from within this module

Furthermore, all use declarations are grouped together to enhance
readability. super::super is also replaced by an equivalent crate::
declaration.
2024-10-04 12:52:01 +08:00
2cf64d8608
apply clippy comment changes 2024-08-21 11:21:10 +08:00
7fe2c3496c core: add attribute field to class definition 2024-06-25 16:06:33 +08:00
06e9d90d57 apply clippy changes 2024-06-21 14:14:01 +08:00
e85f4f9bd2 core: refactor top_level::builtins::get_builtins() 2024-06-18 11:06:25 +08:00
f026b48e2a core: refactor to use TypeVarId and TypeVar 2024-06-13 16:59:10 +08:00
8168692cc3 apply cargo fmt 2024-06-12 14:45:03 +08:00
eecba0b71d core: Add GenCall::create_dummy
A simple abstraction for GenCalls that are already handled elsewhere.
2024-05-06 13:21:54 +08:00
d0766a116f core: Remove Box from GenCallCallback type alias
So that references to the function type can be taken.
2024-05-06 13:21:54 +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
27fcf8926e core: Implement ndarray constructor and numpy.empty 2023-12-22 16:29:54 +08:00
02933753ca core: Apply clippy pedantic changes 2023-12-11 15:16:23 +08:00
d304afd333 meta: Apply clippy suggested changes 2023-12-11 15:16:23 +08:00
36a6a7b8cd core: Replace TopLevelDef comments with documentation 2023-11-01 18:03:29 +08:00
d9cb506f6a nac3core: refactored for better error messages 2022-02-21 18:24:19 +08:00
050c862c1a nac3core: function codegen callback changes
Added code generator argument to the callback, so it would be easier to
write complicated codegen with that callback. To prepare for RPC
codegen.
2022-02-12 21:24:41 +08:00
aa2d79fea6 Merge branch 'master' into built_in_floor_ceil 2021-12-02 01:08:55 +08:00
dfd3548ed2 TypeVar and virtual support in Symbol Resolver (#99)
Add `TypeVar` and `virtual` support for Symbol Resolver in nac3artiq and nac3standalone

Reviewed-on: #99
Co-authored-by: ychenfo <yc@m-labs.hk>
Co-committed-by: ychenfo <yc@m-labs.hk>
2021-12-01 22:44:53 +08:00
7ede4f15b6 nac3core: move builtin definitions to another file 2021-12-01 02:52:00 +08:00
4587088835 Constant Default Parameter Support (#98)
Add support for constant default parameter

Reviewed-on: #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
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
bf7e2c295a integrate nac3parser 2021-11-03 17:11:00 +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
693ac7d336 nac3core/toplevel: added personality symbol config 2021-09-25 21:44:00 +08:00
084efe92af nac3core: use string interning 2021-09-22 18:04:06 +08:00
891056631f nac3core: use Arc to reduce copy 2021-09-22 18:04:06 +08:00
4fe643f45b allows function ending with a number 2021-09-22 14:45:42 +08:00
4939ff4dbd simple implementation of classes 2021-09-19 22:54:06 +08:00
526c18bda0 nac3core: top level inferencer without type var should be ok 2021-09-17 00:39:42 +08:00
2ac3f9a176 nac3core: separate top level compoer to a new file 2021-09-12 05:10:10 +08:00
cb310965b8 nac3core: toplevel register consider module path 2021-09-12 05:00:26 +08:00
118f19762a nac3core: toplevel format 2021-09-12 04:40:40 +08:00
b419634f8a nac3core: top level fields inheritance check, more tests 2021-09-12 04:34:30 +08:00
147298ff40 nac3core: top level fix class fields as nac3 spec 2021-09-12 03:49:21 +08:00
c7cb02b0f3 nac3core: toplevel fix parse type annotation dead lock 2021-09-12 03:01:56 +08:00
9eef51f29f nac3core: top level class method self parameter fixed 2021-09-10 16:14:08 +08:00
917d447605 nac3core: clean up, fix broken test 2021-09-09 02:09:35 +08:00
2ce507964c nac3core: fix broken top level test due to hashmap order 2021-09-09 00:44:56 +08:00
5a1a8ecee3 nac3core: self is not not allowed to explicitly appear in method type annotations 2021-09-08 21:53:54 +08:00
1300b5ebdd nac3core: clean up and format 2021-09-08 19:45:36 +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
bbcec6ae6f nac3core: toplevel fix bug in make self annotation and return type check 2021-09-07 10:03:31 +08:00
235b6e34d1 nac3core: top level derive fmt::Debug, fix dead lock 2021-09-07 00:20:40 +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