I am using FLEX tool to design a simple Compiler
Just type in cmd:
sudo apt-get install flex
sudo apt-get update
Just go to this Official Site Download the complete package After Downloading,install it. Then in searchBar , Type:
edit the system environment variables
Go to Environment Variable, Under System Variables , Choose Path
Now it will pop up Edit Environment Variable. Then add Two path
one is bin folder of MinGW
and another is bin folder of GnuWin32
Flex file's extensions are .l
or .lex
run command prompt, where your .l or .lex file is located
In cmd Type :
flex filename.l
gcc lex.yy.c
./a.out
you have to create one folder to execute one .lex file
So if you have multiple .l or .lex file, have to create different different folder
why? The reason is: for each .l or .lex file , everytime a.out file will be created
Now windows doesn't support duplicate file in same folder,so it will try to merge & the previous a.out file will be lost
generally Flex programme is designed with default a.out
file But if You can change the name of Object file
Then automatically the executable file name will be changed.
In CMD Type:
flex fileName.l
gcc lex.yy.c -o Anything
./Anything.exe