Skip to content

Commit

Permalink
update repl
Browse files Browse the repository at this point in the history
  • Loading branch information
JunNishimura committed Jun 30, 2024
1 parent 9fd48f0 commit ad0c8be
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion repl/repl.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import (

"github.com/JunNishimura/go-lisp/evaluator"
"github.com/JunNishimura/go-lisp/lexer"
"github.com/JunNishimura/go-lisp/object"
"github.com/JunNishimura/go-lisp/parser"
)

const PROMPT = ">> "

func Start(in io.Reader, out io.Writer) {
scanner := bufio.NewScanner(in)
env := object.NewEnvironment()

for {
fmt.Printf("%s", PROMPT)
Expand All @@ -32,7 +34,7 @@ func Start(in io.Reader, out io.Writer) {
continue
}

evaluated := evaluator.Eval(program)
evaluated := evaluator.Eval(program, env)
if evaluated != nil {
io.WriteString(out, evaluated.Inspect())

Check failure on line 39 in repl/repl.go

View workflow job for this annotation

GitHub Actions / lint

Error return value of `io.WriteString` is not checked (errcheck)
io.WriteString(out, "\n")

Check failure on line 40 in repl/repl.go

View workflow job for this annotation

GitHub Actions / lint

Error return value of `io.WriteString` is not checked (errcheck)
Expand Down

0 comments on commit ad0c8be

Please sign in to comment.