compile method

void compile()

Compile our source code, if we haven't already done so, so that we are either ready to run, or generate compiler errors (reported via errorOutput).

Implementation

void compile() {
  if (vm != null) return; // already compiled

  parser ??= Parser();
  try {
    parser!.parse(source ?? "");
    vm = parser!.createVM(standardOutput);
    vm!.interpreter = WeakReference(this);
  } on MiniscriptException catch (e) {
    reportError(e);
    if (vm == null) parser = null;
  }
}