Visual Studio Code extension for BMB (Bare-Metal-Banter) programming language.
- Syntax Highlighting: Full syntax highlighting for BMB source files
- Error Diagnostics: Real-time error detection via LSP
- Auto-completion: Smart code completion
- Go to Definition: Navigate to symbol definitions
- Find References: Find all references to a symbol
- Formatting: Code formatting on save
- Contract Verification: Trigger SMT-based contract verification
- Code Snippets: 20+ snippets for common patterns
- BMB Compiler installed and in your PATH
- VS Code 1.85.0 or later
Search for "BMB Language" in the VS Code Extensions panel.
- Download the
.vsixfile from the releases - In VS Code:
Extensions→...→Install from VSIX...
cd vscode-bmb
npm install
npm run compile
# Press F5 in VS Code to launch Extension Development Host| Setting | Default | Description |
|---|---|---|
bmb.serverPath |
"bmb" |
Path to the BMB compiler executable |
bmb.trace.server |
"off" |
Trace communication with language server |
bmb.enableVerification |
true |
Enable contract verification on save |
bmb.formatOnSave |
true |
Format BMB files on save |
| Command | Description |
|---|---|
BMB: Restart Language Server |
Restart the BMB language server |
BMB: Verify Contracts |
Run SMT verification on the current file |
BMB: Show AST |
Display the AST of the current file |
| Prefix | Description |
|---|---|
fn |
Simple function |
fnc |
Function with contracts |
fnb |
Function with block body |
pre |
Precondition |
post |
Postcondition |
let |
Let binding |
if |
If-then-else expression |
struct |
Struct definition |
enum |
Enum definition |
type |
Type alias |
typer |
Refinement type |
forall |
Universal quantifier |
exists |
Existential quantifier |
match |
Pattern matching |
@trust |
Trusted function |
@check |
Function with runtime check |
@test |
Test function |
@bench |
Benchmark function |
tailrec |
Tail-recursive pattern |
main |
Main entry point |
- Definition:
fn,let,mut,struct,enum,type,mod,use,pub - Control Flow:
if,then,else,match,while,for,in,return - Contracts:
pre,post,invariant,where,modifies,decreases - Memory:
own,ref,move,copy,drop,linear - Operators:
and,or,not,forall,exists
- Primitives:
i8,i16,i32,i64,i128,u8,u16,u32,u64,u128,f32,f64,bool,char,String - References:
&T,&mut T - Arrays:
[T; N] - Unit:
()
ret- Return value in postconditionsit- Self-reference in refinement typesold- Previous value in postconditions
// Function with contracts
fn factorial(n: i64) -> i64
pre n >= 0
post ret >= 1
= if n <= 1 then 1 else n * factorial(n - 1);
// Struct definition
struct Point {
x: f64,
y: f64,
}
// Enum with variants
enum Option<T> {
Some(T),
None,
}
npm install
npm run compilenpm testnpm run package- BMB Compiler - Main compiler repository
- BMB Playground - Try BMB online
MIT