If you don't have lex and yacc install them using the following command.
Fedora Core
Ubuntu
Fedora Core
# yum -y install flex bison |
Ubuntu
$ sudo aptitude install flex bison |
This script will be very useful for compiling lex and yacc files. Here is the script:
After saving this in file named compile.sh
You have to apply the following command to make it executable script.
Now you can run the script like this:
1 echo SA-OS Script [http://sa-os.blogspot.com] 2 echo Generating lex 3 lex $1 4 echo compling using yet another compiler compiler 5 yacc -d $2 6 echo Creating objects for c files 7 gcc -c lex.yy.c y.tab.c 8 echo Creating executable 9 gcc -o p.out lex.yy.o y.tab.o -ll 10 echo Running executable 11 ./p.out
After saving this in file named compile.sh
You have to apply the following command to make it executable script.
$ chmod a+x compile.sh |
Now you can run the script like this:
$ ./compile.sh lexfilename.l yaccfilename.y |
No comments:
Post a Comment