BC evaluator implemented in OCAML
dune runtest
- scopes are created per function call
- arguments and variable are assigned within their scope
- arguments and variables are accessed by recursively checking each scope defined in the entire programs environment starting with the local scope
- recursive functions
- special statements (
break,continueandreturn) throw an exception when evaluated - these exceptions are caught when evaluating statements nested within other, certain statements (
for,while...) and are meant to halt execution of code in some manner within the statement but preserve the state of the environment. - function calls catch
return eexceptions and evaluates the expressione whileandforloops catchbreakandcontinueexceptionsbreakwill exit the loopcontinuewill skip all subsequent statements within the loop and start to evaluate the condition of the next loop