Skip to content

msh31/c4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

[mirror] my own programming language that transpiles to C, written in C99

Resources

Stars

Watchers

Forks