If you are installing Ubuntu (or any Linux based OS) on your system either through Virtual Box or by making your system Multi-Bootable, just to execute your Lex & Yacc programs; then you might be wasting your HDD space & your valuable time. You can easily skip this annoying process and run your programs in Windows OS without any hassles.
Here's how you can do it:
Installing Softwares:
Here's how you can do it:
Installing Softwares:
- Download Flex 2.5.4a
- Download Bison 2.4.1
- Download DevC++
- Install Flex at "C:\GnuWin32"
- Install Bison at "C:\GnuWin32"
- Install DevC++ at "C:\Dev-Cpp"
- Open Environment Variables.
- Add "C:\GnuWin32\bin;C:\Dev-Cpp\bin;" to path.
Compilation & Execution of your Program:
- Open Command prompt and switch to your working directory where you have stored your lex file (".l") and yacc file (".y")
- Let your lex and yacc files be "hello.l" and "hello.y". Now, follow the preceding steps to compile and run your program.
- For Compiling Lex file only:
- flex hello.l
- gcc lex.yy.c
- For Compiling Lex & Yacc file both:
- flex hello.l
- bison -dy hello.y
- gcc lex.yy.c y.tab.c
- For Executing the Program
- a.exe
Video: