Giter Site home page Giter Site logo

sjsu-cmpe152-c-minus-compiler's Introduction

SJSU-CMPE152-C-Minus-Compiler

This is a final submission of the 152 Compiler project There are a few known issues with this code

  • The compiler can not handle nested while loops (but it is a easy fix, look how for loops are done and production rules with yacc)
  • It is a single pass compiler with no optimization so the asm is correct it is just not optimal
  • You can probably figure out a better way to store the symbol table then I did

To build the project run the following commands

yacc -d cminus.y
lex cminus.l
cc lex.yy.c y.tab.c asm.c symboltable.c
./a.out << 'your cminus file'

This code only works in a linux enviroment, and if you work only in x64 you will need multilib installed To generage the asm and exe run

nasm -f elf -g -F stabs output.asm -l output.lst
gcc –m32 output.o –o output

The exe thats generated will run, but its up to you to tell if its working, as our gramar does not have any console printing. Some other versions of this people had used printf in the x86 to debug, but I did not find it nessascary to do.

Happy Coding!

sjsu-cmpe152-c-minus-compiler's People

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.