The REPL (read, eval, print, loop) can be useful both for learning about langur and for development.
Build and run the REPL from langur/repl/main.go (not langur/main.go). Within this source file, you can determine what you want the REPL to return by editing the Go constants (which appear something like what are shown below).
const ( PROMPT = ">> " printLexTokens = false printParseTokenRepresentation = true printParseNodes = true printCompiledInstructions = true printCompiledConstants = true printVmResultEscaped = true printVmResultGoEscaped = false printVmResultRaw = false )
Minimal execution may be used to test early stages of development of a feature.
If you do not print the VM result, the VM will not be run.
So it goes for the compiler and parser. Each is only run if necessary.
exit() | cleanly exits the REPL |
list() | lists built-in functions with descriptions |
reset() | resets the environment for the REPL |