Blang is a compiler for the B programming language, developed by Ken Thompson and Dennis Ritchie at Bell Labs in 1970, later getting replaced by C. Blang 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.
Blang is implemented as a small single-pass compiler in ~2000 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 Blang's simplicity, only gnu-linux-x86_64-systems are supported.
- If your system can run GNU-
make, GNU-ldand GNU-as, Blang 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 Blang, first clone this repository:
$ git clone https://github.com/nikhilesh-927/Blang
$ cd ./BlangTo install Blang on your computer globally, use:
$ sudo apt make installWarning this requires root privileges and modifies system files
To compile a B source file (.b), use:
$ blang file1.b (your file in b language) -o outputTo see the output on your console:
$ ./outputTo get help, type:
$ blang --helpBlang 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)