/Compiler-Design-Lab

This repository showcases a comprehensive exploration of compiler construction, encompassing lexical analysis, syntax analysis, three-address code generation, and the implementation of a stack machine to execute code. The project harnesses the power of ANTLR4 and BISON parser generators to achieve these milestones.

Primary LanguageC

Compiler Design Lab

Overview

Welcome to the Compiler Design Lab repository! This repository contains the source code and documentation for a comprehensive exploration of compiler design concepts. From Lexical Analysis to Three Address Code we've got you covered.

Features

  • Lexical Analysis: Implementation of lexical analysis to tokenize source code.
  • Syntax Analysis: Building parsers to validate the syntax of programming languages.
  • Three-Address Code: Generation of intermediate code for efficient code representation.
  • ANTLR4: Utilization of ANTLR4 parser generator for parsing tasks.
  • BISON: Integration of BISON parser generator for syntax analysis.

Getting Started

Prerequisites

Before you begin, make sure you have the following tools installed on your system:

  • ANTLR4: ANTLR (ANother Tool for Language Recognition) is a powerful parser generator. To install it, follow these steps:

    • Linux/Unix:

      sudo apt-get install antlr4
    • macOS:

      brew install antlr
    • Windows:

      You can download the ANTLR4 JAR files from the official ANTLR website (https://www.antlr.org/download.html).

  • BISON: Bison is a parser generator that is essential for syntax analysis. To install it, follow these steps:

Installation

  1. Clone the Repository:

        git clone https://github.com/your-username/Compiler-Design-Lab.git
    
  2. Explore the Code: Dive into the source code to understand the implementations and algorithms used for each compiler component.

  3. Build and Run: Follow the provided instructions in each subdirectory to build and run different parts of the compiler.

Contributing

If you'd like to contribute to this project, feel free to submit issues, open pull requests, or suggest improvements. Your contributions are highly appreciated!

Documentation

For in-depth explanations, examples, and usage instructions, please refer to the documentation within each subdirectory of this repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

We would like to acknowledge the valuable contributions of the open-source community and the creators of ANTLR4 and BISON, which have been instrumental in the development of this project.