Skip to content
Snippets Groups Projects
Commit 28a17149 authored by expan's avatar expan
Browse files

combine makefiles

parent b0b64259
No related branches found
No related tags found
1 merge request!1SQLP parser with cons cells
all: Parser .PHONY: all clean
#CFLAGS = `pkg-config --cflags glib-2.0`
#LDLIBS = `pkg-config --libs glib-2.0`
all: SQLPParser Parser
Parser: parser.c util.o SQLPParser: SQLPParser.c SQLPGrammar.y SQLPScanner.l util.o
gcc -w parser.c util.o -o Parser bison --verbose -d SQLPGrammar.y
flex SQLPScanner.l
gcc -w SQLPParser.c util.o -o SQLPParser
rm -f lex.yy.c SQLPGrammar.tab.c SQLPGrammar.tab.h
util.o: util.c util.h util.o: util.c util.h
gcc -c util.c gcc -c util.c
# gcc `pkg-config --cflags --libs glib-2.0` util.c
#gcc -c util.c
Parser: parser.c util.o
gcc -w parser.c util.o -o Parser
clean: clean:
rm -f util.o Parser rm -f lex.yy.c *.tab.c *.tab.h *.fasl Parser util.o
.PHONY: all clean
#CFLAGS = `pkg-config --cflags glib-2.0`
#LDLIBS = `pkg-config --libs glib-2.0`
all: SQLPParser
SQLPParser: SQLPParser.c SQLPGrammar.y SQLPScanner.l util.o
bison --verbose -d SQLPGrammar.y
flex SQLPScanner.l
gcc -w SQLPParser.c util.o -o SQLPParser
rm -f lex.yy.c SQLPGrammar.tab.c SQLPGrammar.tab.h
util.o: util.c util.h
gcc -c util.c
# gcc `pkg-config --cflags --libs glib-2.0` util.c
#gcc -c util.c
clean:
rm -f lex.yy.c *.tab.c *.tab.h *.fasl util.o
...@@ -19,8 +19,12 @@ cons_cell* parse(char* input) { ...@@ -19,8 +19,12 @@ cons_cell* parse(char* input) {
char s[256]; char s[256];
strcpy(s, "one two three"); strcpy(s, "one two three");
char* token = strtok(s, " "); char* token = strtok(s, " ");
cons_cell* cur_cell = car_cons;
while (token) { while (token) {
printf("token: %s\n", token); printf("token: %s\n", token);
cons_cell* cdr_cons = parse(token);
cur_cell->cdr = cdr_cons;
cur_cell = cdr_cons;
token = strtok(NULL, " "); token = strtok(NULL, " ");
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment