diff options
| author | Bobby <[email protected]> | 2024-03-04 09:07:29 -0500 |
|---|---|---|
| committer | Bobby <[email protected]> | 2024-03-04 09:07:29 -0500 |
| commit | b52f4e9b4140f482ad966aa354b39cd305a212ec (patch) | |
| tree | baf7e8a78dae0fabca6f24cc10b0fa484771598b /repl | |
| parent | c430bfcae07489ad52ae65cadee581be72dd35d1 (diff) | |
| download | mana-b52f4e9b4140f482ad966aa354b39cd305a212ec.tar.xz mana-b52f4e9b4140f482ad966aa354b39cd305a212ec.zip | |
LetStatements
Diffstat (limited to 'repl')
| -rw-r--r-- | repl/repl.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/repl/repl.go b/repl/repl.go index 9a43119..59c56d6 100644 --- a/repl/repl.go +++ b/repl/repl.go @@ -7,6 +7,7 @@ import ( "mana/lexer" "mana/parser" "mana/evaluator" + "mana/object" ) // PROMPT is the prompt for the REPL. @@ -22,6 +23,8 @@ const MANA_START = ` func Start(in io.Reader, out io.Writer) { var scanner *bufio.Scanner = bufio.NewScanner(in) + env := object.NewEnvironment() + io.WriteString(out, MANA_START + "\n") for { @@ -43,7 +46,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()) io.WriteString(out, "\n") |
