This project demonstrates a basic implementation of several phases of a compiler: lexical analysis, syntax analysis, and translation from infix to postfix notation.
This project showcases a simplified version of a compiler that processes an input expression, validates its syntax, constructs a parse tree, and converts the expression from infix to postfix notation. The implementation covers:
- Lexical Analysis: Tokenizing the input.
- Syntax Analysis: Validating and parsing the expression into a parse tree.
- Infix to Postfix Conversion: Translating infix expressions to postfix notation.
- Clone the repository:
git clone https://github.com/yourusername/Phases-of-Compiler.git
cd Phases-of-Compiler
- Compile the code:
g++ -o compiler compiler.cpp lexical_analyzer.cpp syntax_analyzer.cpp
- Run the compiler:
./compiler
- Enter an expression when prompted.
- Clone the repository:
git clone https://github.com/yourusername/Phases-of-Compiler.git
cd Phases-of-Compiler
- Set up your development environment:
Ensure you have g++
installed. You can install it using:
-
For Debian-based systems:
sudo apt-get install g++
-
For Red Hat-based systems:
sudo yum install g++
- Compile the code:
g++ -o compiler compiler.cpp lexical_analyzer.cpp syntax_analyzer.cpp
- Run the compiler:
./compiler
- Make your changes and create a pull request.
- Fork the repository and clone it to your local machine.
- Create a new branch for your feature or bugfix.
- Make your changes and commit them with descriptive messages.
- Push your changes to your fork and create a pull request.
- Ensure your code follows the project's style guidelines.
- Include tests for any new functionality.
Feel free to contribute to this project. Happy coding!