remote.c: remove autotoolized conditional includes
[rofl0r-VisualBoyAdvance.git] / src / expr.y
blob7a20eb07a81f890b6852e343054b157d4dcda9b1
1 %{
2 #include <stdio.h>
3 #include <memory.h>
4 #include <stdlib.h>
5 #include <string.h>
7 #include "System.h"
8 #include "elf.h"
9 #include "exprNode.h"
11 extern int yyerror(char *);
12 extern int yylex();
13 extern char *yytext;
16 //#define YYERROR_VERBOSE 1
17 //#define YYDEBUG 1
19 Node *result = NULL;
22 %token TOKEN_IDENTIFIER TOKEN_DOT TOKEN_STAR TOKEN_ARROW TOKEN_ADDR
23 %token TOKEN_SIZEOF TOKEN_NUMBER
24 %left TOKEN_DOT TOKEN_ARROW '['
25 %expect 6
28 final: expression { result = $1; }
31 expression:
32 simple_expression { $$ = $1; } |
33 '(' expression ')' { $$ = $2; } |
34 expression TOKEN_DOT ident { $$ = exprNodeDot($1, $3); } |
35 expression TOKEN_ARROW ident { $$ = exprNodeArrow($1, $3); } |
36 expression '[' number ']' { $$ = exprNodeArray($1, $3); }
38 simple_expression:
39 ident { $$ = $1; } |
40 TOKEN_STAR expression { $$ = exprNodeStar($2); } |
41 TOKEN_ADDR expression { $$ = exprNodeAddr($2); } |
42 TOKEN_SIZEOF '(' expression ')' { $$ = exprNodeSizeof($3); }
45 number:
46 TOKEN_NUMBER { $$ = exprNodeNumber(); }
49 ident:
50 TOKEN_IDENTIFIER {$$ = exprNodeIdentifier(); }
55 int yyerror(char *s)
57 return 0;
60 #ifndef SDL
61 extern FILE *yyin;
62 int main(int argc, char **argv)
64 // yydebug = 1;
65 ++argv, --argc;
66 if(argc > 0)
67 yyin = fopen(argv[0], "r");
68 else
69 yyin = stdin;
70 if(!yyparse())
71 result->print(result);
73 #endif