Git Product home page Git Product logo

scc's Introduction

Simple C Compiler


About

The Simple C Compiler project started as my final project for my Introduction to Programming Languages class at IUPUI (CSCI-35500). However, the program for the class just implemented the C parser; it didn't implement the compiler which actually does semantic analysis on the code. I'm currently working on finishing the rest of the program so I actually have a working C compiler, not just a fancy C parser.


Features to Still Implement

Parsing:

  • Parse structs and unions
  • Parse enumerations
  • Parse initializer lists
  • Parse typedef statements
  • Complex and imaginary types (maybe?)

Compiling:

  • Compile-time expression evaluation
  • Runtime expression evaluation
  • Local variables and scope resolution
  • Integer promotion and type casting
  • Function calls and stack frame
  • Return values
  • Goto statements and labels
  • If statements
  • While, do/while, and for loops
  • Switch/case statements
  • Const variables
  • Bit fields (maybe?)

These features are not listed in any particular order, and the list is not exhaustive.


Compiling

The provided makefile should handle all of the compiling and linking of objects. However, you will need to install the Flex Lexer and the Bison Parser, as SCC uses Flex and Bison to generate the parser. For Debian Linux distributions, this is as simple as:

sudo apt-get install flex
sudo apt-get install bison

Once Flex and Bison are installed, simply type:

make

from the source directory, and everything should compile and link. To rebuild the project from scratch, type:

make clean
make

Running

Usage:

./scc.out <c-file>

Right now, calling the parser with a C file will parse the file and print out the abstract syntax tree to standard output. If there is an error parsing the C file (like invalid syntax), it will display a "syntax error!" message.

scc's People

Contributors

comprosoftceo avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.