Online playground for BMB (Bare-Metal-Banter) programming language.
- Monaco Editor: Full-featured code editor with BMB syntax highlighting
- Real-time Execution: Run BMB code directly in the browser
- Contract Verification: Visual feedback for pre/post conditions
- Example Gallery: 10+ curated examples across multiple categories
- URL Sharing: Share code snippets via compressed URL links
- Keyboard Shortcuts: Efficient workflow with keyboard controls
- Responsive Design: Works on desktop and mobile devices
- Node.js 18+
- npm or pnpm
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run previewplayground/
├── public/ # Static assets
├── src/
│ ├── components/ # React components
│ │ ├── Editor.tsx # Monaco editor wrapper
│ │ ├── Header.tsx # App header with controls
│ │ ├── Output.tsx # Output panel
│ │ └── ExampleGallery.tsx # Example browser modal
│ ├── monaco/ # Monaco configuration
│ │ └── bmb-language.ts # BMB language definition
│ ├── utils/ # Utility functions
│ │ └── sharing.ts # URL sharing with compression
│ ├── App.tsx # Main app component
│ ├── compiler.ts # BMB interpreter
│ ├── main.tsx # Entry point
│ └── index.css # Styles
├── index.html
├── package.json
├── tsconfig.json
└── vite.config.ts
- Write BMB code in the editor
- Press
Ctrl+Enteror click "Run" - View output in the right panel
- Click "Examples" to browse available examples
- Filter by category (Basics, Algorithms, Math, etc.)
- Click an example to load it into the editor
- Click "Share" or press
Ctrl+Sto copy a shareable link - The link contains your code compressed in the URL hash
- Anyone with the link can view and run your code
| Shortcut | Action |
|---|---|
Ctrl+Enter |
Run code |
Ctrl+S |
Share (copy link) |
Escape |
Close modals |
| Category | Examples |
|---|---|
| Basics | Hello World, Factorial |
| Algorithms | Fibonacci, GCD, Binary Search |
| Math | Prime Check, Power |
| Contracts | Safe Division, Range Validator |
| Real World | Leap Year Calculator |
The playground includes a JavaScript-based BMB interpreter that supports:
- Function definitions with contracts (pre/post)
- Recursive function calls
- If-then-else expressions
- Let bindings and block expressions
- Arithmetic and comparison operators
- Boolean operators (and, or, not)
- Built-in
printlnfunction
Future versions will use a WASM-compiled BMB runtime.
- Custom BMB language definition with syntax highlighting
- Contract keywords (
pre,post) highlighted distinctly - Memory keywords (
own,ref,mut) styled differently - Custom dark theme optimized for BMB code
Uses LZ-String compression to encode code into URL hash:
- Efficient compression for sharing
- No server required for link generation
- Code persists in browser history
- Monaco editor with BMB syntax
- JavaScript-based interpreter
- URL sharing with compression
- Example gallery
- Keyboard shortcuts
- WASM-based BMB compiler
- Full contract verification visualization
- Multiple file support
- Standard library documentation
- BMB Compiler - Main compiler repository
- BMB Samples - Example programs
- VS Code Extension - VS Code support
MIT