From 15d7e3f98602252fe2849dd6a0e149867903f208 Mon Sep 17 00:00:00 2001 From: ydah <13041216+ydah@users.noreply.github.com> Date: Thu, 15 Feb 2024 01:18:24 +0900 Subject: [PATCH] Prepare the BNF for the inlining example --- spec/fixtures/inlining/basic.y | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 spec/fixtures/inlining/basic.y diff --git a/spec/fixtures/inlining/basic.y b/spec/fixtures/inlining/basic.y new file mode 100644 index 00000000..f9e9fe87 --- /dev/null +++ b/spec/fixtures/inlining/basic.y @@ -0,0 +1,42 @@ +/* + * This is comment for this file. + */ + +%{ +// Prologue +static int yylex(YYSTYPE *val, YYLTYPE *loc); +static int yyerror(YYLTYPE *loc, const char *str); +%} + +%union { + int i; +} + +%token number + +%inline op: '+' { (+) } + | '-' { (-) } + | '*' { (*) } + | '/' { (/) } + +%% + +expression : number + : expression op expression { $$ = $1 $2 $3; } + ; + +%% + +static int yylex(YYSTYPE *yylval, YYLTYPE *loc) { +{ + return 0; +} + +static int yyerror(YYLTYPE *loc, const char *str) { +{ + return 0; +} + +int main(int argc, char *argv[]) +{ +}