Code Monkey home page Code Monkey logo

decaf-compiler's Introduction

Decaf-Compiler

Description

Compiler for Decaf Programming Language. Developed as a course project for Compilers course. Decaf is a strongly-typed, object-oriented language with support for inheritance and encapsulation. By design, it has many similarities with C/C++/Java, so you should find it fairly easy to pick up. But it is not an exact match to any of those languages. The feature set has been trimmed down and simplified to keep the programming projects manageable

Repo structure

  • src contains all the code written in C++, flex and bison and CMake files
  • docs contain code documentation
  • sample_inputs contain some sample Decaf programs to test the compiler

Building

mkdir build
cd build/
cmake ..
make 

This will create an executable named decafCompiler in build/bin directory

Running the executable

decafCompiler <input_file> > <output_file>
lli <output_file>

PS: If you like the code and you are using it, please have the courtesy to star the repo

decaf-compiler's People

Contributors

harry-7 avatar hkveeranki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

decaf-compiler's Issues

for loop

For loop doesnt run from 0 to a variable (it throws an error and no IR is generated). However doing variable - 0 works.
errorscreenshot

Explore approach to output byte code

Currently compiler outputs intermediate representation in LLVM IR. Explore the approach to output byte code or executable like other compilers

multiple arguments for a function

unable to send multiple arguments to a function.
eg: running the input_gcd code present in the sample_input directory gives the following error :
errorscreenshot

Also, no IR is generated

Better testing

  • Add more test cases
  • Add a command in cmake for testing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.