Commit Graph

114 Commits

Author SHA1 Message Date
a4f53b6e6b [core] codegen: Refactor ProxyType and ProxyValue
Accepts generator+context object for generic type checking. Also
implements more default trait impl for easier delegation.
2024-11-19 13:46:25 +08:00
9d9ead211e [core] Move Proxies to their own modules 2024-11-19 13:46:23 +08:00
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
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
973dc5041a core/typecheck: Support tuple arg type in len() 2024-08-13 15:02:59 +08:00
9b988647ed core/toplevel/builtins: Extract len() into builtin function 2024-08-13 15:02:59 +08:00
6a64c9d1de core/typecheck/typedef: Add is_vararg_ctx to TTuple 2024-08-06 11:45:54 +08:00
cbf79c5e9c core/typecheck/typedef: Add is_vararg to FuncArg, ConcreteFuncArg 2024-08-06 11:43:13 +08:00
63d2b49b09 core: remove np_linalg_matmul 2024-08-05 11:44:55 +08:00
1c72698d02 core: add np_linalg_det and np_linalg_matrix_power functions 2024-07-31 18:02:54 +08:00
54f883f0a5 core: implement np_dot using LLVM_IR 2024-07-31 15:53:51 +08:00
00236f48bc core: add np.transpose and np.reshape functions 2024-07-31 13:23:07 +08:00
2242c5af43 core: add linalg methods 2024-07-29 16:48:06 +08:00
8adfe781c5 core/toplevel: fix PrimDef method names 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
6c10e3d056 core: cargo clippy 2024-07-12 21:18:53 +08:00
2dbc1ec659 cargo fmt 2024-07-12 21:16:38 +08:00
cea7cade51 core: add np_argmax/np_argmin functions 2024-07-12 18:18:28 +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
5b11a1dbdd core: support tuple and int32 input for np_empty, np_ones, and more 2024-06-27 14:30:17 +08:00
7fe2c3496c core: add attribute field to class definition 2024-06-25 16:06:33 +08:00
e85f4f9bd2 core: refactor top_level::builtins::get_builtins() 2024-06-18 11:06:25 +08:00
2abe75d1f4 core: remove code dup with make_exception_fields 2024-06-17 12:01:48 +08:00
676412fe6d apply cargo fmt 2024-06-14 09:46:42 +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
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
6153f94b05 core/numpy: Implement codegen for np_array 2024-06-11 16:42:11 +08:00
4730b595f3 core/builtins: Add np_array function 2024-06-11 16:42:08 +08:00
210d9e2334 core: Add more creator functions for ProxyType 2024-06-11 15:26:37 +08:00
520e1adc56 core/builtins: Add np_minimum/np_maximum 2024-05-09 15:01:20 +08:00
73e81259f3 core/builtins: Add np_min/np_max 2024-05-09 15:01:20 +08:00
30c6cffbad core/builtins: Refactored numpy builtins to accept scalar and ndarrays 2024-05-06 15:38:29 +08:00
51671800b6 core/builtins: Extract codegen portion into functions
We will need to reuse them when implementing elementwise function
application for ndarrays.
2024-05-06 13:21:54 +08:00
7195476edb core/builtins: Add llvm_intrinsics prefix 2024-05-06 13:21:54 +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
f58c3a11f8 core/builtins: Rework handling of PrimitiveStore-Unifier tuples 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
64a3751fc2 core: Remove custom function type definitions for ndarray operators 2024-05-06 13:21:54 +08:00
5dfcc63978 core/classes: Take reference of indexes 2024-04-16 17:20:24 +08:00
6af13a8261 core: Implement elementwise binary operators
Including immediate variants of these operators.
2024-04-03 00:07:33 +08:00
d5f4817134 core/builtins: Fix len() on ndarrays 2024-04-01 16:48:24 +08:00
1b77e62901 core: Split numpy into codegen and toplevel 2024-03-22 15:07:28 +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
b26cb2b360 core: Express member func def IDs as offsets from class def ID 2024-03-06 12:24:39 +08:00