BCause is a compiler for the B programming language, developed by Ken Thompson and Dennis Ritchie at Bell Labs in 1969, later getting replaced by C. BCause is written in C99 and relies on a minimal set of dependencies, namely libc and the GNU binutils.
This repository also includes a libb.a implementation, B's standard library. It requires zero dependencies, not even libc.
BCause is implemented as a small single-pass compiler in ~2500 lines of pure C99 code. Therefore, it features small compile times with a very low memory footprint.
- global variables
- functions
-
auto&extrnvariables - control flow statements
- expressions
-
libb.astandard library - optimization
- nicer error messages
Due to BCause's simplicity, only gnu-linux-x86_64-systems are supported.
- If your system can run GNU-
make, GNU-ldand GNU-as, BCause itself should be able to work. - Because of the reliance on system-calls
libb.ahas to be implemented for each system separately.
Note Feel free to submit pull requests to provide more OS support and fix bugs.
To install BCause, first clone this repository:
$ git clone https://github.com/spydr06/bcause.git
$ cd ./bcauseThen, build the project:
$ makeTo install BCause on your computer globally, use:
# make installWarning this requires root privileges and modifies system files
To compile a B source file (.b), use:
$ bcause <your file>To get help, type:
$ bcause --helpThe tests/ directory contains numerous compiler tests. Please update these tests when adding new features. Tests are based on googletest and require cmake to be run:
$ make testBCause is licensed under the MIT License. See LICENSE in this repository for further information.
-
Bell Labs User's Reference to B by Ken Thompson (Jan. 7, 1972)
-
Wikipedia entry: B (programming language)