RCC (C-like Compiler, R for either remarkable or retarded)

1 minute read



Authors: Haoyang Shi, Tinghao Xie

This repository contains our course project for Compiler Principle at ZJU.

Differences with C

  • type system: char, int, double and n-dimensional array type; Pointers and struct type is not supported in this version.
  • no controled jumps, gotos and labels , i.e. break, continue and switch statements are not supported.
  • pre-compile MARCO not supported
  • scanf and printf are automaticly declared and linked with libc in runtime
  • calling convention of scanf modified. e.g. you shall use scanf("%d",i) to read the value into variable i and drop the & symbol.
  • for loop snippet is switched to pascal-like for(i: 0 to n){}, where i is only seen within the scope of this loop
  • unary operators not supported

try out the test samples to get a better understanding of the gramma.


  • flex 2.5+
  • bison 3.0+
  • clang 7.0+
  • llvm 7.0+

which is easily accessible via apt and other package managers.

It has been successfully tested with

  • flex 2.6.4 + bison 3.0.4 + llvm-12 on Ubuntu 18.04 (x86_64)
  • flex 2.5.35 + bison 3.7.6 + llvm-12 on MacOS (x86_64)


Clean the directory with:

make clean

Install with:


If you want to install with a specific version of bison, install with:


If you are installing RCC with LLVM12 on MacOS, install with:



./rcc src_file

The generated ELF object file and executable are named output.o and a.out respectively by default.