* feat: extract code for compiling equal operator
* feat: support last argument append with comma
---------
Co-authored-by: Anton Medvedev <[email protected]>
Simplifies the code by using the type switch variable binding instead of
performing an additional type assertion.
Signed-off-by: Ville Vesilehto <[email protected]>
Co-authored-by: Anton Medvedev <[email protected]>
* feat: extract code for compiling equal operator
* fix: fix unary and binary node print
consider the precedence of operators and their associative law when printing unary and binary nodes
---------
Co-authored-by: Anton Medvedev <[email protected]>
* Reset tracking of applied operator overloads before every walk of the ast tree.
* Remove limit on operator overload resolution
* Do separate patcher phase for those that require multiple passes (Currently only need for Operator overloading). This patcher phase is run after other patchers.
* Add test to track how many times a patcher is run. Used to detect if patching phases is erroneously applying the patcher multiple times.
---------
Co-authored-by: Anton Medvedev <[email protected]>
* feat: add node budget and memory limits
Implement compile-time and runtime safeguards against deeply nested expressions:
- Add MaxNodes limit to track and limit AST node count during parsing
- Move MemoryBudget from VM to Config for better configurability
- Add node creation tracking in parser to enforce node budget
- Refactor node creation to check limits before allocation
- Add RunWithConfig to VM for passing memory budget settings
- Set reasonable defaults in Config (10000 nodes, 1M memory)
- Add comprehensive tests for both node and memory limits
This prevents stack overflows from malicious or poorly written expressions
by failing fast with clear error messages during compilation or runtime.
Signed-off-by: Ville Vesilehto <[email protected]>
* Update parser.go
Signed-off-by: Anton Medvedev <[email protected]>
---------
Signed-off-by: Ville Vesilehto <[email protected]>
Signed-off-by: Anton Medvedev <[email protected]>
Co-authored-by: Anton Medvedev <[email protected]>