kuan-li / kobayashi-compiler

An optimizing compiler of SysY (a subset of C)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kobayashi Compiler

An optimizing compiler of SysY, a subset of C. Supported targets are armv7 and risc-v32. (To be accurate, armv7ve and rv32im.)

SysY is the language used by the Collegiate Student System Capability Challenge (Compiler Track) 2021, an compiler contest in China. (contest homepage)

For SysY specification (in Chinese), runtime, and testcases, see here.

README in Chinese

Usage

  1. Build
mkdir build
cd build
cmake ..
make -j$(nproc)
  1. Run
./compiler <source_code>.sy -o <output_asm>.s

Additional Arguments

Use --set-<key>=<value> to specify key-value pairs. Here are the available options:

key value default hint
arch armv7, rv32 armv7
num-thread positive integer 4 The number of threads in auto parallelization when --enable-loop-parallel is specified.

Other flags:

flag hint
--enable-loop-parallel Enable automatic parallelization. Currently it's not available for rv32.
--exec Simulate the execution of IR instead of generating assembly code.
--debug, --info, --warning, --error Different levels of logging. default to warning level.

Also, remember to link the output with the runtime under runtime/.

Slides

slides/intro.pdf
slides/pre.pdf

About Us

Kobayashi is a name from the anime Miss Kobayashi's Dragon Maid, and our team name in the contest is Miss Kobayashi's Compiler.

About

An optimizing compiler of SysY (a subset of C)

License:GNU General Public License v3.0


Languages

Language:C++ 98.3%Language:ANTLR 0.5%Language:Python 0.5%Language:C 0.4%Language:Assembly 0.3%Language:CMake 0.1%Language:Shell 0.0%