PIPS
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "ri-util.h"
#include "text-util.h"
#include "misc.h"
#include "properties.h"
#include "c_parser_private.h"
#include "c_syntax.h"
#include "cyacc.tab.h"
#include <limits.h>
Go to the source code of this file.
Data Structures | |
union | yyalloc |
INFRINGES ON USER NAME SPACE. More... | |
Macros | |
#define | YYBISON 30802 |
A Bison parser, made by GNU Bison 3.8.2. More... | |
#define | YYBISON_VERSION "3.8.2" |
Bison version string. More... | |
#define | YYSKELETON_NAME "yacc.c" |
Skeleton name. More... | |
#define | YYPURE 0 |
Pure parsers. More... | |
#define | YYPUSH 0 |
Push parsers. More... | |
#define | YYPULL 1 |
Pull parsers. More... | |
#define | yyparse(void) c_parse |
------—. More... | |
#define | yylex c_lex |
#define | yyerror c_error |
#define | yydebug c_debug |
#define | yynerrs c_nerrs |
#define | yylval c_lval |
#define | yychar c_char |
#define | C_ERROR_VERBOSE 1 /**much clearer error messages with bison */ |
First part of user prologue. More... | |
#define | YYMAXDEPTH 1000000 |
Increase the parser stack to have SPEC2006/445.gobmk/owl_defendpat.c going through without a: More... | |
#define | BREAKPOINT ; |
#define | SCOPE_UNDEFINED (-1) |
Each scope in the current unit has its own number. More... | |
#define | YY_CAST(Type, Val) ((Type) (Val)) |
#define | YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) |
#define | YY_NULLPTR ((void*)0) |
#define | YYPTRDIFF_T long |
#define | YYPTRDIFF_MAXIMUM LONG_MAX |
#define | YYSIZE_T unsigned |
#define | YYSIZE_MAXIMUM |
#define | YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) |
#define | YY_(Msgid) Msgid |
#define | YY_ATTRIBUTE_PURE |
#define | YY_ATTRIBUTE_UNUSED |
#define | YY_USE(E) ((void) (E)) |
Suppress unused-variable warnings by "using" E. More... | |
#define | YY_INITIAL_VALUE(Value) Value |
Suppress an incorrect diagnostic about yylval being uninitialized. More... | |
#define | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
#define | YY_IGNORE_MAYBE_UNINITIALIZED_END |
#define | YY_IGNORE_USELESS_CAST_BEGIN |
#define | YY_IGNORE_USELESS_CAST_END |
#define | YY_ASSERT(E) ((void) (0 && (E))) |
#define | YYSTACK_ALLOC YYMALLOC |
The parser invokes alloca or malloc; define the necessary symbols. More... | |
#define | YYSTACK_FREE YYFREE |
#define | YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
#define | YYMALLOC malloc |
#define | YYFREE free |
INFRINGES ON USER NAME SPACE. More... | |
#define | YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) |
The size of the maximum gap between one aligned stack and the next. More... | |
#define | YYSTACK_BYTES(N) |
The size of an array large to enough to hold all stacks, each with N elements. More... | |
#define | YYCOPY_NEEDED 1 |
#define | YYSTACK_RELOCATE(Stack_alloc, Stack) |
Relocate STACK from its old location to the new one. More... | |
#define | YYCOPY(Dst, Src, Count) |
Copy COUNT objects from SRC to DST. More... | |
#define | YYFINAL 7 |
!YYCOPY_NEEDED More... | |
#define | YYLAST 3204 |
YYLAST – Last index in YYTABLE. More... | |
#define | YYNTOKENS 119 |
YYNTOKENS – Number of terminals. More... | |
#define | YYNNTS 110 |
YYNNTS – Number of nonterminals. More... | |
#define | YYNRULES 324 |
YYNRULES – Number of rules. More... | |
#define | YYNSTATES 597 |
YYNSTATES – Number of states. More... | |
#define | YYMAXUTOK 373 |
YYMAXUTOK – Last valid token kind. More... | |
#define | YYTRANSLATE(YYX) |
YYTRANSLATE(TOKEN-NUM) – Symbol number corresponding to TOKEN-NUM as returned by yylex, with out-of-bounds checking. More... | |
#define | YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) |
Accessing symbol of state STATE. More... | |
#define | YYPACT_NINF (-445) |
#define | yypact_value_is_default(Yyn) ((Yyn) == YYPACT_NINF) |
#define | YYTABLE_NINF (-299) |
#define | yytable_value_is_error(Yyn) 0 |
#define | yyerrok (yyerrstatus = 0) |
#define | yyclearin (yychar = YYEMPTY) |
#define | YYACCEPT goto yyacceptlab |
#define | YYABORT goto yyabortlab |
#define | YYERROR goto yyerrorlab |
#define | YYNOMEM goto yyexhaustedlab |
#define | YYRECOVERING() (!!yyerrstatus) |
#define | YYBACKUP(Token, Value) |
#define | YYERRCODE YYUNDEF |
Backward compatibility with an undocumented macro. More... | |
#define | YYFPRINTF fprintf |
Enable debugging if requested. More... | |
#define | YYDPRINTF(Args) |
#define | YY_SYMBOL_PRINT(Title, Kind, Value, Location) |
#define | YY_STACK_PRINT(Bottom, Top) |
#define | YY_REDUCE_PRINT(Rule) |
#define | YYINITDEPTH 200 |
!YYDEBUG More... | |
#define | YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
Typedefs | |
typedef enum yysymbol_kind_t | yysymbol_kind_t |
typedef signed char | yytype_int8 |
On compilers that do not define PTRDIFF_MAX etc., make sure <limits.h> and (if available) <stdint.h> are included so that the code can choose integer types of a good width. More... | |
typedef short | yytype_int16 |
typedef unsigned char | yytype_uint8 |
Work around bug in HP-UX 11.23, which defines these macros incorrectly for preprocessor constants. More... | |
typedef unsigned short | yytype_uint16 |
typedef yytype_int16 | yy_state_t |
Stored state numbers (used for stacks). More... | |
typedef int | yy_state_fast_t |
State numbers in computations. More... | |
Functions | |
static void | add_initialization_expression (int init_p) |
init_p = 0 => no initialization for a variable or no definition for a derived entity (struct, union, maybe enum) More... | |
static void | PushFunction (entity f) |
The following structures must be stacks because all the related entities are in recursive structures. More... | |
static void | PopFunction () |
entity | GetFunction () |
cproto workaround More... | |
void | reset_expression_comment () |
we don't want an expression comment with new lines, it is disgracefull More... | |
static statement | flush_expression_comment (statement s) |
flushes all expression comments and add them to statement s More... | |
static void | save_expression_comment_as_statement_comment () |
static statement | flush_statement_comment (statement s) |
flushes all statement comments and add them to statement s More... | |
string | pop_block_scope (string old_scope) |
The scope is moved up the scope tree and a NULL is return when there are no more scope to explore. More... | |
string | scope_to_block_scope (string full_scope) |
Allocate a new string containing only block scope information. More... | |
c_parser_context | CreateDefaultContext () |
void | InitScope () |
static void | EnterScope () |
int | ScopeStackSize () |
string | GetScope () |
string | GetParentScope () |
void | ExitScope () |
void | PushContext (c_parser_context c) |
void | PopContext () |
c_parser_context | GetContext () |
c_parser_context | GetContextCopy () |
void | reset_declaration_counter () |
int | get_declaration_counter () |
void | init_c_parser_scope_stack () |
void | reset_c_parser_scope_stack () |
void | force_reset_c_parser_scope_stack () |
To be used by an error handler. More... | |
void | push_new_c_parser_scope () |
void | pop_c_parser_scope_stack () |
bool | c_parser_scope_stack_empty_p () |
string | get_c_parser_current_scope () |
string | get_c_parser_nth_scope (int n) |
int | c_parser_number_of_scopes () |
static void | RecordDerivedEntityDeclaration (entity de) |
static list | GetDerivedEntityDeclarations () |
static void | ResetDerivedEntityDeclarations () |
void * | malloc (YYSIZE_T) |
void | free (void *) |
static const char * | yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED |
The user-facing name of the symbol whose (internal) number is YYSYMBOL. More... | |
static void | yy_symbol_value_print (FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const *const yyvaluep) |
-------------------------------—. More... | |
static void | yy_symbol_print (FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const *const yyvaluep) |
-----------------------—. More... | |
static void | yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) |
--------------------------------------------------------------—. More... | |
static void | yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule) |
--------------------------------------------—. More... | |
static void | yydestruct (const char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep) |
YYMAXDEPTH – maximum size the stacks can grow to (effective only if the built-in stack extension method is used). More... | |
Variables | |
static int | CurrentMode = 0 |
to know the mode of the formal parameter: by value or by reference More... | |
static bool | is_external = true |
to know if the variable is declared inside or outside a function, so its scope is the current function or the compilation unit or TOP-LEVEL More... | |
static int | enum_counter = 0 |
to compute the enumerator value: val(i) = val(i-1) + 1 More... | |
static int | abstract_counter = 1 |
to create temporary entities for abstract types More... | |
static list | initialization_expressions = NIL |
to preserve information about the declarations for the prettyprinter, especially for the global variables, but also the derived types (struct, union, enum). More... | |
static c_parser_context | ycontext = c_parser_context_undefined |
static string | expression_comment = string_undefined |
FI: these two variables are used in conjunction with comma expressions. More... | |
static int | expression_line_number = STATEMENT_NUMBER_UNDEFINED |
static list | all_expression_comments_as_statement_comments = NIL |
after a while (crocodile) expression comments are pushed into a list that is purged upon call to add_expression_comment More... | |
static int | C_scope_identifier = -2 |
static int | declaration_counter = 0 |
Declaration counter. More... | |
static int | c_parser_scope_number = SCOPE_UNDEFINED |
static stack | c_parser_scope_stack = stack_undefined |
static list | internal_derived_entity_declarations = NIL |
When struct and union declarations are nested, the rules cannot return information about the internal declarations because they must return type information. More... | |
static const yytype_int8 | yytranslate [] |
YYTRANSLATE[TOKEN-NUM] – Symbol number corresponding to TOKEN-NUM as returned by yylex. More... | |
static const yytype_int16 | yyrline [] |
YYRLINE[YYN] – Source line where rule number YYN was defined. More... | |
static const char *const | yytname [] |
YYTNAME[SYMBOL-NUM] – String name of the symbol SYMBOL-NUM. More... | |
static const yytype_int16 | yypact [] |
YYPACT[STATE-NUM] – Index in YYTABLE of the portion describing STATE-NUM. More... | |
static const yytype_int16 | yydefact [] |
YYDEFACT[STATE-NUM] – Default reduction number in state STATE-NUM. More... | |
static const yytype_int16 | yypgoto [] |
YYPGOTO[NTERM-NUM]. More... | |
static const yytype_int16 | yydefgoto [] |
YYDEFGOTO[NTERM-NUM]. More... | |
static const yytype_int16 | yytable [] |
YYTABLE[YYPACT[STATE-NUM]] – What to do in state STATE-NUM. More... | |
static const yytype_int16 | yycheck [] |
static const yytype_uint8 | yystos [] |
YYSTOS[STATE-NUM] – The symbol kind of the accessing symbol of state STATE-NUM. More... | |
static const yytype_uint8 | yyr1 [] |
YYR1[RULE-NUM] – Symbol kind of the left-hand side of rule RULE-NUM. More... | |
static const yytype_int8 | yyr2 [] |
YYR2[RULE-NUM] – Number of symbols on the right-hand side of rule RULE-NUM. More... | |
int | yydebug |
Nonzero means print parse trace. More... | |
int | yychar |
Lookahead token kind. More... | |
YYSTYPE | yylval |
The semantic value of the lookahead symbol. More... | |
int | yynerrs |
Number of syntax errors so far. More... | |
#define BREAKPOINT ; |
Definition at line 112 of file cyacc.tab.c.
#define C_ERROR_VERBOSE 1 /**much clearer error messages with bison */ |
#define SCOPE_UNDEFINED (-1) |
Each scope in the current unit has its own number.
The scope management in the C parser is the same as in the C preprocessor.
The scope numbers defined here are used by the C parser lexical analyzer to disambiguate between named types and variables, but different scopes are defined for the internal representation.
Definition at line 510 of file cyacc.tab.c.
#define YY_ | ( | Msgid | ) | Msgid |
Definition at line 1013 of file cyacc.tab.c.
#define YY_ACCESSING_SYMBOL | ( | State | ) | YY_CAST (yysymbol_kind_t, yystos[State]) |
Definition at line 1079 of file cyacc.tab.c.
#define YY_ATTRIBUTE_PURE |
Definition at line 1022 of file cyacc.tab.c.
#define YY_ATTRIBUTE_UNUSED |
Definition at line 1030 of file cyacc.tab.c.
Definition at line 634 of file cyacc.tab.c.
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
Definition at line 1059 of file cyacc.tab.c.
#define YY_IGNORE_MAYBE_UNINITIALIZED_END |
Definition at line 1060 of file cyacc.tab.c.
#define YY_IGNORE_USELESS_CAST_BEGIN |
Definition at line 1074 of file cyacc.tab.c.
#define YY_IGNORE_USELESS_CAST_END |
Definition at line 1075 of file cyacc.tab.c.
Suppress an incorrect diagnostic about yylval being uninitialized.
Definition at line 1056 of file cyacc.tab.c.
#define YY_NULLPTR ((void*)0) |
Definition at line 646 of file cyacc.tab.c.
#define YY_REDUCE_PRINT | ( | Rule | ) |
Definition at line 2505 of file cyacc.tab.c.
Definition at line 635 of file cyacc.tab.c.
#define YY_STACK_PRINT | ( | Bottom, | |
Top | |||
) |
Definition at line 2474 of file cyacc.tab.c.
#define YY_SYMBOL_PRINT | ( | Title, | |
Kind, | |||
Value, | |||
Location | |||
) |
Definition at line 2412 of file cyacc.tab.c.
#define YYABORT goto yyabortlab |
Definition at line 2366 of file cyacc.tab.c.
#define YYACCEPT goto yyacceptlab |
Definition at line 2365 of file cyacc.tab.c.
#define YYBACKUP | ( | Token, | |
Value | |||
) |
Definition at line 2373 of file cyacc.tab.c.
#define YYBISON 30802 |
A Bison parser, made by GNU Bison 3.8.2.
Bison implementation for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 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 3 of the License, 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, see https://www.gnu.org/licenses/.
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.
C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser.
DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, especially those whose name start with YY_ or yy_. They are private implementation details that can be changed or removed.
All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below.
Identify Bison output, and Bison version.
Definition at line 49 of file cyacc.tab.c.
#define YYBISON_VERSION "3.8.2" |
#define yychar c_char |
Definition at line 74 of file cyacc.tab.c.
Definition at line 2363 of file cyacc.tab.c.
#define YYCOPY | ( | Dst, | |
Src, | |||
Count | |||
) |
Copy COUNT objects from SRC to DST.
The source and destination do not overlap.
Definition at line 1196 of file cyacc.tab.c.
#define YYCOPY_NEEDED 1 |
Definition at line 1168 of file cyacc.tab.c.
#define yydebug c_debug |
Definition at line 71 of file cyacc.tab.c.
#define YYDPRINTF | ( | Args | ) |
Definition at line 2403 of file cyacc.tab.c.
#define YYERRCODE YYUNDEF |
Backward compatibility with an undocumented macro.
Use YYerror or YYUNDEF.
Definition at line 2392 of file cyacc.tab.c.
#define yyerrok (yyerrstatus = 0) |
Definition at line 2362 of file cyacc.tab.c.
#define yyerror c_error |
Definition at line 70 of file cyacc.tab.c.
#define YYERROR goto yyerrorlab |
Definition at line 2367 of file cyacc.tab.c.
#define YYFINAL 7 |
!YYCOPY_NEEDED
YYFINAL – State number of the termination state.
Definition at line 1209 of file cyacc.tab.c.
#define YYFPRINTF fprintf |
Enable debugging if requested.
INFRINGES ON USER NAME SPACE
Definition at line 2400 of file cyacc.tab.c.
#define YYFREE free |
INFRINGES ON USER NAME SPACE.
Definition at line 1140 of file cyacc.tab.c.
#define YYINITDEPTH 200 |
!YYDEBUG
YYINITDEPTH – initial size of the parser's stacks.
Definition at line 2524 of file cyacc.tab.c.
#define YYLAST 3204 |
#define yylex | ( | void | ) | c_lex |
Definition at line 69 of file cyacc.tab.c.
#define yylval c_lval |
Definition at line 73 of file cyacc.tab.c.
#define YYMALLOC malloc |
Definition at line 1134 of file cyacc.tab.c.
#define YYMAXDEPTH 1000000 |
Increase the parser stack to have SPEC2006/445.gobmk/owl_defendpat.c going through without a:
user warning in splitc_error: C memory exhausted near "0" at preprocessed line 13459 (user line 8732)
Definition at line 107 of file cyacc.tab.c.
#define YYMAXUTOK 373 |
#define yynerrs c_nerrs |
Definition at line 72 of file cyacc.tab.c.
#define YYNNTS 110 |
#define YYNOMEM goto yyexhaustedlab |
Definition at line 2368 of file cyacc.tab.c.
#define YYNRULES 324 |
#define YYNSTATES 597 |
#define YYNTOKENS 119 |
#define YYPACT_NINF (-445) |
Definition at line 1389 of file cyacc.tab.c.
#define yypact_value_is_default | ( | Yyn | ) | ((Yyn) == YYPACT_NINF) |
Definition at line 1391 of file cyacc.tab.c.
#define yyparse | ( | void | ) | c_parse |
------—.
Substitute the variable and function names.
| yyparse. | `-------—
Number of tokens to shift before error messages enabled.
Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere.
Their size.
The state stack: array, bottom, top.
The semantic value stack: array, bottom, top.
The return value of yyparse.
Lookahead symbol kind.
The variables used to return semantic value and location from the action routines.
The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped.
Cause a token to be read.
--------------------------------------------------------—. | yynewstate – push a new state, which is found in yystate. | `---------------------------------------------------------—
In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks.
----------------------------------------------------------------—. | yysetstate – set current state (the top of the stack) to yystate. | `-----------------------------------------------------------------—
Get the current used size of the three stacks, in elements.
defined YYSTACK_RELOCATE
Extend the stack our own way.
!defined yyoverflow && !defined YYSTACK_RELOCATE
-------—. | yybackup. | `--------—
Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one.
First try to decide what to do without reference to lookahead token.
Not known => get a lookahead token if don't already have one.
YYCHAR is either empty, or end-of-input, or a valid lookahead.
The scanner already issued an error message, process directly to error recovery. But do not keep the error token as lookahead, it is too special and may lead us to an endless loop in error recovery.
If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action.
Count tokens shifted since error; after three, turn off error status.
Shift the lookahead token.
Discard the shifted token.
-------------------------------------------------------—. | yydefault – do the default action for the current state. | `--------------------------------------------------------—
-------------------------—. | yyreduce – do a reduction. | `--------------------------—
yyn is the number of a rule to reduce with.
If YYLEN is nonzero, implement the default value of the action: '$$ = $1'.
Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized.
interpret: file TK_EOF
file: globals
To handle special case: compilation unit module
dl != NIL
A C file with comments only is OK
globals: empty
$@1: empty
globals: $@1 global globals
PRAGMA
Each variable should be declared only once. Type and initial value conflict should have been detected earlier.
The order of declarations must be preserved: a structure is declared before it is used to declare a variable
Redeclarations are possible in C as long as they are compatible
It is assumed that compatibility is checked somewhere else...
Too late for line numbers, do not use c_parser_user_warning
globals: TK_SEMICOLON globals
location: empty
global: declaration
fprintf(stderr, "declaration\n");
global: function_def
global: TK_ASM TK_LPAREN string_constant TK_RPAREN TK_SEMICOLON
global: TK_PRAGMA
$@2: empty
global: TK_IDENT TK_LPAREN $@2 old_parameter_list_ne TK_RPAREN old_pardef_list TK_SEMICOLON
global: TK_AT_TRANSFORM TK_LBRACE global TK_RBRACE TK_IDENT TK_LBRACE globals TK_RBRACE
global: TK_AT_TRANSFORMEXPR TK_LBRACE expression TK_RBRACE TK_IDENT TK_LBRACE expression TK_RBRACE
global: location error TK_SEMICOLON
id_or_typename: TK_IDENT
id_or_typename: TK_NAMED_TYPE
id_or_typename: TK_AT_NAME TK_LPAREN TK_IDENT TK_RPAREN
expression: constant
expression: TK_IDENT
Create the expression corresponding to this identifier
expression: TK_SIZEOF expression
expression: TK_SIZEOF TK_LPAREN type_name TK_RPAREN
expression: TK_ALIGNOF expression
expression: TK_ALIGNOF TK_LPAREN type_name TK_RPAREN
expression: TK_PLUS expression
expression: TK_MINUS expression
expression: TK_STAR expression
expression: TK_AND expression
expression: TK_EXCLAM expression
expression: TK_TILDE expression
expression: TK_PLUS_PLUS expression
expression: expression TK_PLUS_PLUS
expression: TK_MINUS_MINUS expression
expression: expression TK_MINUS_MINUS
expression: expression TK_ARROW id_or_typename
Find the struct/union type of the expression then the struct/union member entity and transform it to expression
expression: expression TK_DOT id_or_typename
expression: TK_LPAREN block TK_RPAREN
expression: paren_comma_expression
paren_comma_expression is a list of expressions, maybe reduced to one
expression: expression TK_LPAREN arguments TK_RPAREN
expression: TK_BUILTIN_VA_ARG TK_LPAREN expression TK_COMMA type_name TK_RPAREN
expression: expression bracket_comma_expression
expression: expression TK_QUEST opt_expression TK_COLON expression
expression: expression TK_PLUS expression
expression: expression TK_MINUS expression
expression: expression TK_STAR expression
expression: expression TK_SLASH expression
expression: expression TK_PERCENT expression
expression: expression TK_AND_AND expression
expression: expression TK_PIPE_PIPE expression
expression: expression TK_AND expression
expression: expression TK_PIPE expression
expression: expression TK_CIRC expression
expression: expression TK_EQ_EQ expression
expression: expression TK_EXCLAM_EQ expression
expression: expression TK_INF expression
expression: expression TK_SUP expression
expression: expression TK_INF_EQ expression
expression: expression TK_SUP_EQ expression
expression: expression TK_INF_INF expression
expression: expression TK_SUP_SUP expression
expression: expression TK_EQ expression
Check the left hand side expression
expression: expression TK_PLUS_EQ expression
expression: expression TK_MINUS_EQ expression
expression: expression TK_STAR_EQ expression
expression: expression TK_SLASH_EQ expression
expression: expression TK_PERCENT_EQ expression
expression: expression TK_AND_EQ expression
expression: expression TK_PIPE_EQ expression
expression: expression TK_CIRC_EQ expression
expression: expression TK_INF_INF_EQ expression
expression: expression TK_SUP_SUP_EQ expression
expression: TK_LPAREN type_name TK_RPAREN expression
expression: TK_LPAREN type_name TK_RPAREN TK_LBRACE initializer_list_opt TK_RBRACE
expression: TK_AND_AND TK_IDENT
expression: TK_AT_EXPR TK_LPAREN TK_IDENT TK_RPAREN
constant: TK_INTCON
constant: TK_FLOATCON
constant: TK_COMPLEXCON
some work left to accomodate imaginary constants
constant: TK_CHARCON
constant: string_constant
The size will be fixed later, hence 0 here.
constant: wstring_list
string_constant: string_list
Hmmm... Looks like a memory leak on all the strings...
one_string_constant: TK_STRINGCON
string_list: one_string
string_list: string_list one_string
wstring_list: TK_WSTRINGCON
wstring_list: wstring_list one_string
wstring_list: wstring_list TK_WSTRINGCON
one_string: TK_STRINGCON
one_string: TK_FUNCTION__
one_string: TK_PRETTY_FUNCTION__
init_expression: expression
fprintf(stderr, "Initialization expression: ");
print_expression(ie);
fprintf(stderr, "\n");
}
init_expression: TK_LBRACE initializer_list_opt TK_RBRACE
Deduce the size of an array by its initialization ?
initializer_list: initializer
initializer_list: initializer TK_COMMA initializer_list_opt
initializer_list_opt: empty
initializer_list_opt: initializer_list
initializer: init_designators eq_opt init_expression
initializer: gcc_init_designators init_expression
initializer: init_expression
eq_opt: TK_EQ
eq_opt: empty
init_designators: TK_DOT id_or_typename init_designators_opt
init_designators: TK_LBRACKET expression TK_RBRACKET init_designators_opt
init_designators: TK_LBRACKET expression TK_ELLIPSIS expression TK_RBRACKET
init_designators_opt: empty
init_designators_opt: init_designators
gcc_init_designators: id_or_typename TK_COLON
arguments: empty
arguments: comma_expression
opt_expression: empty
opt_expression: comma_expression
comma_expression: expression
comma_expression: expression TK_COMMA comma_expression
comma_expression: error TK_COMMA comma_expression
comma_expression_opt: empty
comma_expression_opt: comma_expression
statement_paren_comma_expression: TK_LPAREN comma_expression TK_RPAREN
statement_paren_comma_expression: TK_LPAREN error TK_RPAREN
paren_comma_expression: TK_LPAREN comma_expression TK_RPAREN
paren_comma_expression: TK_LPAREN error TK_RPAREN
bracket_comma_expression: TK_LBRACKET comma_expression TK_RBRACKET
bracket_comma_expression: TK_LBRACKET error TK_RBRACKET
$@3: empty
To avoid some parasitic line skipping after the block opening brace. May be it should be cleaner to keep this eventual line-break as a comment in the statement, for subtler user source layout representation?
statements_inside_block: TK_LBRACE $@3 local_labels block_attrs statement_list
block: statements_inside_block TK_RBRACE
block: error location TK_RBRACE
block_attrs: empty
statement_list: empty
statement_list: pragmas
statement_list: statement statement_list
statement_list: label
local_labels: empty
local_labels: TK_LABEL__ local_label_names TK_SEMICOLON local_labels
local_label_names: TK_IDENT
local_label_names: TK_IDENT TK_COMMA local_label_names
label: TK_IDENT TK_COLON
pragma: TK__Pragma TK_LPAREN string_constant TK_RPAREN
Well, indeed this has not been tested at the time of writing since the _Pragma("...") is replaced by a pragma ... in the C preprocessor, at least in gcc 4.4.
The pragma string has been strdup()ed in the lexer...
pragma: TK_PRAGMA
pragmas: pragma
Only one pragma... The common case, return it in a list
pragmas: pragma pragmas
Concatenate the pragma to the list of pragmas
statement: pragmas statement_without_pragma
Do not reallocate the strings
Reduce the CO2 impact of this code, even there is huge memory leaks everywhere around in this file:
statement: statement_without_pragma
statement_without_pragma: TK_SEMICOLON
Null statement in C is represented as continue statement in Fortran
FI: the comments should be handled at another level, so as not to repeat the same code over and over again?
statement_without_pragma: comma_expression TK_SEMICOLON
This uses the current comment and current line number.
FI: I do not know how expression_comment is supposed to work for real comma expressions
statement_without_pragma: block
statement_without_pragma: declaration
In C99 we can have a declaration anywhere!
Declaration returns a statement list. Maybe it could be changed to return only a statement? Well sometimes NIL is returned here so deeper work is required for this...
print_statements(sl);
Extract the statement from the list and free the list container:
statement_without_pragma: TK_IF statement_paren_comma_expression statement
statement_without_pragma: TK_IF statement_paren_comma_expression statement TK_ELSE statement
$@4: empty
$@5: empty
statement_without_pragma: TK_SWITCH $@4 statement_paren_comma_expression $@5 statement
$@6: empty
statement_without_pragma: TK_WHILE $@6 statement_paren_comma_expression statement
$@7: empty
statement_without_pragma: TK_DO $@7 statement TK_WHILE statement_paren_comma_expression TK_SEMICOLON
The line number and comment are related to paren_comma_expression and not to TK_DO
$@8: empty
Save the comments agregated in the for close up to now:
statement_without_pragma: for_clause opt_expression TK_SEMICOLON opt_expression TK_SEMICOLON opt_expression $@8 TK_RPAREN statement
$@9: empty
We need a new variable scope to avoid conflict names between the loop index and some previous upper declarations:
$@10: empty
Save the comments agregated in the for close up to now:
statement_without_pragma: for_clause $@9 declaration opt_expression TK_SEMICOLON opt_expression TK_RPAREN $@10 statement
statement_without_pragma: label statement
Create the statement with label comment in front of it:
pips_debug(8,"Adding label '%s' to statement:\n", $1);
print_statement($$);
}
statement_without_pragma: TK_CASE expression TK_COLON
statement_without_pragma: TK_CASE expression TK_ELLIPSIS expression TK_COLON
statement_without_pragma: TK_DEFAULT TK_COLON
statement_without_pragma: TK_RETURN TK_SEMICOLON
$$ = call_to_statement(make_call(CreateIntrinsic(C_RETURN_FUNCTION_NAME),NIL));
statement_without_pragma: TK_RETURN comma_expression TK_SEMICOLON
$$ = call_to_statement(make_call(CreateIntrinsic(C_RETURN_FUNCTION_NAME),$2));
pointers to functions, hence functions can be returned in C
FI: relationship with undeclared?
statement_without_pragma: TK_BREAK TK_SEMICOLON
statement_without_pragma: TK_CONTINUE TK_SEMICOLON
statement_without_pragma: TK_GOTO TK_IDENT TK_SEMICOLON
statement_without_pragma: TK_GOTO TK_STAR comma_expression TK_SEMICOLON
statement_without_pragma: TK_ASM asmattr TK_LPAREN string_constant asmoutputs TK_RPAREN TK_SEMICOLON
statement_without_pragma: TK_MSASM
statement_without_pragma: error location TK_SEMICOLON
$@11: empty
Number the loops in prefix depth-first:
Record the line number of thw "for" keyword:
Try to save a max of comments. The issue is that opt_expression's afterwards can reset the comments if there is a comma_expression in them. So at least preserve the commemts before the for.
Issue trigered by several examples such as validation/Semantics-New/do01.tpips
But I think now (RK, 2011/02/05 :-) ) that in a source-to-source compiler comments should appear explicitly in the parser syntax and not be dealt by some side effects in the lexer as now in PIPS with some stacks and so on.
declaration: decl_spec_list init_declarator_list TK_SEMICOLON
declaration: decl_spec_list TK_SEMICOLON
init_declarator_list: init_declarator
init_declarator_list: init_declarator TK_COMMA init_declarator_list
init_declarator: declarator
The default initial value is often zero, but not so for formal parameters or functions
init_declarator: declarator TK_EQ init_expression
Do nothing, leave the initial field of entity as it is.
Put init_expression in the initial value of entity declarator
$@12: empty
Copy may be excessive as only the scope needs to be preserved...
FI: You do not want to propagate qualifiers
How can these two problems occur since ycontext is only a copy of the ContextStack's head? Are we in the middle of a stack_push() /stack_pop()? The previous policy was to always allocate a new ycontext, regardless of the stack state
FI: a bit afraid of freeing the past type if any
A new context is entered: no longer typedef as in "typedef int f(int a)" when we hit "int a"
FI: sometimes, the scope is erased and lost
Finally, to avoid problems!
Only block scope information is inherited
FI: too primitive; we need to push and pop contexts more than to update them.
Problem with "extern f(x), g(y);". f anf g are definitvely top-level, but x and y must be searched in the current scope first.
decl_spec_list: $@12 my_decl_spec_list
my_decl_spec_list: TK_TYPEDEF decl_spec_list_opt
Add TYPEDEF_PREFIX to entity name prefix and make it a rom storage
my_decl_spec_list: TK_EXTERN decl_spec_list_opt
This can be a variable or a function, whose storage is ram or return
What is the scope in cyacc.y of this scope modification? Too much because the TOP_LEVEL scope is going to be used for argument types as well...
FI: because of C laxity about redeclarations in compilation unit, the EXTERN information should be carried by the declaration statement to be able to regenerate precise source-to-source.
my_decl_spec_list: TK_STATIC decl_spec_list_opt
my_decl_spec_list: TK_THREAD decl_spec_list_opt
Add to type variable qualifiers
my_decl_spec_list: TK_AUTO decl_spec_list_opt
Make dynamic storage for current entity
my_decl_spec_list: TK_REGISTER decl_spec_list_opt
Add to type variable qualifiers
my_decl_spec_list: type_spec decl_spec_list_opt_no_named
statement s =
make_continue_statement(entity_empty_label());
statement_declarations(s) = el;
my_decl_spec_list: TK_INLINE decl_spec_list_opt
my_decl_spec_list: attribute decl_spec_list_opt
my_decl_spec_list: TK_AT_SPECIFIER TK_LPAREN TK_IDENT TK_RPAREN
decl_spec_list_opt: empty
decl_spec_list_opt: my_decl_spec_list
decl_spec_list_opt_no_named: empty
decl_spec_list_opt_no_named: my_decl_spec_list
type_spec: TK_VOID
type_spec: TK_CHAR
type_spec: TK_SHORT
type_spec: TK_INT
type_spec: TK_INT128
type_spec: TK_UINT128
type_spec: TK_COMPLEX
Can be qualified by float, double and long double
type_spec: TK_LONG
type_spec: TK_FLOAT
type_spec: TK_DOUBLE
This secondary test is probably useless. See the case of TK_COMPLEX.
FI: we should probably have a user or internal error here since we ignore the beginning of the type declaration
type_spec: TK_SIGNED
see the IR document or ri-util.h for explanation
type_spec: TK_UNSIGNED
type_spec: TK_STRUCT id_or_typename
Find the entity associated to the struct, current scope can be [file%][module:][block]
Specify the type of the variable that follows this declaration specifier
To handle mesa.c (SPEC 2000 benchmark) We have struct HashTable in a file, but do not know its structure and scope, because it is declared in other file
Declaration statement "struct s;" disappears with $$ = NIL... See for instance decl68.c. A place holder variable is added, just in case.
This may be useless, but will be fixed by make_declarations_statement()
$@13: empty
type_spec: TK_STRUCT id_or_typename TK_LBRACE $@13 struct_decl_list TK_RBRACE
field list, which may also contain nested derived entities
Create the struct entity
Record the declaration of the struct entity
Specify the type of the variable that follows this declaration specifier
Take from $5 the struct/union entities
Fields do not need to appear in the declaration list, but they are used later to decide which derived entities are defined and which ones are used.
$@14: empty
type_spec: TK_STRUCT TK_LBRACE $@14 struct_decl_list TK_RBRACE
Create the struct entity with unique name s
Take from el the struct/union entities
type_spec: TK_UNION id_or_typename
Find the entity associated to the union, current scope can be [file%][module:][block]
Specify the type of the variable that follows this declaration specifier
This may be useless, but will be fixed by make_declarations_statement()
$@15: empty
type_spec: TK_UNION id_or_typename TK_LBRACE $@15 struct_decl_list TK_RBRACE
Take from $5 the indirectly declared struct/union entities as in "struct {struct ... ".
$@16: empty
type_spec: TK_UNION TK_LBRACE $@16 struct_decl_list TK_RBRACE
Create the union entity with unique name
Take from $4 the struct/union entities
type_spec: TK_ENUM id_or_typename
Find the entity associated to the enum
Specify the type of the variable that follows this declaration specifier
FI: What should the initial value be?
This happens with the old style function declaration at least
Oops, we have to assume that the enum is also defined in the compilation unit... else it would be useless.
This may be useless, but will be fixed by make_declarations_statement()
type_spec: TK_ENUM id_or_typename TK_LBRACE enum_list maybecomma TK_RBRACE
Create the enum entity
type_spec: TK_ENUM TK_LBRACE enum_list maybecomma TK_RBRACE
Create the enum entity with unique name
type_spec: TK_NAMED_TYPE
Specify the type of the variable that follows this declaration specifier
typedef T1 T2 => the type of T2 will be that of T1
T1 var => the type of var is basic typedef
type_spec: TK_TYPEOF TK_LPAREN expression TK_RPAREN
type_spec: TK_TYPEOF TK_LPAREN type_name TK_RPAREN
struct_decl_list: empty
struct_decl_list: decl_spec_list TK_SEMICOLON struct_decl_list
Create the struct member entity with unique name, the name of the struct/union is added to the member name prefix
Temporally put the list of struct/union entities defined in $1 to initial value of ent. FI: where is it retrieved? in TakeDerivedEntities()?
$@17: empty
Add struct/union name and MEMBER_SEP_STRING to entity name
struct_decl_list: decl_spec_list $@17 field_decl_list TK_SEMICOLON struct_decl_list
Update the entity in field_decl_list with final type, storage, initial value
Create the list of member entities
This code is not good ... I have problem with the global variable ycontext and recursion: ycontext is crushed when this decl_spec_list in struct_decl_list is entered, so the scope and storage of the new context are given to the old context, before it is pushed in the stack.
For the moment, I reset the changed values of the context, by hoping that in C, before a STRUCT/UNION declaration, there is no extern, ...
struct_decl_list: error TK_SEMICOLON struct_decl_list
field_decl_list: field_decl
field_decl_list: field_decl TK_COMMA field_decl_list
field_decl: declarator
For debugging...
It's probably the last place where you can use the qualifier from the context to update the type of e when e is a pointer.
FI: Well, this piece of code may be fully useless because t or pt is always undefined.
FI: because of the above assert, the next statement could be simplified
field_decl: declarator TK_COLON expression
ips_assert("Width of bit-field must be a positive constant integer", integer_constant_expression_p($3));
Ignore for this moment if the bit is signed or unsigned
field_decl: TK_COLON expression
Unnamed bit-field : special and unique name
pips_assert("Width of bit-field must be a positive constant integer", integer_constant_expression_p($2));
enum_list: enumerator
initial_value = 0 or $3
enum_list: enum_list TK_COMMA enumerator
Attention to the reverse recursive definition
enum_list: enum_list TK_COMMA error
enumerator: TK_IDENT
Create an entity of is_basic_int, storage rom initial_value = 0 if it is the first member initial_value = intial_value(precedessor) + 1
No need to add current struct/union/enum name to the name's scope of the member entity for ENUM, as in the case of STRUCT and UNION
The information is not yet available, but I need to recognize this entity as symbolic for next rule
entity_initial(ent) = MakeEnumeratorInitialValue(enum_list,enum_counter);
enumerator: TK_IDENT TK_EQ expression
Create an entity of is_basic_int, storage rom, initial_value = $3
No, enum member must be functional entity, just like Fortran's parameters
Error or reference to a previous member of the same enum (enum04.c)
FI: it might be easier to delay systematically the evaluation
Let's try to delay evaluation anyway (enum05.c)
declarator: pointer_opt direct_decl attributes_with_asm
Update the type of the direct_decl entity with pointer_opt and attributes
direct_decl: id_or_typename
FI: A variable cannot be redeclared within the same scope, but this is not checked yet.
Initialize the type stack and push the type of found/created entity to the stack. It can be undefined if the entity has not been parsed, or a given type which is used later to check if the declarations are the same for one entity. This stack is put temporarily in the storage of the entity, not a global variable for each declarator to avoid being erased by recursion (FI: this last sentence seems to be wrong)
e has already been defined since a type stack is associated to it. At least, if the mapping from entity to type stack is well managed. Since entities are sometimes destroyed, a new entity might end up with the same memory address and hence the same type stack.
A function can be redeclared inside itself. see C_syntax/extern.c
Dummy parameters can also be redeclared as long as their types are equal
direct_decl: TK_LPAREN attributes declarator TK_RPAREN
Add attributes such as const, restrict, ... to variable's qualifiers
direct_decl: direct_decl TK_LBRACKET attributes comma_expression_opt TK_RBRACKET
This is the last dimension of an array (i.e a[1][2][3] => [3]). Questions:
direct_decl: direct_decl TK_LBRACKET attributes error TK_RBRACKET
$@18: empty
Well, here it can be a function or a pointer to a function
If it is a pointer, its value is going to be "unknown" or "expression"; if it is a function, its value is going to be "code". If the value cannot stay undefined, it should be made unknown...
direct_decl: direct_decl parameter_list_startscope $@18 rest_par_list TK_RPAREN
Intrinsic functions in C such as printf, fprintf, ... are considered as entities with functional type ??? if (!intrinsic_entity_p(e))
e can be a function or a pointer to a function. The information is available somewhere in the stacks...
No need to declare C user functions extern in a compilation unit; they are global or local.
Too early: pointers to functions are still seen as functions here. Let's delay
parameter_list_startscope: TK_LPAREN
rest_par_list: empty
rest_par_list: parameter_decl rest_par_list1
rest_par_list1: empty
$@19: empty
rest_par_list1: TK_COMMA $@19 TK_ELLIPSIS
$ = CONS(PARAMETER,make_parameter(make_type_varargs(type_undefined), make_mode(CurrentMode,UU), make_dummy_unknown()),NIL);
$@20: empty
rest_par_list1: TK_COMMA $@20 parameter_decl rest_par_list1
parameter_decl: decl_spec_list declarator
Set CurentMode where ????
parameter_decl: decl_spec_list abstract_decl
parameter_decl: decl_spec_list
function prototype
parameter_decl: TK_LPAREN parameter_decl TK_RPAREN
old_proto_decl: pointer_opt direct_old_proto_decl
$@21: empty
direct_old_proto_decl: direct_decl TK_LPAREN $@21 old_parameter_list_ne TK_RPAREN old_pardef_list
old_parameter_list_ne: TK_IDENT
old_parameter_list_ne: TK_IDENT TK_COMMA old_parameter_list_ne
old_pardef_list: empty
old_pardef_list: decl_spec_list old_pardef TK_SEMICOLON TK_ELLIPSIS
Can we have struct/union definition in $1 ?
$ = gen_nconc($1,$2);
old_pardef_list: decl_spec_list old_pardef TK_SEMICOLON old_pardef_list
Rule used for C_syntax/activate.c, decl33.c and adi.c. CreateReturnEntity() only useful for activate.c
Can we have struct/union definition in $1 ?
$ = gen_nconc($1,gen_nconc(el,$4));
old_pardef: declarator
old_pardef: declarator TK_COMMA old_pardef
old_pardef: error
pointer: TK_STAR attributes pointer_opt
decl24.c, decl50.c, decl51.c, decl52.c, decl53.c : const attribute lost or misplaced for pointers
pointer_opt: empty
pointer_opt: pointer
type_name: decl_spec_list abstract_decl
type_name: decl_spec_list
abstract_decl: pointer_opt abs_direct_decl attributes
Update the type of the direct_decl entity with pointer_opt and attributes
abstract_decl: pointer
Initialize the type stack and push the type of found/created entity to the stack. It can be undefined if the entity has not been parsed, or a given type which is used later to check if the declarations are the same for one entity. This stack is put temporarily in the storage of the entity, not a global variable for each declarator to avoid being erased by recursion
ntity_type($$) = type_undefined;
abs_direct_decl: TK_LPAREN attributes abstract_decl TK_RPAREN
abs_direct_decl: TK_LPAREN error TK_RPAREN
abs_direct_decl: abs_direct_decl_opt TK_LBRACKET comma_expression_opt TK_RBRACKET
$@22: empty
abs_direct_decl: abs_direct_decl_opt parameter_list_startscope $@22 rest_par_list TK_RPAREN
abs_direct_decl_opt: abs_direct_decl
abs_direct_decl_opt: empty
$@23: empty
function_def: function_def_start $@23 block
Make value_code for current module here
Let's delay this? ResetCurrentModule();
function_def_start: decl_spec_list declarator
function_def_start: decl_spec_list old_proto_decl
$@24: empty
function_def_start: TK_IDENT parameter_list_startscope $@24 rest_par_list TK_RPAREN
Functional type is unknown or int (by default) or void ?
$@25: empty
function_def_start: TK_IDENT TK_LPAREN old_parameter_list_ne $@25 TK_RPAREN old_pardef_list
attributes: empty
attributes: attribute attributes
attributes_with_asm: empty
attributes_with_asm: attribute attributes_with_asm
attributes_with_asm: TK_ASM TK_LPAREN string_constant TK_RPAREN attributes
attribute: TK_MSATTR
attribute: TK_CONST
attribute: TK_RESTRICT
attribute: TK_VOLATILE
attribute: TK_STATIC_DIMENSION
asmattr: empty
asmattr: TK_VOLATILE asmattr
asmattr: TK_CONST asmattr
asmoutputs: empty
asmoutputs: TK_COLON asmoperands asminputs
asmoperands: empty
asmoperands: asmoperandsne
asmoperandsne: asmoperand
asmoperandsne: asmoperandsne TK_COMMA asmoperand
asmoperand: string_constant TK_LPAREN expression TK_RPAREN
asmoperand: string_constant TK_LPAREN error TK_RPAREN
asminputs: empty
asminputs: TK_COLON asmoperands asmclobber
asmclobber: empty
asmclobber: TK_COLON asmcloberlst_ne
asmcloberlst_ne: one_string_constant
asmcloberlst_ne: one_string_constant TK_COMMA asmcloberlst_ne
User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated.
Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by.
----------------------------------—. | yyerrlab – here on detecting error. | `-----------------------------------—
Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary.
If not already recovering from an error, report this error.
If just tried and failed to reuse lookahead token after an error, discard it.
Return failure if at end of input.
Else will try to reuse lookahead token after shifting the error token.
-----------------------------------------------—. | yyerrorlab – error raised explicitly by YYERROR. | `------------------------------------------------—
Pacify compilers when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code.
Do not reclaim the symbols of the rule whose action triggered this YYERROR.
---------------------------------------------------------—. | yyerrlab1 – common code for both syntax error and YYERROR. | `----------------------------------------------------------—
Each real token shifted decrements this.
Pop stack until we find a state that shifts the error token.
Pop the current state because it cannot handle the error token.
Shift the error token.
---------------------------------—. | yyacceptlab – YYACCEPT comes here. | `----------------------------------—
-------------------------------—. | yyabortlab – YYABORT comes here. | `--------------------------------—
-------------------------------------------------------—. | yyexhaustedlab – YYNOMEM (memory exhaustion) comes here. | `--------------------------------------------------------—
------------------------------------------------------—. | yyreturnlab – parsing is finished, clean up and return. | `-------------------------------------------------------—
Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary.
Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT.
Definition at line 68 of file cyacc.tab.c.
#define YYPOPSTACK | ( | N | ) | (yyvsp -= (N), yyssp -= (N)) |
#define YYPTRDIFF_MAXIMUM LONG_MAX |
Definition at line 973 of file cyacc.tab.c.
#define YYPTRDIFF_T long |
Definition at line 972 of file cyacc.tab.c.
#define YYPULL 1 |
#define YYPURE 0 |
#define YYPUSH 0 |
#define YYRECOVERING | ( | ) | (!!yyerrstatus) |
Definition at line 2371 of file cyacc.tab.c.
#define YYSIZE_MAXIMUM |
Definition at line 990 of file cyacc.tab.c.
#define YYSIZE_T unsigned |
Definition at line 986 of file cyacc.tab.c.
#define YYSIZEOF | ( | X | ) | YY_CAST (YYPTRDIFF_T, sizeof (X)) |
Definition at line 996 of file cyacc.tab.c.
#define YYSKELETON_NAME "yacc.c" |
#define YYSTACK_ALLOC YYMALLOC |
The parser invokes alloca or malloc; define the necessary symbols.
Definition at line 1120 of file cyacc.tab.c.
#define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
Definition at line 1123 of file cyacc.tab.c.
#define YYSTACK_BYTES | ( | N | ) |
The size of an array large to enough to hold all stacks, each with N elements.
Definition at line 1164 of file cyacc.tab.c.
#define YYSTACK_FREE YYFREE |
Definition at line 1121 of file cyacc.tab.c.
The size of the maximum gap between one aligned stack and the next.
Definition at line 1160 of file cyacc.tab.c.
#define YYSTACK_RELOCATE | ( | Stack_alloc, | |
Stack | |||
) |
Relocate STACK from its old location to the new one.
The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack.
Definition at line 1175 of file cyacc.tab.c.
#define YYTABLE_NINF (-299) |
Definition at line 1394 of file cyacc.tab.c.
#define yytable_value_is_error | ( | Yyn | ) | 0 |
Definition at line 1396 of file cyacc.tab.c.
#define YYTRANSLATE | ( | YYX | ) |
YYTRANSLATE(TOKEN-NUM) – Symbol number corresponding to TOKEN-NUM as returned by yylex, with out-of-bounds checking.
Definition at line 1228 of file cyacc.tab.c.
typedef int yy_state_fast_t |
typedef yytype_int16 yy_state_t |
Stored state numbers (used for stacks).
Definition at line 1000 of file cyacc.tab.c.
typedef enum yysymbol_kind_t yysymbol_kind_t |
Definition at line 619 of file cyacc.tab.c.
typedef short yytype_int16 |
Definition at line 924 of file cyacc.tab.c.
typedef signed char yytype_int8 |
On compilers that do not define PTRDIFF_MAX etc., make sure <limits.h> and (if available) <stdint.h> are included so that the code can choose integer types of a good width.
INFRINGES ON USER NAME SPACE Narrow types that promote to a signed type and that can represent a signed or unsigned integer of at least N bits. In tables they can save space and decrease cache pressure. Promoting to a signed type helps avoid bugs in integer arithmetic.
Definition at line 916 of file cyacc.tab.c.
typedef unsigned short yytype_uint16 |
Definition at line 956 of file cyacc.tab.c.
typedef unsigned char yytype_uint8 |
Work around bug in HP-UX 11.23, which defines these macros incorrectly for preprocessor constants.
This workaround can likely be removed in 2023, as HPE has promised support for HP-UX 11.23 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf.
Definition at line 945 of file cyacc.tab.c.
anonymous enum |
enum yysymbol_kind_t |
Symbol kind.
Definition at line 652 of file cyacc.tab.c.
|
static |
init_p = 0 => no initialization for a variable or no definition for a derived entity (struct, union, maybe enum)
Definition at line 124 of file cyacc.tab.c.
References CONS, EXPRESSION, initialization_expressions, and int_to_expression().
int c_parser_number_of_scopes | ( | void | ) |
Definition at line 587 of file cyacc.tab.c.
References c_parser_scope_stack, and stack_size().
Referenced by is_c_parser_keyword_typedef().
bool c_parser_scope_stack_empty_p | ( | void | ) |
Definition at line 564 of file cyacc.tab.c.
References c_parser_scope_stack, and stack_empty_p().
Referenced by get_c_parser_current_scope().
c_parser_context CreateDefaultContext | ( | void | ) |
Definition at line 292 of file cyacc.tab.c.
References empty_scope(), make_c_parser_context(), NIL, pips_debug, storage_undefined, and type_undefined.
Referenced by EnterScope().
|
static |
Definition at line 311 of file cyacc.tab.c.
References BLOCK_SEP_STRING, c_parser_context_qualifiers, c_parser_context_scope, c_parser_context_storage, c_parser_context_undefined_p, C_scope_identifier, concatenate(), ContextStack, CreateDefaultContext(), ENDP, free(), int2a(), pips_assert, pips_debug, push_new_c_parser_scope(), stack_empty_p(), stack_head(), stack_push(), stf(), storage_undefined_p, strdup(), string_block_scope_p(), string_undefined, and string_undefined_p.
void ExitScope | ( | void | ) |
Definition at line 400 of file cyacc.tab.c.
References c_parser_context_qualifiers, c_parser_context_scope, c_parser_context_storage, c_parser_context_undefined_p, ContextStack, ENDP, free_c_parser_context(), pips_assert, pips_debug, pop_c_parser_scope_stack(), stack_empty_p(), stack_head(), stack_pop(), storage_undefined_p, and string_undefined_p.
flushes all expression comments and add them to statement s
Definition at line 182 of file cyacc.tab.c.
References asprintf, empty_comments_p(), expression_comment, expression_line_number, free(), statement_comments, statement_number, STATEMENT_NUMBER_UNDEFINED, and string_undefined.
Referenced by flush_statement_comment().
flushes all statement comments and add them to statement s
Definition at line 211 of file cyacc.tab.c.
References all_expression_comments_as_statement_comments, asprintf, empty_comments_p(), ENDP, flush_expression_comment(), FOREACH, free(), gen_free_list(), gen_nreverse(), list_to_string(), NIL, pips_assert, statement_block_p, statement_comments, and STRING.
void force_reset_c_parser_scope_stack | ( | void | ) |
To be used by an error handler.
Definition at line 539 of file cyacc.tab.c.
References c_parser_scope_number, c_parser_scope_stack, SCOPE_UNDEFINED, stack_free(), and stack_undefined.
Referenced by c_parser_error().
void free | ( | void * | ) |
Referenced by EnterScope(), flush_expression_comment(), flush_statement_comment(), and reset_expression_comment().
string get_c_parser_current_scope | ( | void | ) |
Definition at line 569 of file cyacc.tab.c.
References c_parser_scope_stack, c_parser_scope_stack_empty_p(), stack_head(), and string_undefined.
Referenced by c_parser_put_new_typedef(), and is_c_parser_keyword_typedef().
Definition at line 581 of file cyacc.tab.c.
References c_parser_scope_stack, and stack_nth().
Referenced by is_c_parser_keyword_typedef().
int get_declaration_counter | ( | void | ) |
Definition at line 497 of file cyacc.tab.c.
References declaration_counter.
Referenced by set_current_dummy_parameter_number().
c_parser_context GetContext | ( | void | ) |
Definition at line 458 of file cyacc.tab.c.
References c_parser_context_undefined, ContextStack, pips_debug, pips_internal_error, stack_empty_p(), stack_head(), and stack_size().
Referenced by FindOrCreateCurrentEntity().
c_parser_context GetContextCopy | ( | void | ) |
Definition at line 476 of file cyacc.tab.c.
References c_parser_context_scope, ContextStack, copy_c_parser_context(), pips_debug, stack_head(), and stack_size().
|
static |
The list spine is going to be reused by the caller. No need to free.
Definition at line 610 of file cyacc.tab.c.
References internal_derived_entity_declarations, and NIL.
entity GetFunction | ( | void | ) |
cproto workaround
from "cyacc.y"
Definition at line 146 of file cyacc.tab.c.
References f(), FunctionStack, and stack_head().
string GetParentScope | ( | void | ) |
Definition at line 387 of file cyacc.tab.c.
References c_parser_context_scope, ContextStack, stack_empty_p(), stack_nth(), and stack_size().
Referenced by FindEntityFromLocalNameAndPrefix().
string GetScope | ( | void | ) |
FI: I do not know if it wouldn't be better to initialize the ContextStack with a default context before calling the C parser
Definition at line 371 of file cyacc.tab.c.
References c_parser_context_scope, ContextStack, stack_empty_p(), and stack_head().
Referenced by CreateEntityFromLocalNameAndPrefix(), CreateMemberScope(), and FindEntityFromLocalNameAndPrefix().
void init_c_parser_scope_stack | ( | void | ) |
Definition at line 514 of file cyacc.tab.c.
References c_parser_scope_number, c_parser_scope_stack, pips_assert, stack_make(), stack_undefined_p, and string_domain.
Referenced by actual_c_parser().
void InitScope | ( | void | ) |
Definition at line 306 of file cyacc.tab.c.
References C_scope_identifier.
Referenced by actual_c_parser().
void* malloc | ( | YYSIZE_T | ) |
The scope is moved up the scope tree and a NULL is return when there are no more scope to explore.
get rid of last block separator
old_scope | ld_scope |
Definition at line 235 of file cyacc.tab.c.
References BLOCK_SEP_CHAR, pips_assert, pips_debug, string_block_scope_p(), and string_undefined.
Referenced by FindEntityFromLocalNameAndPrefixAndScope(), and FindOrCreateEntityFromLocalNameAndPrefixAndScope().
void pop_c_parser_scope_stack | ( | void | ) |
Definition at line 558 of file cyacc.tab.c.
References c_parser_scope_stack, and stack_pop().
Referenced by ExitScope().
void PopContext | ( | void | ) |
Definition at line 441 of file cyacc.tab.c.
References c_parser_context_scope, ContextStack, pips_debug, stack_empty_p(), stack_head(), stack_pop(), and stack_size().
|
static |
Definition at line 141 of file cyacc.tab.c.
References FunctionStack, and stack_pop().
void push_new_c_parser_scope | ( | void | ) |
Definition at line 549 of file cyacc.tab.c.
References asprintf, c_parser_scope_number, c_parser_scope_stack, stack_push(), and string_undefined.
Referenced by EnterScope().
void PushContext | ( | c_parser_context | c | ) |
Definition at line 434 of file cyacc.tab.c.
References c_parser_context_scope, ContextStack, pips_debug, stack_push(), and stack_size().
|
static |
The following structures must be stacks because all the related entities are in recursive structures.
Since there are not stacks with basic types such as integer or logical domain, I used basic_domain to avoid creating special stacks for FormalStack, OffsetStack, ...
Definition at line 136 of file cyacc.tab.c.
References f(), FunctionStack, and stack_push().
|
static |
Definition at line 603 of file cyacc.tab.c.
References CONS, ENTITY, gen_nconc(), internal_derived_entity_declarations, and NIL.
void reset_c_parser_scope_stack | ( | void | ) |
Definition at line 522 of file cyacc.tab.c.
References c_parser_scope_number, c_parser_scope_stack, pips_user_warning, SCOPE_UNDEFINED, stack_empty_p(), stack_free(), and stack_undefined.
Referenced by actual_c_parser().
void reset_declaration_counter | ( | void | ) |
Definition at line 492 of file cyacc.tab.c.
References declaration_counter.
Referenced by actual_c_parser(), and c_parser_error().
void reset_expression_comment | ( | void | ) |
we don't want an expression comment with new lines, it is disgracefull
Too bad. This should not happen, but it happens with comma expressions in header files
Definition at line 169 of file cyacc.tab.c.
References expression_comment, expression_line_number, free(), STATEMENT_NUMBER_UNDEFINED, string_undefined, and string_undefined_p.
Referenced by actual_c_parser(), and c_parser_error().
|
static |
Definition at line 619 of file cyacc.tab.c.
References ENDP, gen_free_list(), internal_derived_entity_declarations, and NIL.
|
static |
Definition at line 203 of file cyacc.tab.c.
References all_expression_comments_as_statement_comments, CONS, expression_comment, STRING, string_undefined, and string_undefined_p.
Allocate a new string containing only block scope information.
full_scope | ull_scope |
Definition at line 268 of file cyacc.tab.c.
References BLOCK_SEP_CHAR, gen_strndup0(), MODULE_SEP, pips_assert, pips_debug, strdup(), string_block_scope_p(), and string_undefined.
Referenced by constant_memory_access_path_to_location_name(), CreateEntityFromLocalNameAndPrefix(), CreateMemberScope(), FindEntityFromLocalNameAndPrefix(), and FindOrCreateCurrentEntity().
int ScopeStackSize | ( | void | ) |
Definition at line 366 of file cyacc.tab.c.
References ContextStack, and stack_size().
Referenced by FindEntityFromLocalNameAndPrefix().
|
static |
--------------------------------------------—.
| Report that the YYRULE is going to be reduced. | `---------------------------------------------—
The symbols being reduced.
Definition at line 2486 of file cyacc.tab.c.
References YY_ACCESSING_SYMBOL, yy_symbol_print(), YYFPRINTF, yyr2, and yyrline.
|
static |
--------------------------------------------------------------—.
| yy_stack_print – Print the state stack from its BOTTOM up to its | | TOP (included). | `---------------------------------------------------------------—
Definition at line 2463 of file cyacc.tab.c.
References YYFPRINTF.
|
static |
-----------------------—.
| Print this symbol on YYO. | `------------------------—
Definition at line 2447 of file cyacc.tab.c.
References yy_symbol_value_print(), YYFPRINTF, YYNTOKENS, and yysymbol_name().
Referenced by yy_reduce_print().
|
static |
-------------------------------—.
| Print this symbol's value on YYO. | `--------------------------------—
Definition at line 2429 of file cyacc.tab.c.
References YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN, YY_IGNORE_MAYBE_UNINITIALIZED_END, and YY_USE.
Referenced by yy_symbol_print().
|
static |
YYMAXDEPTH – maximum size the stacks can grow to (effective only if the built-in stack extension method is used).
Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic.
-------------------------------------------—. | Release the memory associated to this symbol. | `--------------------------------------------—
Definition at line 2548 of file cyacc.tab.c.
References YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN, YY_IGNORE_MAYBE_UNINITIALIZED_END, YY_SYMBOL_PRINT, and YY_USE.
|
static |
The user-facing name of the symbol whose (internal) number is YYSYMBOL.
No bounds checking.
Definition at line 1383 of file cyacc.tab.c.
References yytname.
Referenced by yy_symbol_print().
|
static |
to create temporary entities for abstract types
Definition at line 118 of file cyacc.tab.c.
after a while (crocodile) expression comments are pushed into a list that is purged upon call to add_expression_comment
Definition at line 202 of file cyacc.tab.c.
Referenced by flush_statement_comment(), and save_expression_comment_as_statement_comment().
|
static |
Definition at line 511 of file cyacc.tab.c.
Referenced by force_reset_c_parser_scope_stack(), init_c_parser_scope_stack(), push_new_c_parser_scope(), and reset_c_parser_scope_stack().
|
static |
Definition at line 512 of file cyacc.tab.c.
Referenced by c_parser_number_of_scopes(), c_parser_scope_stack_empty_p(), force_reset_c_parser_scope_stack(), get_c_parser_current_scope(), get_c_parser_nth_scope(), init_c_parser_scope_stack(), pop_c_parser_scope_stack(), push_new_c_parser_scope(), and reset_c_parser_scope_stack().
|
static |
Definition at line 304 of file cyacc.tab.c.
Referenced by EnterScope(), and InitScope().
|
static |
to know the mode of the formal parameter: by value or by reference
Definition at line 114 of file cyacc.tab.c.
|
static |
Declaration counter.
It is used to declare the formal parameters in function declarations.
Definition at line 490 of file cyacc.tab.c.
Referenced by get_declaration_counter(), and reset_declaration_counter().
|
static |
to compute the enumerator value: val(i) = val(i-1) + 1
Definition at line 117 of file cyacc.tab.c.
|
static |
FI: these two variables are used in conjunction with comma expressions.
I do not remember why they are needed. They sometimes stay set although they have become useless. The parser used not to reset them systematically, which caused problems with io_intrinsics*.c
Definition at line 165 of file cyacc.tab.c.
Referenced by flush_expression_comment(), reset_expression_comment(), and save_expression_comment_as_statement_comment().
|
static |
Definition at line 166 of file cyacc.tab.c.
Referenced by flush_expression_comment(), and reset_expression_comment().
to preserve information about the declarations for the prettyprinter, especially for the global variables, but also the derived types (struct, union, enum).
Definition at line 120 of file cyacc.tab.c.
Referenced by add_initialization_expression(), and add_prettyprint_control_list_to_declaration_statement().
When struct and union declarations are nested, the rules cannot return information about the internal declarations because they must return type information.
Hence internal declarations must be recorded and re-used when the final continue/declaration statement is generated. In order not to confuse the prettyprinter, they must appear first in the declaration list, that is in the innermost to outermost order.
Definition at line 601 of file cyacc.tab.c.
Referenced by GetDerivedEntityDeclarations(), RecordDerivedEntityDeclaration(), and ResetDerivedEntityDeclarations().
to know if the variable is declared inside or outside a function, so its scope is the current function or the compilation unit or TOP-LEVEL
Definition at line 115 of file cyacc.tab.c.
Referenced by CreateEntityFromLocalNameAndPrefix(), CreateMemberScope(), FindOrCreateCurrentEntity(), FindOrCreateEntityFromLocalNameAndPrefix(), FindOrCreateEntityFromLocalNameAndPrefixAndScope(), MakeDerivedEntity(), MakeStorageRam(), UpdateEntities(), and UpdateEntity().
|
static |
Definition at line 157 of file cyacc.tab.c.
int yychar |
|
static |
Definition at line 1892 of file cyacc.tab.c.
int yydebug |
Nonzero means print parse trace.
It is left uninitialized so that multiple parsers can coexist.
Definition at line 2513 of file cyacc.tab.c.
|
static |
YYDEFACT[STATE-NUM] – Default reduction number in state STATE-NUM.
Performed when YYTABLE does not specify something else to do. Zero means the default is an error.
Definition at line 1468 of file cyacc.tab.c.
|
static |
YYDEFGOTO[NTERM-NUM].
Definition at line 1549 of file cyacc.tab.c.
YYSTYPE yylval |
int yynerrs |
|
static |
YYPACT[STATE-NUM] – Index in YYTABLE of the portion describing STATE-NUM.
Definition at line 1401 of file cyacc.tab.c.
|
static |
YYPGOTO[NTERM-NUM].
Definition at line 1533 of file cyacc.tab.c.
|
static |
YYR1[RULE-NUM] – Symbol kind of the left-hand side of rule RULE-NUM.
Definition at line 2284 of file cyacc.tab.c.
|
static |
YYR2[RULE-NUM] – Number of symbols on the right-hand side of rule RULE-NUM.
Definition at line 2322 of file cyacc.tab.c.
Referenced by yy_reduce_print().
|
static |
YYRLINE[YYN] – Source line where rule number YYN was defined.
Definition at line 1279 of file cyacc.tab.c.
Referenced by yy_reduce_print().
|
static |
YYSTOS[STATE-NUM] – The symbol kind of the accessing symbol of state STATE-NUM.
Definition at line 2219 of file cyacc.tab.c.
|
static |
YYTABLE[YYPACT[STATE-NUM]] – What to do in state STATE-NUM.
If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error.
Definition at line 1567 of file cyacc.tab.c.
|
static |
YYTNAME[SYMBOL-NUM] – String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals.
Definition at line 1327 of file cyacc.tab.c.
Referenced by yysymbol_name().
|
static |
YYTRANSLATE[TOKEN-NUM] – Symbol number corresponding to TOKEN-NUM as returned by yylex.
Definition at line 1235 of file cyacc.tab.c.