laurelkeys / uc-compiler

A compiler for the uC (micro C) programming language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

uc-compiler

A compiler for the μC programming language, developed during Unicamp's Compiler Design and Construction course (MC921).

  • project-1/: Lexer, Parser and Abstract Syntax Tree (AST)
  • project-2/: Semantic Analysis and Intermediate Representation (IR)
  • project-3/: Data Flow Analysis (DFA) and Optimizations
  • project-4/: LLVM Backend for JIT-Compilation

See the BNF grammar specification and the semantic rules of the language.

Usage

$ python src\uC.py -h
usage: uC.py [-h] [-s] [-a] [-i] [-o] [-l]
             [-p {ctm,dce,cfg,all}] [-n] [-c] [-d]
             filename

uC (micro C) language compiler

positional arguments:
  filename              path to a .uc file to compile

optional arguments:
  -h, --help            show this help message and exit
  -s, --susy            run in the susy machine
  -a, --ast             dump the AST to <filename>.ast
  -i, --ir              dump the uCIR to <filename>.ir
  -o, --opt             optimize the uCIR and dump it to <filename>.opt
  -l, --llvm            generate LLVM IR code and dump it to <filename>.ll
  -p {ctm,dce,cfg,all}, --llvm-opt {ctm,dce,cfg,all}
                        specify which LLVM pass optimizations to enable
  -n, --no-run          do not execute the program
  -c, --cfg             show the CFG for each function in png format
  -d, --debug           print debug information

About

A compiler for the uC (micro C) programming language

License:MIT License


Languages

Language:Python 93.4%Language:UnrealScript 6.6%