A simple C-style programming language compiler written in C++ with yacc and bison using custom assembly code and virtual machine.
This project is for educational purposes only and is not intended for production use.
In a word, this is a coursework of twlm🐱.
- C-style syntax
- Statically-typed language
- Basic data types:
int,char - Composite data types: pointers, arrays, structures
- Control flow statements:
if,else,while,for,switch... - Global and local TAC optimization
- Custom assembly language and virtual machine
Tested on Ubuntu 24.04 LTS WSL2.
- build-essential
- meson
- yacc & bison
- Build the ccpl project using Meson and Ninja:
or you can run vscode commands declared in
cd ccpl meson setup build ninja -C build.vscode/tasks.json. - Build the assembler and virtual machine:
cd asm-machine make - Compile and run a ccpl source file:
or test an example in
./ccpl/build/ccpl path/to/source.m output.s; ./asm-machine/build/asm output.s; ./asm-machine/build/machine output.o
ccpl/test/:wheremake test=xxx
xxxis the name of the test file without extension.
Please refer to the_ccpl_language.md for detailed documentation of the ccpl language.
Please refer to the_ccpl_architecture.md for detailed documentation of the ccpl compiler architecture.
Or you can refer to Deepwiki for more detailed explanations and design decisions.
This project is licensed under the MIT License. See the LICENSE file for details.