bcomp-0.1.0 is not a library.
bcomp
bcomp is a small BASIC compiler written in Rust. It lexes and parses
a subset of pretty BASIC-like syntax, and then uses cranelift to lower it into real assembly.
Current Status
Heres what actually work right now if you ran this program:
- BASIC Expressions, which include: identifiers, numbers, strings, chars, separators, arithmetic operators, and comparison operators
- Statement lists (each line is a statement),
print,return,end, andrem - Cranelift object emission for
main(each file is loaded as a seperate main) printuses libc calls for strings, chars, and numeric expressions- Tiny program CLI that uses
clap
Not implemented yet:
- Variables and assignment lowering
- Control-flow expressions and keywords like
if,goto,for,next, andgosub - Floats in any way shape or form
- Multifile linkage (likely never supported)
Requirements
- Rust 2024
Build
or
Usage
Compile a .bsc source file to an object file:
By default, bcomp writes the object next to the input with an .o extension.
Use -o to choose an output path:
The generated object currently expects libc symbols such as printf, so link it
with your platform C compiler:
Example
Input:
print "HELLO WORLD";
Compile:
Development
Run the test suite:
Run lint checks:
The crate currently denies warnings and Clippy's all and pedantic groups, so
small changes may still need a formatting or lint pass before they compile
cleanly.
References
License
MIT. See LICENSE.