Commit Graph

50 Commits (bf7e2c295af0c1f0774a3636a6e1545b064eae50)

Author SHA1 Message Date
Sebastien Bourdeauducq bf7e2c295a integrate nac3parser 2021-11-03 17:11:00 +08:00
pca006132 279f47f633 nac3core/codegen: avoid sending unifiers
Previously, we have to copy types from one unification table to another,
and make the table sendable. This requires cloning (processing) the
whole table 3 times per function call which is not efficient and uses
more memory than required when the unification table is large.

We now use a concrete type table to only copy the type we need. This
reduces the overhead as we only need to process the unification table
for once (when we do the function codegen), and reduces memory usage by
a bit (but not noticeable when the unification table is small, i.e. the
types are simple).
2021-10-17 13:02:18 +08:00
pca006132 26076c37ba nac3core/typecheck: supports recursive type inference 2021-10-16 15:56:49 +08:00
pca006132 105d605e6d nac3core: fix clippy warnings 2021-09-22 18:04:06 +08:00
pca006132 97f5b7c324 fixed performance regression 2021-09-22 18:04:06 +08:00
pca006132 084efe92af nac3core: use string interning 2021-09-22 18:04:06 +08:00
ychenfo 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
pca006132 180392e2ab typecheck: fixed recursive substitution 2021-09-12 21:33:21 +08:00
ychenfo 471547855e nac3core: toplevel change class method name handling, cleanup comments 2021-09-12 13:14:46 +08:00
ychenfo 917d447605 nac3core: clean up, fix broken test 2021-09-09 02:09:35 +08:00
ychenfo f1013d9a17 nac3core: top level fix type var within list tuple, test of type var application compatibility 2021-09-09 02:03:44 +08:00
ychenfo 235b6e34d1 nac3core: top level derive fmt::Debug, fix dead lock 2021-09-07 00:20:40 +08:00
pca006132 173102fc56 codegen/expr: function codegen and refactoring 2021-08-25 15:29:58 +08:00
pca006132 1ffa1a8bb0 typecheck/typedef: added copy_from
This function would copy concrete type from one unifier to another
unifier, and can handle recursive types. This would be used in code
generation for moving types from one unification table to another one.
2021-08-25 12:02:10 +08:00
ychenfo 32773c14e0 move top level related things to a separate module 2021-08-24 17:19:17 +08:00
ychenfo 7b1fe36e90 formatted 2021-08-23 11:13:45 +08:00
pca006132 957ceb74e4 nac3core/typecheck: added basic location information 2021-08-21 14:51:46 +08:00
pca006132 3279f7a776 codegen for simple function call, and various fixes 2021-08-19 15:30:15 +08:00
ychenfo fa40fd73c6 formatted 2021-08-16 20:17:08 +08:00
ychenfo eb814dd8c3 clean unused use 2021-08-16 13:57:21 +08:00
ychenfo 3734663188 add RefCell to FunSignature in TypeEnum 2021-08-16 13:53:45 +08:00
pca006132 cb01c79603 removed Arc from TypeEnum 2021-08-13 13:33:59 +08:00
pca006132 1db8378f60 formatting 2021-08-12 16:36:23 +08:00
ychenfo 3a93e2b048 TypeEnum::TObj.param is now RefCell for interior mutability 2021-08-12 13:17:51 +08:00
pca006132 de8b67b605 refactored symbol resolver 2021-08-11 17:28:29 +08:00
pca006132 86ca02796b function parameter handling 2021-08-07 17:25:14 +08:00
pca006132 7a38ab3119 codegen for function call 2021-08-07 15:06:39 +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
pca006132 29286210b5 implementing codegen 2021-08-05 14:56:09 +08:00
pca006132 f00c1813e3 top-level related changes 2021-08-03 13:38:27 +08:00
pca006132 a3acf09bda typedef: make it send
Rc in calls is not send, so we use Arc instead.
2021-08-03 12:38:12 +08:00
CrescentonC d4721db4a3 not creating temp for borrow, more concise code 2021-08-03 09:45:39 +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
pca006132 eba92ed8bd added method to get all instantiations 2021-07-30 16:32:50 +08:00
pca006132 7ad8e2d81d cleanup some error reporting code 2021-07-30 13:50:46 +08:00
pca006132 743a9384a3 added rigid type variable 2021-07-30 11:28:27 +08:00
pca006132 832513e210 new is_concrete type check 2021-07-28 17:25:19 +08:00
pca006132 8d0856a58d added documentation 2021-07-26 14:38:18 +08:00
pca006132 bf31c48bba fixed missing unification 2021-07-26 14:20:47 +08:00
pca006132 8618837816 fixed range unification 2021-07-26 12:00:06 +08:00
pca006132 d7df93bef1 fixed range check 2021-07-23 17:22:05 +08:00
pca006132 d140164a38 fixed virtual unification 2021-07-23 16:19:00 +08:00
pca006132 ddcf4b7e39 refactored typedef 2021-07-23 15:57:37 +08:00
pca006132 c315227a28 init function check 2021-07-22 15:36:37 +08:00
pca006132 d484fa1e5c added return type check 2021-07-22 11:49:00 +08:00
pca006132 09c9218852 use custom unification table implementation
as the ena implementation did not expose the underlying vector store, we
cannot map over it to get a table without Rc<RefCell<T>> so that we can
send it around...
2021-07-22 11:37:29 +08:00
pca006132 4f81690128 modified occur check 2021-07-21 16:10:11 +08:00
pca006132 2f5c3b3cb7 more cleanup and started adding tests 2021-07-21 15:36:35 +08:00
pca006132 25ff24a320 modified interface 2021-07-21 14:24:46 +08:00
pca006132 0296844d5f cleanup 2021-07-21 13:28:05 +08:00