diff options
-rw-r--r-- | Makefile | 60 | ||||
-rw-r--r-- | resources/HALK_FINAL.svg | 2 | ||||
-rw-r--r-- | src/include/parser.h | 3 |
3 files changed, 43 insertions, 22 deletions
@@ -1,30 +1,49 @@ -.PHONY: install uninstall dev clean test me a sandwich -name := halk -cc := gcc -flags := -devflags := -ggdb -fsanitize=leak,address,undefined -fno-omit-frame-pointer -sources := $(wildcard src/*.c) -sources := $(filter-out src/parser.c, $(sources)) # exclude the incomplete parser for now. -objects := $(sources:.c=.o) - -$(name): $(objects) - $(cc) $(objects) $(flags) -o ./$(name).out - -dev: $(objects) - $(cc) $(objects) $(devflags) -o ./$(name).out - -%.o: %.c include/%.h - $(cc) -c $(flags) $< -o $@ +PREFIX := /usr/local +BINDIR := $(PREFIX)/bin +BIN := halk +TMPBIN := halk.out +CC := gcc +FLAGS := +DEVFLAGS := -ggdb -fsanitize=leak,address,undefined -fno-omit-frame-pointer +SRCS := $(wildcard src/*.c) +SRCS := $(filter-out src/parser.c, $(SRCS)) # exclude the incomplete parser for now. +OBJS := $(SRCS:.c=.o) + +all: options HALK + +options: + @echo "HALK build options " + @echo "================== " + @echo "cc: $(CC) " + @echo "flags: $(FLAGS) " + @echo " " + +devoptions: + @echo "HALK build options (development) " + @echo "================================ " + @echo "cc: $(CC) " + @echo "flags: $(DEVFLAGS) " + @echo " " + +HALK: $(OBJS) + $(CC) $(OBJS) $(FLAGS) -o $(TMPBIN) + +dev: $(OBJS) + @make devoptions + $(CC) $(OBJS) $(DEVFLAGS) -o $(TMPBIN) install: make - cp ./$(name).out /usr/bin/$(name) + cp ./$(BIN).out $(BINDIR)/$(BIN) uninstall: - rm -f /usr/bin/$(name) + rm -f $(BINDIR)/$(BIN) clean: - rm -f ./$(name).out ./src/*.o + rm -f $(TMPBIN) src/*.o + +%.o: %.c include/%.h + $(CC) -c $(FLAGS) $< -o $@ # fun me: @@ -33,3 +52,4 @@ me: a sandwich: @exit +.PHONY: all options devoptions dev install uninstall clean diff --git a/resources/HALK_FINAL.svg b/resources/HALK_FINAL.svg index e22d772..01f1c1b 100644 --- a/resources/HALK_FINAL.svg +++ b/resources/HALK_FINAL.svg @@ -56,4 +56,4 @@ <text class="cls-11" transform="translate(24.48 72.04)"><tspan class="cls-5" x="0" y="0">H</tspan><tspan class="cls-6" x="19.27" y="0">A</tspan><tspan class="cls-7" x="38.53" y="0">L</tspan><tspan class="cls-9" x="57.8" y="0">K</tspan></text> <text class="cls-11" transform="translate(26.48 70.04)"><tspan class="cls-2" x="0" y="0">H</tspan><tspan class="cls-1" x="19.27" y="0">A</tspan><tspan class="cls-4" x="38.53" y="0">L</tspan><tspan class="cls-3" x="57.8" y="0">K</tspan></text> </g> -</svg>
\ No newline at end of file +</svg> diff --git a/src/include/parser.h b/src/include/parser.h index dcacabe..2811469 100644 --- a/src/include/parser.h +++ b/src/include/parser.h @@ -13,9 +13,10 @@ typedef struct PARSER_STRUC { // initialize a parser parser_t* parser_init(lexer_t* lexer); +void parser_destroy(parser_t* parser); // check for expected token, or throw syntax error -void parser_token_expect(parser_t* parser, int token_type); +void parser_token_expect(parser_t* parser, int (*expected_token)(token_t*)); // do the parse tree_t* parser_parse(parser_t* parser); |