diff options
author | sanine <sanine.not@pm.me> | 2023-01-18 13:18:13 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-01-18 13:18:13 -0600 |
commit | 3409a7dbe08bdc98d7663e5dcafaee5792d12139 (patch) | |
tree | 29776d59a8f9417f426e027a7397403a68811232 /yy | |
parent | 9e19578675d8ad6a7c252e884b26e61ab9159b4a (diff) |
working prefixes
Diffstat (limited to 'yy')
-rw-r--r-- | yy/kalmia.h | 2 | ||||
-rw-r--r-- | yy/kalmia.l | 3 | ||||
-rw-r--r-- | yy/kalmia.y | 5 | ||||
-rw-r--r-- | yy/main.c | 8 | ||||
-rw-r--r-- | yy/makefile | 4 |
5 files changed, 15 insertions, 7 deletions
diff --git a/yy/kalmia.h b/yy/kalmia.h index 6259956..98afd13 100644 --- a/yy/kalmia.h +++ b/yy/kalmia.h @@ -1,2 +1,4 @@ +#define YYLTYPE KALMIALTYPE +#define YYSTYPE KALMIASTYPE #include "kalmia.tab.h" #include "kalmia.lex.h" diff --git a/yy/kalmia.l b/yy/kalmia.l index 916f576..697d6ac 100644 --- a/yy/kalmia.l +++ b/yy/kalmia.l @@ -1,9 +1,12 @@ %option noinput nounput noyywrap 8bit nodefault %option reentrant bison-bridge bison-locations +%option prefix="kalmia" %start STRING %{ #include <string.h> +#define YYLTYPE KALMIALTYPE +#define YYSTYPE KALMIASTYPE #include "kalmia.tab.h" #define YY_USER_ACTION \ yylloc->first_line = yylloc->last_line; \ diff --git a/yy/kalmia.y b/yy/kalmia.y index 78bf895..f1d77f9 100644 --- a/yy/kalmia.y +++ b/yy/kalmia.y @@ -1,4 +1,5 @@ %define api.pure full +%define api.prefix {kalmia} %locations %define parse.error verbose %param { yyscan_t scanner } @@ -77,8 +78,8 @@ attribute: integers: - INTEGER { printf("%d\n", $1); } - | integers INTEGER { printf("%d\n", $2); } + INTEGER { printf("%ld\n", $1); } + | integers INTEGER { printf("%ld\n", $2); } ; doubles: @@ -14,9 +14,9 @@ int main(int argc, char **argv) } yyscan_t scanner; - yylex_init(&scanner); - yyset_in(in, scanner); - yyparse(scanner); - yylex_destroy(scanner); + kalmialex_init(&scanner); + kalmiaset_in(in, scanner); + kalmiaparse(scanner); + kalmialex_destroy(scanner); return 0; } diff --git a/yy/makefile b/yy/makefile index 5c9ce5f..76b5c77 100644 --- a/yy/makefile +++ b/yy/makefile @@ -1,3 +1,5 @@ +WARNINGS = -Wall -Wextra -Wpedantic + all: kalmia kalmia.tab.c: kalmia.y @@ -7,7 +9,7 @@ kalmia.lex.c: kalmia.l flex -o "$@" --header-file="kalmia.lex.h" kalmia.l kalmia: kalmia.tab.c kalmia.lex.c main.c kalmia.h - gcc -o kalmia main.c kalmia.tab.c kalmia.lex.c -lfl + gcc -o kalmia ${WARNINGS} main.c kalmia.tab.c kalmia.lex.c clean: rm kalmia.lex.c kalmia.lex.h kalmia.tab.c kalmia.tab.h kalmia |