16 Commits
Author SHA1 Message Date
Anton MedvedevandGitHub c953d0dde1 Refactor types table (#667) 2024-06-04 00:08:01 +02:00
Anton MedvedevandGitHub fee5690347 Refactor checker to use Nature (#665)
This PR introduces a new concept inside Expr's type checker - Nature.

It's an abstraction other reflect.Type which carries additional information about possible type, methods and builtin function.

I was able to find and fix a few bugs in type checker and optimizer. Implementation of nature concept has proven itself. As well nature will allow to bring more feature for type checker in future.

Why Nature? I was looking for a name to replace Type. Type name already carries much information, as well can be confused with reflect.Type. Nature name should be understood as "nature of the node", same as "type of the node".
2024-06-01 00:09:22 +02:00
Anton Medvedev 551d2a7e0f Use expr-lang/expr 2023-12-03 21:53:01 +01:00
Anton Medvedev 32f5fde2eb Replace interface{} with any 2023-08-30 11:25:15 +02:00
Anton Medvedev e37105ef90 Fix float folding optimization 2023-08-28 22:24:46 +02:00
Andrew BentonandAnton Medvedev ab25d4658b Adds simple bool condition optimization
This change introduces simple boolean condition optimization when
dealing with boolean `and`, `or`, and `==` expressions to help trim
unnecessary AST nodes.
2023-02-01 20:44:32 +01:00
Anton Medvedev a3281d9f3a Fix constant folding for floats and ints 2022-11-08 20:58:23 +01:00
Anton Medvedev 6e7a89b65c Optimizer should return []interface{} as well. 2022-11-05 20:33:41 +01:00
Anton Medvedev 371e24c30d Add ^ as exponent operator 2022-11-05 20:21:48 +01:00
Anton Medvedev 97b2a9e16d Simplify ast.Visitor interface 2022-11-02 22:27:34 +01:00
Anton Medvedev fe5383a8d5 Add fold filter optimizations 2022-10-27 21:43:47 +02:00
Anton Medvedev 31ed24b493 Fix compiler fold optimization of "integer divide by zero" 2020-09-09 22:07:26 +02:00
Anton Medvedev 20bb4fdf1a use patch func 2020-05-10 13:51:54 +03:00
Ernest MickleiandAnton Medvedev 28881a233c fix folding of constant ints 2020-05-10 13:51:54 +03:00
Anton Medvedev 5e0ef67844 Use ast.Patch func 2020-03-16 16:29:25 +03:00
Anton MedvedevandGitHub acba548cab Add ConstExpr 2020-03-10 08:36:12 +03:00