munificent / craftinginterpreters

Repository for the book "Crafting Interpreters"
http://www.craftinginterpreters.com/
Other
8.75k stars 1.03k forks source link

Fixes munificent/craftinginterpreters#1000 #1001

Closed mhmdvoid closed 2 years ago

mhmdvoid commented 2 years ago

Initial implementaion Scope-like solution for repl-mode expression result. Previously:

">" 10 + 10; ">".. ">" fun foo() { return 10; } ">" foo(); ">" ....

Saving Expression with respect to their scope and print them out to console for every line will be very interactive to see immediate result, However, In this commit we just solved it for binaryExpression 'including within varDeclaration' and function calls.

Currently:

">" 299 + 1; 300.0 ">" .. ">" fun foobar() { 10 + 10; return 8; } 8.0 ">" var x = 10 + 10; 20 ">" ..

Warning: var statement shouldn't produce immediate values til asked for. We will try to solve it.