Backends¶
BearVM supports four execution modes. All of them take the same .bear
source file as input.
Interpreter¶
The default mode. No external dependencies required:
bear <file.bear>
The interpreter surpasses Lua in terms of performance for general workloads.
QBE¶
Emits QBE IR:
bear qbe <file.bear>
Compiles to a native binary via QBE and cc:
bear qbe <file.bear> -c
Requires QBE to be installed and available on PATH. The -c flag
additionally requires a C compiler (cc).
LLVM¶
Emits LLVM IR:
bear llvm <file.bear>
Compiles to a native binary via llc and cc:
bear llvm <file.bear> -c
Requires LLVM to be installed and llc to be available on PATH. The
-c flag additionally requires a C compiler (cc).
JIT¶
Compiles and runs directly using an experimental aarch64 code generator:
bear jit <file.bear>
This backend is only available on Apple Silicon (aarch64 macOS). It will not function on other platforms or architectures. There are no current plans to extend JIT support to additional targets.
Installing QBE¶
QBE is available at https://c9x.me/compile/. On macOS it can be installed via Homebrew:
brew install qbe
On Linux, build from source or check your distribution’s package manager.
Installing LLVM¶
LLVM packages are available at https://llvm.org/. On macOS:
brew install llvm
On Linux, most distributions ship LLVM packages. Ensure llc is on your
PATH after installation.