Commit Graph

33 Commits (847615fc2f7d7736f3e66a00aea9e2584eda3975)

Author SHA1 Message Date
David Mak 847615fc2f core: Implement numpy.matmul for 2D-2D ndarrays 2024-04-23 10:27:37 +08:00
David Mak 52c731c312 core: Implement Not/UAdd/USub for booleans
Not sure if this is deliberate or an oversight, but we implement it
anyway for consistency with other Python implementations.
2024-04-12 18:29:58 +08:00
David Mak 937a8b9698 core/magic_methods: Fix type of unary ops with primitive types 2024-04-05 13:23:08 +08:00
David Mak a920fe0501 core: Implement elementwise comparison operators 2024-04-03 00:07:33 +08:00
David Mak 727a1886b3 core: Implement elementwise unary operators 2024-04-03 00:07:33 +08:00
David Mak 6af13a8261 core: Implement elementwise binary operators
Including immediate variants of these operators.
2024-04-03 00:07:33 +08:00
David Mak 3540d0ab29 core/magic_methods: Add typeof_*op
Used to determine the expected type of the binary operator with
primitive operands.
2024-04-03 00:07:33 +08:00
David Mak a77fd213e0 core/magic_methods: Allow unknown return types
These types can be later inferred by the type inferencer.
2024-04-02 16:49:12 +08:00
David Mak 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
David Mak 02933753ca core: Apply clippy pedantic changes 2023-12-11 15:16:23 +08:00
David Mak 5182453bd9 meta: Remove redundant path prefixes 2023-12-11 15:16:23 +08:00
David Mak d322c91697 core: Change bitshift operators to accept int32/uint32 for RHS operand 2023-11-09 12:16:20 +08:00
ychenfo 711c3d3303 nac3core: support custom operators 2022-04-18 15:31:56 +08:00
ychenfo 79c469301a basic unsigned integer support 2022-03-08 13:34:02 +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
Sebastien Bourdeauducq 4a65d82db5 introduce IRRT, implement power
based on code by Yijia
#160
2022-01-09 00:57:50 +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
Sebastien Bourdeauducq bf7e2c295a integrate nac3parser 2021-11-03 17:11:00 +08:00
ychenfo c238c264e7 add type vars to the primitive binop function def 2021-08-19 11:18:58 +08:00
ychenfo fa40fd73c6 formatted 2021-08-16 20:17:08 +08:00
ychenfo 3734663188 add RefCell to FunSignature in TypeEnum 2021-08-16 13:53:45 +08:00
ychenfo 99276c8f31 formatted 2021-08-11 15:18:21 +08:00
pca006132 86ca02796b function parameter handling 2021-08-07 17:25:14 +08:00
ychenfo 18db2ddd53 change the type TypeEnum::TObj {object_id} to DefinitionId as with top_level
change TopLevelDef::Class {object_id} to DefinitionId
2021-08-06 10:57:01 +08:00
ychenfo c0227210df bit shift lhs rhs same type; float ** int and float ** float both supported 2021-08-05 11:55:46 +08:00
CrescentonC 99c71687a6 fixed: bitwise shift rhs can only be int32; better structured code 2021-08-04 16:46:16 +08:00
CrescentonC d052f007fb fix typo of primitives method 2021-08-04 12:03:56 +08:00
CrescentonC d4807293b0 clean up unused variabls and comments 2021-08-03 10:41:52 +08:00
CrescentonC a7e3eeea0d add primitive magic method support; change from TypeEnum::TObj { fields: Mapping<String>, ..} to TypeEnum::TObj {fields: RefCell<Mapping<String>>, .. } for interior mutability 2021-08-02 17:36:37 +08:00
CrescentonC 7e0d55443a better structured primitive magic methods impl 2021-08-02 11:28:05 +08:00
CrescentonC 9983aa62e6 add primitive magic methods 2021-07-30 15:40:14 +08:00
pca006132 7c9919256c begin refactoring 2021-06-28 10:49:41 +08:00