summaryrefslogtreecommitdiff
path: root/vm/op_string.go
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2026-01-06 19:02:29 +0100
committerMarc Vertes <mvertes@free.fr>2026-01-06 19:02:29 +0100
commitbffc031ea83c7176aac3d3828de0060c6630140c (patch)
tree32e30f3bec94884936c2cfc2d53d3ae496e13d61 /vm/op_string.go
parentf07fc0178831432b68f1b9bd6c96b257aa2e9abe (diff)
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.
Diffstat (limited to 'vm/op_string.go')
-rw-r--r--vm/op_string.go19
1 files changed, 10 insertions, 9 deletions
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