i think the compiler is working
This commit is contained in:
parent
670871345e
commit
0d666fb853
8
Makefile
8
Makefile
@ -1,5 +1,9 @@
|
||||
all:
|
||||
flex compiler/hell.l
|
||||
gcc lex.yy.c -lfl
|
||||
gcc lex.yy.c -lfl -o hellp
|
||||
install:
|
||||
install hellp /usr/bin
|
||||
clean:
|
||||
rm lex.yy.c a.out
|
||||
rm lex.yy.c hellp
|
||||
uninstall:
|
||||
rm /usr/bin/hellp
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
INFILE=${2}
|
||||
OUTFILE=${3}
|
||||
|
||||
usage() {
|
||||
printf "${0} - compiler for HELL programming language\n"
|
||||
@ -13,7 +14,7 @@ usage() {
|
||||
}
|
||||
|
||||
usage_small() {
|
||||
printf "usage: ${0} INFILE GCCOPTS\n"
|
||||
printf "usage: ${0} [-h] [-c] INFILE OUTFILE\n"
|
||||
}
|
||||
|
||||
case ${1} in
|
||||
@ -33,14 +34,18 @@ case ${1} in
|
||||
printf "${0}: error: HELL preprocessor failed to run\n"
|
||||
exit 1
|
||||
fi
|
||||
printf "${0}: hellp: ran successfully\n"
|
||||
|
||||
printf "compiling ${INFILE}\n"
|
||||
gcc ${INFILE}.new -o ${INFILE}
|
||||
gcc -x c ${INFILE}.new -o ${OUTFILE}
|
||||
if [ "$?" != 0 ]; then
|
||||
printf "${0}: error: C compiler failed to run\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf "cleaning up\n"
|
||||
rm -v ${INFILE}.new
|
||||
|
||||
printf "finished compiling\n"
|
||||
exit 0
|
||||
;;
|
||||
|
Loading…
Reference in New Issue
Block a user