Skip to content

Commit

Permalink
Prepare the BNF for the inlining example
Browse files Browse the repository at this point in the history
  • Loading branch information
ydah committed Feb 14, 2024
1 parent 27b5288 commit 15d7e3f
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions spec/fixtures/inlining/basic.y
Original file line number Diff line number Diff line change
@@ -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 <i> 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[])
{
}

0 comments on commit 15d7e3f

Please sign in to comment.