How to Compile Run LEX YACC Programs on Windows

 

How to Compile & Run LEX / YACC Programs on Windows 8, 10, and 11?

In this article, we will understand how to Compile & Run LEX / YACC Programs on Windows 8, 10, and 11?

To compile and run LEX/YACC programs in the Windows environment, we need to download and install the Flex 2.5.4a, Bison 2.4.1 and DevC++ software.

Video Tutorial

First download the following Software:

Download Flex 2.5.4a: http://gnuwin32.sourceforge.net/packages/flex.htm

Download Bison 2.4.1: http://gnuwin32.sourceforge.net/packages/bison.htm

Download DevC++: https://www.bloodshed.net/

Installing the Software and setting up the environment variable (path):

Install Flex at “C:\GnuWin32”

Install Bison at “C:\GnuWin32”

Install DevC++ at “C:\Dev-Cpp”

Open Environment Variables.

How to Compile Run LEX YACC Programs on Windows
System Information

Next CLick on advanced system settings

How to Compile Run LEX YACC Programs on Windows 1
System Properties

Next, click on Environment Variable and set the path variable.

Add “C:\GnuWin32\bin; C:\Dev-Cpp\TDM-GCC-64\bin” to path.

Now, you are set to compile and execute LEX/YACC programs in the Windows environment.

Compiling and Running LEX Programs:

Use the following commands to compile and run the LEX program in the Windows environment.

(Note: hello.l is the LEX program)

flex hello.l

gcc lex.yy.c y.tab.c

a.exe

Or use the following steps

flex hello.l

gcc lex.yy.c y.tab.c -o out.exe

out.exe

Compiling and Running YACC Programs:

Use the following commands to compile and run the YACC program in the Windows environment.

(Note: hello.l is the LEX and hello.y is the program)

flex hello.l

bison -dy hello.y

gcc lex.yy.c y.tab.c

a.exe

Or use the following steps

flex hello.l

bison -dy hello.y

gcc lex.yy.c y.tab.c – out.exe

out.exe

Summary:

This article discusses, How to Run LEX / YACC Programs on Windows 8, 10, and 11? If you like the article, do share it with your friends.

Leave a Comment

Your email address will not be published. Required fields are marked *

Welcome to VTUPulse.com


Computer Graphics and Image Processing Mini Projects -> Click Here

Download Final Year Project -> Click Here

This will close in 12 seconds