further improvements
Some checks failed
Build / build (push) Successful in 10m40s
Publish Image / publish (push) Failing after 34s
Test / build (push) Has been cancelled

This commit is contained in:
2024-04-01 17:02:44 -04:00
parent aebbe43999
commit f9e6e164b0
26 changed files with 168 additions and 138 deletions

View File

@@ -20,7 +20,7 @@ import (
// Package repl implements the Read-Eval-Print-Loop or interactive console
// by lexing, parsing and evaluating the input in the interpreter
func VmREPL(args []string, debug bool) error {
func VmREPL(args []string, debug, trace bool) error {
var state = vm.NewVMState()
object.Args = args
@@ -73,6 +73,8 @@ func VmREPL(args []string, debug bool) error {
mvm := vm.NewWithState("<stdin>", c.Bytecode(), state)
mvm.Debug = debug
mvm.Trace = trace
if err := mvm.Run(); err != nil {
fmt.Fprintf(t, "runtime error: %v\n", err)
continue
@@ -129,7 +131,7 @@ func acceptUntil(t *term.Terminal, start, end string) (string, error) {
return buf.String(), nil
}
func SimpleVmREPL(args []string, debug bool) {
func SimpleVmREPL(args []string, debug, trace bool) {
var (
state = vm.NewVMState()
reader = bufio.NewReader(os.Stdin)
@@ -171,6 +173,8 @@ func SimpleVmREPL(args []string, debug bool) {
mvm := vm.NewWithState("<stdin>", c.Bytecode(), state)
mvm.Debug = debug
mvm.Trace = trace
if err := mvm.Run(); err != nil {
fmt.Printf("runtime error: %v\n", err)
continue