From bffc031ea83c7176aac3d3828de0060c6630140c Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 6 Jan 2026 19:02:29 +0100 Subject: fix: correct and simplify parsing of expressions. The expressions were parsed from right to left, and it was incorrect and cumbersome. Now they are processed from left to right, with a simpler and correct handling of precedence rules. The vm function call syntax has been changed to set the function before the input arguments on the stack, as to follow the declaring order in languages. --- vm/op_string.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'vm/op_string.go') diff --git a/vm/op_string.go b/vm/op_string.go index 63bf738..7eb0e5d 100644 --- a/vm/op_string.go +++ b/vm/op_string.go @@ -38,18 +38,19 @@ func _() { _ = x[Loweri-27] _ = x[Mul-28] _ = x[New-29] - _ = x[Not-30] - _ = x[Pop-31] - _ = x[Push-32] - _ = x[Return-33] - _ = x[Sub-34] - _ = x[Subi-35] - _ = x[Swap-36] + _ = x[Negate-30] + _ = x[Not-31] + _ = x[Pop-32] + _ = x[Push-33] + _ = x[Return-34] + _ = x[Sub-35] + _ = x[Subi-36] + _ = x[Swap-37] } -const _Op_name = "NopAddAddrAssignFassignVassignCallCalliCallXDerefDupFdupFnewEqualEqualSetExitFieldFieldSetGreaterGrowIndexJumpJumpTrueJumpFalseJumpSetTrueJumpSetFalseLowerLoweriMulNewNotPopPushReturnSubSubiSwap" +const _Op_name = "NopAddAddrAssignFassignVassignCallCalliCallXDerefDupFdupFnewEqualEqualSetExitFieldFieldSetGreaterGrowIndexJumpJumpTrueJumpFalseJumpSetTrueJumpSetFalseLowerLoweriMulNewNegateNotPopPushReturnSubSubiSwap" -var _Op_index = [...]uint8{0, 3, 6, 10, 16, 23, 30, 34, 39, 44, 49, 52, 56, 60, 65, 73, 77, 82, 90, 97, 101, 106, 110, 118, 127, 138, 150, 155, 161, 164, 167, 170, 173, 177, 183, 186, 190, 194} +var _Op_index = [...]uint8{0, 3, 6, 10, 16, 23, 30, 34, 39, 44, 49, 52, 56, 60, 65, 73, 77, 82, 90, 97, 101, 106, 110, 118, 127, 138, 150, 155, 161, 164, 167, 173, 176, 179, 183, 189, 192, 196, 200} func (i Op) String() string { idx := int(i) - 0 -- cgit v1.2.3