diff options
| author | Antonio Navarro Perez <antnavper@gmail.com> | 2024-03-20 11:15:48 +0100 |
|---|---|---|
| committer | Antonio Navarro Perez <antnavper@gmail.com> | 2024-03-20 11:15:48 +0100 |
| commit | 649ae829220d6ddd8758d24c3bc2ea7d43e788d6 (patch) | |
| tree | ca5bccce3a8ac04a96fc795b06bc40d08384286d /main.go | |
| parent | 5da3a651ba08859ccc1cdf1094603411696c8df2 (diff) | |
feat: Add simple Dump creation and recovery.
Memory Dump functionality that can restore the previous VM state.
It dumps *global* variables, the only ones defining the program state.
The dump depends on the program itself, and on the index system, which right now is defined by the variable order.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -8,6 +8,7 @@ import ( "io" "log" "os" + "reflect" "github.com/mvertes/parscan/lang/golang" "github.com/mvertes/parscan/parser" @@ -15,7 +16,7 @@ import ( ) type Interpreter interface { - Eval(string) (any, error) + Eval(string) (reflect.Value, error) } func main() { @@ -44,7 +45,7 @@ func repl(interp Interpreter, in io.Reader) (err error) { text += liner.Text() res, err := interp.Eval(text + "\n") if err == nil { - if res != nil { + if !res.IsNil() { fmt.Println(": ", res) } text, prompt = "", "> " |
