Giter Club home page Giter Club logo

performant23 / compiler-design-nanoc Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 10.85 MB

Project files for building a compiler on a subset of C language (nanoC) completed as a part of the course '[CS-1319] Programming Language Design and Implementation' taught by Dr. Partha Pratim Das (PPD)

Makefile 0.78% C 74.86% Lex 2.30% nesC 0.94% Yacc 12.08% C++ 9.05%
assembly code-generation compiler intermediate-representation lexer optimization parser

compiler-design-nanoc's Introduction

Project Overview

This repository contains the project for building a compiler for a subset of the C programming language, referred to as nanoC. The project is divided into four main parts:

1. Lexer

Description:

The lexer component tokenizes input source code written in nanoC, recognizing various token categories such as keywords, identifiers, constants, punctuators, and more. It handles comments and reports any invalid tokens encountered during the tokenization process.

Detailed Documentation

2. Parser

Description:

The parser parses the token stream generated by the lexer according to the grammar rules defined in the Bison specification. It constructs a parse tree based on the syntax of the nanoC language, performing actions specified in the grammar rules.

Detailed Documentation

3. Machine Independent Code Generation

Description:

This component translates the parse tree or syntax tree obtained from parsing into intermediate code represented as quadruples. It manages a symbol table for variable and function management, handles type checking, and generates intermediate code for expressions, statements, and control flow constructs.

Detailed Documentation

4. Target Code Generation

Description:

The target code generator takes the intermediate code generated by the machine-independent code generation phase and translates it into assembly code for the x86-64 architecture. It supports various features such as arithmetic operations, control flow statements, function calls, and more.

Detailed Documentation


Limitations

  • The project may have limitations in handling certain language constructs or error conditions.
  • Error handling and input validation may be minimal.

compiler-design-nanoc's People

Contributors

performant23 avatar

Watchers

 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.