start working on opperations

This commit is contained in:
2023-03-07 18:27:06 +00:00
parent 1b3a4c44d9
commit dfb93c60b4
11 changed files with 185 additions and 21 deletions

View File

@@ -1,5 +1,10 @@
package main
import (
"fmt"
"reflect"
)
// returns (number|string|nil), error
func runVal(line any, stack stack) (any, ArErr) {
if len(stack) > 500 {
@@ -26,6 +31,7 @@ func runVal(line any, stack stack) (any, ArErr) {
return setVariableValue(x, stack)
case negative:
resp, err := runVal(x.VAL, stack)
resp = classVal(resp)
if err.EXISTS {
return nil, err
}
@@ -40,7 +46,10 @@ func runVal(line any, stack stack) (any, ArErr) {
}
case brackets:
return runVal(x.VAL, stack)
case operationType:
return runOperation(x, stack)
}
fmt.Println("unreachable", reflect.TypeOf(line))
panic("unreachable")
}