knockcat / Compiler-Design

I will keep my Lex Programs and Learnings Here.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiler Design

This repository contains a collection of programs related to Compiler Design.

Table of Contents

Installation

Cloning the Repository To clone this repository, follow the steps below:

  1. Open your terminal or command prompt on your computer.
  2. Navigate to the directory where you want to clone the repository.
  3. Type the following command:
   https://github.com/knockcat/Compiler-Design.git
  1. Press enter to execute the command.
  2. Wait for the cloning process to finish.
  3. Once the cloning process is complete, navigate to the cloned repository using the following command:
   cd Compiler-Design  
  1. You can now explore the repository and use it as needed.

Usage

This repository contains the following programs:

To Run them use following commands every execution is attached in output in above folders you can also refer there...

  flex program.l
  gcc lex.yy.c
  ./a.out
  1. Program 01 - Lex code for counting number of lines, spaces, tabs and rest of characters.
  2. Program 02 - Design a LEX Code to identify and print valid Identifier of C,C++, in given Input pattern.
  3. Program 03 - Design a LEX Code to identify and print integer and float value in given Input pattern.
  4. Program 04 - Lex code for tokenizing C-code.
  5. Program 05 - Design a LEX Code to count the number of total characters, words, white spaces in given input.txt file.
  6. Program 06 - Lex code for replacing multiple whitespaces by single space.
  7. Program 07 - Lex code for removing C-comment from C-program.
  8. Program 08 - Design a LEX Code to extract all html tags in the given HTML file at run time and store into text file given at run time.
  9. Program 09 Implementation of DFA accepting even number of a and b over input {a, b} with dead state.
  10. Program 10 Design a DFA in LEX Code which accepts string containing third last element 'a' over input alphabet {a,b}.
  11. Program 11 Design a DFA in LEX Code to Identify and print Integer & Float Constants and Identifier.
  12. Program 12 Yacc-Lex code for +, -, * and div of integers with precedence specification explicitly.
  13. Program 13 Yacc-Lex code for +, -, * and div of integers with precedence specified within CFG.
  14. Program 14 Yacc-Lex code for converting infix expression to postfix expression.
  15. Program 15 Yacc-Lex code for Desk calculator.

Contributions

We welcome contributions from the community. If you find a bug, have a feature request or want to contribute code, please follow the steps below:

  1. Fork the repository
  2. Create a new branch
  3. Make your changes and commit them
  4. Push the changes to your forked repository
  5. Create a pull request

Please ensure your pull request adheres to the following guidelines:

  • Keep the code style consistent with the project's style
  • Write tests for any new features or modifications
  • Ensure the tests pass before submitting the pull request

License

This project is licensed under the Apache License 2.0. For more information, please refer to the LICENSE file.

Author

This project was created by Vishal Joshi. You can connect with me on LinkedIn and follow me here.

About

I will keep my Lex Programs and Learnings Here.

License:Apache License 2.0


Languages

Language:Lex 66.1%Language:Yacc 19.9%Language:C 9.9%Language:HTML 4.1%