Skip to content

sonidori98/bust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bust — B compiler for x86-64 Linux

bust is a compiler for B, the language that preceded C at Bell Labs. It targets x86-64 Linux and produces ELF binaries.

Usage

bust source.b -o output         # compile & link → executable
bust -S source.b -o output.s    # assembly only
bust -s 'printn(42);'           # one-liner

Options

Option Description
-o <file> Output file (default: a.out)
-S Emit assembly only, do not assemble/link
-s <code> Compile string instead of file
--libb-path <path> Path to liblibb.a

Install

cargo xtask install                      # → /usr/local/{bin,lib64}
cargo xtask install --prefix ~/.local    # → ~/.local/{bin,lib64}
cargo xtask uninstall                    # remove from /usr/local
cargo xtask uninstall --prefix ~/.local  # remove from ~/.local

liblibb.a is resolved at runtime in this order: --libb-pathLIBB_PATH env → well-known system paths → compile-time fallback.

Project structure

Path Description
bust/ Compiler: lexer, parser, codegen
libb/ Runtime: syscall wrappers, I/O, no libc
xtask/ Build & install automation

Example projects

Larger programs written in B using bust can be found here:

  • Bad Bapple — Bad Apple!! rendered as ASCII art in B.
  • bcube — Rotating ASCII cube in B.

Test

cargo xtask test

References

  • BCause — C implementation of the B language that inspired this project.
  • blang — Go/LLVM implementation of the B language that inspired this project.
  • Users' Reference to B by Ken Thompson (1972)

License

MIT

About

B-language compiler written in Rust

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors