Skip to content

Compiler for Cool language. written using PGen, Antlr, and Java

Notifications You must be signed in to change notification settings

mehditeymorian/Cool-Compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cool Compiler (CC)

I wrote this project for Compiler course at Shahid Beheshti University Summer 2021. Java, PGen, ANTLR are the tools that I've leveraged to do this project. list of features is at the end of this document; It shows the current features of the compiler, and the features that need to be done. The syntax is fairly simple. here's a sample:

Syntax

How to Compiler

In Releases section, you can find the latest exe, jar, and probably bash scripts to compile.

Feature List

  • Binary Expression
  • Unary Expression
  • Comparators
  • Bool, Int, Real, Array data types.
  • If else conditional statement
  • For while loops
  • Single class
  • Main function
  • Id assignment
  • Array assignment
  • Output int and string
  • Input int
  • len function array
  • pre -- ++
  • post -- ++
  • break, continue
  • len function string
  • dynamic strings
  • print function for all data types
  • input function for all data types
  • function in the class no args no return
  • function in the class no args with return
  • function in the class with args
  • multiple class
  • class ref assignment
  • class function