Cbc
C B Compiler, a working B compiler that is fully compliant with B, with nice warnings and errors, configurable via standard flags like -W/-Wno, and -F and -Fno to turn on/off warns/features. -std=B/-std=Bx for some extensions. Compatible with tsoding/b
Install / Use
/learn @xplshn/CbcREADME
GBC - Go B Compiler - https://github.com/xplshn/gbc
A much more capable and self-contained B compiler, written using modernc.org/libqbe
(cbc) | The C B Compiler
This compiler is a project aiming to make a valid B compiler, with optional extensions for C interoperability, and a modules system like Go's
]~/Documents/TrulyMine/cbc@ ./cbc
Copyright (c) 2025: xplshn and contributors
For more details refer to <https://github.com/xplshn/cbc>
Synopsis
./cbc [options] <input.b> ...
Description
A compiler for the B programming language and its extensions.
Options
-o <file> Place the output into <file>.
-h, --help Display this information.
-std=<std> Specify language standard (B, Bx). Default: Bx
-pedantic Issue all warnings demanded by the current B std.
Warning Flags
-Wall Enable most warnings.
-Wno-all Disable all warnings.
-W<warning> Enable a specific warning.
-Wno-<warning> Disable a specific warning.
Available warnings:
c-escapes Using C-style '\' escapes instead of B's '*' [x]
b-escapes Using historical B-style '*' escapes instead of C's '\' [x]
b-ops Using historical B assignment operators like '=+' [x]
c-ops Using C-style assignment operators like '+=' in -std=B mode [x]
unrecognized-escape Using unrecognized escape sequences [x]
truncated-char Character escape value is too large for a byte and has been truncated [x]
long-char-const Multi-character constant is too long for a word [x]
c-comments Using non-standard C-style '//' comments [-]
overflow Integer constant is out of range for its type [x]
pedantic Issues that violate the current strict -std= [-]
unreachable-code Unreachable code [x]
extra Extra warnings (e.g., poor choices, unrecognized flags) [x]
Feature Flags
-F<feature> Enable a specific feature.
-Fno-<feature> Disable a specific feature.
Available features:
extrn Allow the 'extrn' keyword [x]
asm Allow the '__asm__' keyword and blocks [x]
b-escapes Recognize B-style '*' character escapes [x]
c-escapes Recognize C-style '\' character escapes [x]
b-compound-assign Recognize B-style assignment operators like '=+' [x]
]~/Documents/TrulyMine/cbc@
The project is currently in its infancy, and the long-term goals are very ambitious. This is the current roadmap:
ROADMAP
(i) Tests
- ~~Make a script that takes the tests from tsoding/b, and filters the tests.json to only include the IR tests~~
- Make a Go program that runs each test, displays the passing/failing ones
(ii) Compatibility with tsoding/b
- ~~Support the "extrn" keyword, as well as inline assembly~~
- ~~Use the same warning & error messages tsoding/b~~ / our warnings n errors are much better
- ~~Be able to pass the IR tests of tsoding/b~~
(iii) Packages / Modules inspired by Go
- ¿.. Namespaces based on .mod file ..?
- Implement a way to import/export symbols from different .B files, in different namespaces
Contributions are hyper-mega welcome
References
- https://research.swtch.com/b-lang
- https://www.nokia.com/bell-labs/about/dennis-m-ritchie/kbman.html
- https://www.nokia.com/bell-labs/about/dennis-m-ritchie/bref.html
- https://www.nokia.com/bell-labs/about/dennis-m-ritchie/btut.html
- https://github.com/Spydr06/BCause
- https://github.com/kparc/bcc
Not B-related, but I did find these helpful for learning how to write the compiler:
- comp-bib: "Resources for Amateur Compiler Writers"
- qcc: dead-simple C compiler
- cproc: QBE-backed compiler written in C99, with support for some C23 & GNU C extensions
Cool stuff used by this project:
- QBE: The QBE compiler backend
TODO: ...I should write a Limbo compiler when I finish this project...
Related Skills
diffs
344.1kUse the diffs tool to produce real, shareable diffs (viewer URL, file artifact, or both) instead of manual edit summaries.
clearshot
Structured screenshot analysis for UI implementation and critique. Analyzes every UI screenshot with a 5×5 spatial grid, full element inventory, and design system extraction — facts and taste together, every time. Escalates to full implementation blueprint when building. Trigger on any digital interface image file (png, jpg, gif, webp — websites, apps, dashboards, mockups, wireframes) or commands like 'analyse this screenshot,' 'rebuild this,' 'match this design,' 'clone this.' Skip for non-UI images (photos, memes, charts) unless the user explicitly wants to build a UI from them. Does NOT trigger on HTML source code, CSS, SVGs, or any code pasted as text.
openpencil
2.0kThe world's first open-source AI-native vector design tool and the first to feature concurrent Agent Teams. Design-as-Code. Turn prompts into UI directly on the live canvas. A modern alternative to Pencil.
HappyColorBlend
HappyColorBlendVibe Project Guidelines Project Overview HappyColorBlendVibe is a Figma plugin for color palette generation with advanced tint/shade blending capabilities. It allows designers to
