I am trying to make an executable script so that I can turn in a project to my professor. Usually the code is in Java and I use script that looks like the following(and it always has one input file): #!/bin/bash java Main $1 and my professor executes it by running ./p1 file.txt. However, for this project, we made a simple parser using lex and yacc. These scripts are confusing to me, and I am not sure how to create the same exact executable for C. My lex file is called aa.l and my bison file is called aa.y. First he will run make and then run the executable. With these names, what should my file look?

This is my makefile:

aa:     aa.tab.o lex.yy.o
        cc -o aa lex.yy.o aa.tab.o 

aa.tab.o: aa.tab.c
        cc -c aa.tab.c

aa.tab.c: aa.y
        bison -d aa.y

lex.yy.o: lex.yy.c aa.tab.h
        cc -c lex.yy.c

lex.yy.c: aa.l aa.tab.c
        flex aa.l

0 Answers