From 22b020225ae77ca1cf9f9984817df9b7fd1aaa12 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 27 Nov 2025 14:50:07 +0100 Subject: fix: improve parser, compiler and interpreter APIs Pass a language spec as an argument when create a new parser, compiler or interpreter. Also move the REPL code in interpreter package. --- interpreter/dump_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'interpreter/dump_test.go') diff --git a/interpreter/dump_test.go b/interpreter/dump_test.go index dd172b9..d8fcc55 100644 --- a/interpreter/dump_test.go +++ b/interpreter/dump_test.go @@ -4,11 +4,12 @@ import ( "testing" "github.com/mvertes/parscan/interpreter" + "github.com/mvertes/parscan/lang/golang" ) func TestDump(t *testing.T) { initProgram := "var a int = 2+1; a" - interp := interpreter.NewInterpreter(GoScanner) + interp := interpreter.NewInterpreter(golang.GoSpec) r, e := interp.Eval(initProgram) t.Log(r, e) if e != nil { @@ -24,7 +25,7 @@ func TestDump(t *testing.T) { d := interp.Dump() t.Log(d) - interp = interpreter.NewInterpreter(GoScanner) + interp = interpreter.NewInterpreter(golang.GoSpec) r, e = interp.Eval(initProgram) t.Log(r, e) if e != nil { -- cgit v1.2.3