Skip to content

Commit

Permalink
feat: updates REPL to support identifier parsing
Browse files Browse the repository at this point in the history
Signed-off-by: maxwellgithinji <[email protected]>
  • Loading branch information
maxwellgithinji committed Feb 1, 2024
1 parent 50208c2 commit e1b9564
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/repl/repl.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/maxwellgithinji/jaba/pkg/evaluator"
"github.com/maxwellgithinji/jaba/pkg/lexer"
"github.com/maxwellgithinji/jaba/pkg/object"
"github.com/maxwellgithinji/jaba/pkg/parser"
)

Expand All @@ -33,6 +34,7 @@ ____
// it helps the user code the jaba program on the command line
func Run(in io.Reader, out io.Writer) {
scanner := bufio.NewScanner(in)
env := object.NewEnvironment()
for {
fmt.Fprint(out, Prompt)
scanned := scanner.Scan()
Expand All @@ -52,7 +54,7 @@ func Run(in io.Reader, out io.Writer) {
continue
}

evaluated := evaluator.Eval(program)
evaluated := evaluator.Eval(program, env)

if evaluated != nil {
io.WriteString(out, evaluated.Inspect())
Expand Down

0 comments on commit e1b9564

Please sign in to comment.