basic expression interpreter
This commit is contained in:
parent
eebaadc16e
commit
b244f7e3b2
5 changed files with 186 additions and 16 deletions
6
run.go
6
run.go
|
|
@ -4,10 +4,10 @@ import (
|
|||
"errors"
|
||||
"os"
|
||||
|
||||
"git.red-panda.pet/pandaware/lox-go/ast"
|
||||
"git.red-panda.pet/pandaware/lox-go/lexer"
|
||||
"git.red-panda.pet/pandaware/lox-go/parser"
|
||||
"git.red-panda.pet/pandaware/lox-go/reporter"
|
||||
"git.red-panda.pet/pandaware/lox-go/runtime"
|
||||
)
|
||||
|
||||
func RunFile(filename string) error {
|
||||
|
|
@ -36,8 +36,8 @@ func Run(source string) error {
|
|||
return errors.New("parser error")
|
||||
}
|
||||
|
||||
printer := &ast.Printer{}
|
||||
reporter.Debug(0, "astPrinter", "stdin", printer.Print(expr))
|
||||
interpreter := runtime.NewInterpreter()
|
||||
reporter.Debug(0, "interpreter", "stdin", interpreter.Evaluate(expr).Debug())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue