Coder Social home page Coder Social logo

ahad1317 / compilerdesign--18csc304j Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 19 KB

Compiler Design experiments including c, flex, bison, scanner, java and other codes

Lex 14.83% C 26.15% Yacc 2.10% C++ 34.46% Java 22.46%
bison flex lex lexical-analyzer yacc calculator clr first-and-follow java lalr leading-and-trailing left-factoring left-recursion mips nfa-to-dfa-conversion predictive-parser scanner shift-reduce-parsers slr

compilerdesign--18csc304j's Introduction

๐Ÿš€ Running Flex Programs

Flex is a powerful tool for generating scanners: programs that recognize lexical patterns in text. Use this guide to quickly start running Flex programs on Windows.

๐Ÿ“ฅ Download Flex Tool

First, you need to download the Flex tool for Windows:

๐Ÿ› ๏ธ Setup and Usage

Follow these steps to set up and run your Flex programs:

Step 1: Open Flex Tool

Once downloaded, open the Flex tool.

Step 2: Create a New File

Create a new file by selecting the "lex" option.

Create File

Step 3: Enter Your Lex Code

Paste your Lex code into the new file and save it with the .l extension. Ensure you select "All Files" as the file type.

Save File

Step 4: Compile and Build

Now, proceed with the following:

  1. Click on 1 (Lex File Compile)
  2. Click on 2 (Lex Build)
  3. Click on 6 (Open CMD)

Compile and Build

Step 5: Run Your Program

When the command prompt opens, type in the file name you saved with the .exe extension and enter your input to view the result.

Run Program


๐Ÿš€ Running Scanner Programs

Save the file "name: file2.star.txt" you want to scan example:

image

Now save the lex code in same folder as the scanner file, make sure the file name is same :

image

Follow above step 4 and step 5 to build and compile: output:

image


๐Ÿš€ Running Bison Programs

Create and compile lex file by clicking 1 (lex file compile) :

image

Create a new bison file with ".y" as extension

image

after entering bison code, click 3 (yacc compile) :

image

open cmd by clicking 6 (open cmd) and type in following commands :

image

Enter your query and it will display the output.

๐ŸŒŸ Conclusion

That's it! You are now ready to run and test your own Flex programs on Windows. Enjoy coding your scanner projects!


Feel free to reach out or contribute to this repository if you have any suggestions or improvements!

compilerdesign--18csc304j's People

Contributors

ahad1317 avatar

Stargazers

 avatar  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.