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
,continue
andreturn
) 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 e
exceptions and evaluates the expressione
while
andfor
loops catchbreak
andcontinue
exceptionsbreak
will exit the loopcontinue
will skip all subsequent statements within the loop and start to evaluate the condition of the next loop