Skip to content

Checking and running

Before you build a native binary you usually check the code, and often run it on the reference interpreter. beansc also exposes each compiler stage so you can see what it produced.

Type-checks one file without building anything.

Terminal window
beansc check app.b
  • On success it prints <file>: ok.
  • On failure it prints errors as file:line:col: error: ... and exits 1.

check accepts --target, --cpu, --features, and --runtime, so you can check that code is valid for a specific target and runtime profile without building. A capability a runtime profile lacks is refused here, at check time, by name. See targets.

Checks the file and then runs it on the reference interpreter. No native build happens.

Terminal window
beansc run app.b

Forward arguments to your program after --:

Terminal window
beansc run app.b -- --verbose input.txt

If the program panics on the interpreter, run exits 3. See Exit codes and troubleshooting.

These commands dump one stage of the compiler. They are for understanding and debugging, not for a normal workflow.

CommandWhat it prints
beansc lex <file.b>...The token stream.
beansc parse <file.b>...The parsed AST.
beansc mir <file.b>The checked, ownership-planned MIR.
beansc llvm <file.b>The LLVM IR that native builds use.
Terminal window
beansc parse app.b
beansc mir app.b
beansc llvm app.b

lex and parse take one or more files. mir and llvm take one file.