Currently, the REPL mode evaluates programs line by line, which means egglog < main.egg almost certainly won't work because most expressions are multi-lines. Moreover, simply concatenating all lines in the source file (e.g., tr -d "\n" < main.egg | egglog) also does not work if the source file contains comments.
This PR fixes this by only evaluating a multi-line block when all the parentheses are closed. So that the program
(extract "1
2
3
)
"
) (extract
";;;""))"
)
will only call parse_and_run_program once once at the end of the program
Currently, the REPL mode evaluates programs line by line, which means
egglog < main.egg
almost certainly won't work because most expressions are multi-lines. Moreover, simply concatenating all lines in the source file (e.g.,tr -d "\n" < main.egg | egglog
) also does not work if the source file contains comments.This PR fixes this by only evaluating a multi-line block when all the parentheses are closed. So that the program
will only call
parse_and_run_program once
once at the end of the program