my own programming language that transpiles to C, written in C99
Find a file
Marco 7a3b8dfffb feat: implement if-statement parsing
a lot of tests because i suck at programming
2025-12-22 19:16:25 +01:00
src feat: implement if-statement parsing 2025-12-22 19:16:25 +01:00
tests feat: implement if-statement parsing 2025-12-22 19:16:25 +01:00
.gitignore improve: wrap cleanup calls in seperate function 2025-12-21 22:24:28 +01:00
Makefile feat(codegen): implement basic skeleton 2025-12-21 14:38:14 +01:00
README.md Update README.md 2025-12-22 03:35:48 +00:00

C4

A minimal programming language that transpiles to C. Hobby project for learning compiler design and is not intended to replace C.

Current Features

Working:

  • Integer variables with := assignment
  • Arithmetic operators: +, -, *, / with proper precedence
  • Comparison operators: <, >, ==, !=, <=, >=
  • Parentheses for grouping
  • print() statement
  • Full lexer → parser → code generator pipeline

Example:

x := 5 + 10;
y := x * 2;
result := y > 15;
print(result);

Generates valid C code, compiles, and runs.

What's Missing \

  • Control flow (if/else, while loops)
  • Functions
  • Types beyond integers
  • Strings

Build and run

make
./transpiler tests/comparisons.c4
./program