A work-in-progress compiler for a small custom language, written in C and targeting MIPS assembly.
bik tokenizes source code, parses it into an abstract syntax tree, evaluates constant expressions, and generates MIPS assembly. I built it as a hands-on exploration of the compiler pipeline, including lexing, precedence parsing, environments, constant folding, and code generation.
The compiler is still under development, and MIPS generation is not yet complete.
- Custom lexer with identifiers, numeric and string literals, keywords, operators, and single-line comments
- AST-based parser with operator precedence and parenthesized expressions
- Integer, decimal, and string values
- Variable assignments and identifier lookup
- Arithmetic operations with compile-time constant folding
- String concatenation with automatic number conversion
log()statements- Early support for functions, typed parameters, calls, and return statements
- Basic MIPS
.dataand.textgeneration
- C
- CMake
- MIPS assembly
Make sure a C compiler and CMake are installed, then clone and build the project:
git clone https://github.com/Bi1ku/bik.git
cd bik
cmake -S . -B build-local
cmake --build build-localThe current entry point compiles tests/test1.bik. Edit that file to experiment with the language:
value = 7 - 8 / 2 * 5.5;
message = "hello, world!";
log(value);
log(message);
Run the compiler from the build directory:
cd build-local
./executeThe compiler prints the generated tokens and writes the resulting assembly to build-local/output.asm.
Passing a source file through the command line is not yet supported.
Licensed under the MIT License.