-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparser.hpp
212 lines (197 loc) · 5.9 KB
/
parser.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/* A Bison parser, made by GNU Bison 2.3. */
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
IDENTIFIER = 258,
INTEGER = 259,
REAL = 260,
STRING = 261,
BOOLEAN = 262,
KEYWORD_ALLOCATE = 263,
KEYWORD_BOOL = 264,
KEYWORD_BREAK = 265,
KEYWORD_CASE = 266,
KEYWORD_CHAR = 267,
KEYWORD_CONST = 268,
KEYWORD_CONTINUE = 269,
KEYWORD_DECLARE = 270,
KEYWORD_DEFAULT = 271,
KEYWORD_DESTRUCT = 272,
KEYWORD_DOUBLE = 273,
KEYWORD_ELSE = 274,
KEYWORD_FALSE = 275,
KEYWORD_FUNCTION = 276,
KEYWORD_FLOAT = 277,
KEYWORD_FOR = 278,
KEYWORD_GOTO = 279,
KEYWORD_IF = 280,
KEYWORD_INPUT = 281,
KEYWORD_INT = 282,
KEYWORD_LONG = 283,
KEYWORD_OUTPUT = 284,
KEYWORD_RETURN = 285,
KEYWORD_SIZEOF = 286,
KEYWORD_STATIC = 287,
KEYWORD_STRING = 288,
KEYWORD_SWITCH = 289,
KEYWORD_TRUE = 290,
KEYWORD_TYPE = 291,
OPERATOR_EQ = 292,
OPERATOR_NEQ = 293,
OPERATOR_LEQ = 294,
OPERATOR_LT = 295,
OPERATOR_GT = 296,
OPERATOR_GEQ = 297,
OPERATOR_ASSIGN = 298,
OPERATOR_NOT = 299,
OPERATOR_BITWISE_NEG = 300,
OPERATOR_ARITH_AND = 301,
OPERATOR_LOGIC_AND = 302,
OPERATOR_ARITH_OR = 303,
OPERATOR_LOGIC_OR = 304,
OPERATOR_XOR = 305,
OPERATOR_MUL = 306,
OPERATOR_ADD = 307,
OPERATOR_INC = 308,
OPERATOR_DEC = 309,
OPERATOR_SUB = 310,
OPERATOR_DIV = 311,
OPERATOR_MOD = 312,
PUNCTUATION_LBRACE = 313,
PUNCTUATION_RBRACE = 314,
PUNCTUATION_LPAREN = 315,
PUNCTUATION_RPAREN = 316,
PUNCTUATION_LBRACKET = 317,
PUNCTUATION_RBRACKET = 318,
PUNCTUATION_DOT = 319,
PUNCTUATION_COMMA = 320,
PUNCTUATION_COLON = 321,
PUNCTUATION_SEMICOLON = 322,
END_OF_FILE = 323
};
#endif
/* Tokens. */
#define IDENTIFIER 258
#define INTEGER 259
#define REAL 260
#define STRING 261
#define BOOLEAN 262
#define KEYWORD_ALLOCATE 263
#define KEYWORD_BOOL 264
#define KEYWORD_BREAK 265
#define KEYWORD_CASE 266
#define KEYWORD_CHAR 267
#define KEYWORD_CONST 268
#define KEYWORD_CONTINUE 269
#define KEYWORD_DECLARE 270
#define KEYWORD_DEFAULT 271
#define KEYWORD_DESTRUCT 272
#define KEYWORD_DOUBLE 273
#define KEYWORD_ELSE 274
#define KEYWORD_FALSE 275
#define KEYWORD_FUNCTION 276
#define KEYWORD_FLOAT 277
#define KEYWORD_FOR 278
#define KEYWORD_GOTO 279
#define KEYWORD_IF 280
#define KEYWORD_INPUT 281
#define KEYWORD_INT 282
#define KEYWORD_LONG 283
#define KEYWORD_OUTPUT 284
#define KEYWORD_RETURN 285
#define KEYWORD_SIZEOF 286
#define KEYWORD_STATIC 287
#define KEYWORD_STRING 288
#define KEYWORD_SWITCH 289
#define KEYWORD_TRUE 290
#define KEYWORD_TYPE 291
#define OPERATOR_EQ 292
#define OPERATOR_NEQ 293
#define OPERATOR_LEQ 294
#define OPERATOR_LT 295
#define OPERATOR_GT 296
#define OPERATOR_GEQ 297
#define OPERATOR_ASSIGN 298
#define OPERATOR_NOT 299
#define OPERATOR_BITWISE_NEG 300
#define OPERATOR_ARITH_AND 301
#define OPERATOR_LOGIC_AND 302
#define OPERATOR_ARITH_OR 303
#define OPERATOR_LOGIC_OR 304
#define OPERATOR_XOR 305
#define OPERATOR_MUL 306
#define OPERATOR_ADD 307
#define OPERATOR_INC 308
#define OPERATOR_DEC 309
#define OPERATOR_SUB 310
#define OPERATOR_DIV 311
#define OPERATOR_MOD 312
#define PUNCTUATION_LBRACE 313
#define PUNCTUATION_RBRACE 314
#define PUNCTUATION_LPAREN 315
#define PUNCTUATION_RPAREN 316
#define PUNCTUATION_LBRACKET 317
#define PUNCTUATION_RBRACKET 318
#define PUNCTUATION_DOT 319
#define PUNCTUATION_COMMA 320
#define PUNCTUATION_COLON 321
#define PUNCTUATION_SEMICOLON 322
#define END_OF_FILE 323
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 13 "parser.y"
{
char* str;
ASTNode* node;
std::vector<ASTNode*>* node_list;
}
/* Line 1529 of yacc.c. */
#line 191 "parser.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
extern YYSTYPE yylval;
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
typedef struct YYLTYPE
{
int first_line;
int first_column;
int last_line;
int last_column;
} YYLTYPE;
# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
# define YYLTYPE_IS_DECLARED 1
# define YYLTYPE_IS_TRIVIAL 1
#endif
extern YYLTYPE yylloc;