Skip to content

A Compiler for a C like Programming Language called MiniC. The front end of the compiler is written in C++ and ANTLR-4 is used for generating a LL parser. LLVM toolchain is used as the backend.

Notifications You must be signed in to change notification settings

swetanjal/MiniC-Compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MiniC-Compiler

Language Manual:

  • Refer to 20171077_MiniC_Manual.pdf.

Instructions to compile and run the code:

  • ./compile_and_run.sh <path to source code>
  • Eg: ./compile_and_run.sh testcases/1.mc

Implementation Details:

  • The Macro and Micro Syntax of the language is specified in MiniC.g4 file.
  • ANTLR-4 is used as the parser generator.
  • The code generation is done in LLVM IR and passed to LLVM Toolchain.
  • LLVM Toolchain handles the machine code generation and hence forms the backend of the compiler.
  • More details regarding the implementation to come!
  • Throughout the implementation, interesting compiler ideas like Basic Blocks, control flow graphs, abstract syntax trees are used which consolidates the understanding of the theory taught in the course.
  • Check out Bonus folder on details about how an LLVM pass can be written. It contains Analysis/Transformation pass for printing extended basic blocks in a program and a pass which implements Super-local value numbering.

About

A Compiler for a C like Programming Language called MiniC. The front end of the compiler is written in C++ and ANTLR-4 is used for generating a LL parser. LLVM toolchain is used as the backend.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published