[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: parser stack overflow, bug in glr??
From: |
Roger Casaponsa |
Subject: |
Re: parser stack overflow, bug in glr?? |
Date: |
Wed, 20 Jul 2005 05:15:39 +0200 |
User-agent: |
Mozilla Thunderbird 1.0.2 (X11/20050419) |
>>In some inputs, not that big, I've got a parser stack overflow error.
>>
>>
>
>Alas, there's not a lot we can do to fix this problem without the
>example (grammar + input) that caused the problem.
>
>
>
Here is a "reduced" grammar, it is like a c++ declarations. In this
"reduced" grammar it's possible to declare functions and variables like
a a::b(){}
a c;
and only this. This is the input for the test.
looking at stderr output from bison (attached file stderr)
befor there are only stack 0 and stack 1
in line 325 :
Stack 0 Entering state 3
Reduced stack 0 by rule #9; action deferred. Now in state 2.
Stack 0 Entering state 2
Reading a token: Next token is token IDENTIFIER ()
Splitting off stack 2 from 0.
then splits more stacks from stack 0 and stack 2 and shift the token
IDENTIFIER in this stacks
after that in line 348
Stack 1 Entering state 40
Reduced stack 1 by rule #24; action deferred. Now in state 8.
Stack 1 Entering state 8
Reduced stack 1 by rule #12; action deferred. Now in state 3.
Stack 1 Entering state 3
Reduced stack 1 by rule #9; action deferred. Now in state 2.
Merging stack 1 into stack 0.
Removing dead stacks.
here merges stack 1 into 0 in state 2, before splitting it (stack 0).
I don't know what files you need. I attach all the files, sorry if it's
too much.
>>-Doesn't Bison really empty the stacks until it comes back to
>>deterministic
>> operation while working with glr?
>>
>>
>
>If you are asking whether it essentially releases stack space when it
>returns to deterministic operation, then yes, you understand
>correctly.
>
>P. Hilfinger
>
>
>
Thanks for all.
Roger
CFLAGS= -I. -Wall -g -O0
FFLAGS=
BFLAGS= --verbose --yacc --defines --debug --report=all
#CFILES= y.tab.c ast.c mcc.c support/hash.c ast_utils.c symtab.c
support/ast_iterator.c support/iterator.c support/list.c
support/list_iterator.c support/ast_preorder_iterator.c tpl.c
support/hash_iterator.c support/file.c
CFILES= y.tab.c ast.c ast_utils.c #c++98.c
OFILES=$(CFILES:%.c=%.o)
all: c98
.c.o:
gcc -g $(CFLAGS) -o $@ -c $<
c98: $(OFILES)
gcc -g -g3 -o c++98 $(OFILES)
lex.yy.c: c++98.l
flex $(FFLAGS) c++98.l
y.tab.c: lex.yy.c c++98.y
bison $(BFLAGS) c++98.y
clean:
rm -f $(OFILES)
rm -f y.tab.h y.tab.c y.output
rm -f lex.yy.c
rm -f *~
# DO NOT DELETE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <strings.h>
#include "ast.h"
typedef struct {
char *name;
} ast_table_t;
ast_table_t ast_table[] = {
{"NNULL"},
{"NJoin"},
/* cpp */
/* Lexical Conventions A.4 */
{"NIdentifier"},
/* Expressions A.4 */
{"NUnqualified_id"},
{"NQualified_id"},
{"NQua_unqualified"},
{"NQua_id"},
{"NNested_name_specifier"},
/* Declarations A.6 */
{"NDeclaration"},
{"NSimple_declaration"},
{"NSimple_type_specifier"},
/* Declarators A.7 */
{"NDeclarator_func"},
{"NDeclarator_id_typename"},
{"NDeclarator_id"},
{"NFunction_definition_ctor"},
/* Classes A.8 */
{"NClass_name"},
/* others */
{"NDos_dos_punts"},
{"NAmbig"},
{"NAmbig_join"}
};
AST ASTMake(node_t type, AST son0, AST son1, AST son2, AST son3, int line, char
* text)
{
AST s = (AST) malloc(sizeof(*s));
bzero (s, sizeof (*s));
s->type = type;
s->line = line;
s->text = text;
s->no_nodes = 0;
s->id = identificador_node_ast;
identificador_node_ast++;
if ( son0 ) {
ASTSon0 (s) = son0;
ASTParent (son0) = s;
s->no_nodes++;
}
if ( son1 ) {
ASTSon1 (s) = son1;
ASTParent (son1) = s;
s->no_nodes++;
}
if ( son2 ) {
ASTSon2 (s) = son2;
ASTParent (son2) = s;
s->no_nodes++;
}
if ( son3 ) {
ASTSon3 (s) = son3;
ASTParent (son3) = s;
s->no_nodes++;
}
return(s);
}
char *type2string (node_t type)
{
return (ast_table[type].name);
}
void tab(FILE *f,int level)
{
int i;
for ( i = 0; i < level; i++ )
if (i%3 !=0) fprintf(f," ");
else fprintf(f,"|");
}
void ast_dump_rec (FILE *f,AST ast, int level , int node_num)
{
if (!ast) return;
tab(f,level);
//fprintf(f,"type:%s(%d) line:%d text:%s nodes:%d node: %p parent: %p
\n",ast_table[ast->type].name,ast->type,
//ast->line,ast->text ? ast->text :
"NULL",ast->no_nodes, ast, ast->parent);
fprintf(f,"type:%s(%d) node:%d line:%d text:%s nodes:%d
{{{%d\n",ast_table[ast->type].name,ast->type,node_num,
ast->line,ast->text ? ast->text : "NULL",
ast->no_nodes,level+1);
level++;
if ( ASTSon0 (ast) ) ast_dump_rec(f,ASTSon0 (ast),level,0);
if ( ASTSon1 (ast) ) ast_dump_rec(f,ASTSon1 (ast),level,1);
if ( ASTSon2 (ast) ) ast_dump_rec(f,ASTSon2 (ast),level,2);
if ( ASTSon3 (ast) ) ast_dump_rec(f,ASTSon3 (ast),level,3);
}
void ast_dump ( FILE *f, AST ast )
{
ast_dump_rec(f,ast,0,0);
}
void ast2graphviz(AST ast)
{
int node_id;
int parent;
printf("\ndigraph sortida{\n");
if (ast != NULL){
node_id = 2;
parent = 1;
printf("1[label=\"%s(%s)(id->%d)\"]\n",type2string(ASTType(ast)),ASTText(ast),ast->id);
node_id=ast2graphviz_rec(ASTSon0(ast),parent,node_id,0);
node_id=ast2graphviz_rec(ASTSon1(ast),parent,node_id,1);
node_id=ast2graphviz_rec(ASTSon2(ast),parent,node_id,2);
node_id=ast2graphviz_rec(ASTSon3(ast),parent,node_id,3);
}
printf("}\n");
}
int ast2graphviz_rec(AST ast, int parent, int node_id, int son)
{
if (ast != NULL)
{
if (ASTText(ast)!=NULL)
printf("%i[label=\"%s(%i-%s)[%i](id->%d)\"]\n",node_id,
type2string(ASTType(ast)),ASTLine(ast),ASTText(ast),son,ast->id);
else
if (ASTLine(ast) != 0)
printf("%i[label=\"%s(%i)[%i](id->%d)\"]\n",node_id,
type2string(ASTType(ast)),ASTLine(ast),son,ast->id);
else
printf("%i[label=\"%s()[%i](id->%d)\"]\n",node_id,
type2string(ASTType(ast)),son,ast->id);
printf("%i->%i\n",parent,node_id);
parent = node_id;
node_id++;
//printf("valor de node_id fill 1:%i\n",node_id);
node_id=ast2graphviz_rec(ASTSon0(ast),parent,node_id,0);
//printf("valor de node_id fill 2:%i\n",node_id);
node_id=ast2graphviz_rec(ASTSon1(ast),parent,node_id,1);
node_id=ast2graphviz_rec(ASTSon2(ast),parent,node_id,2);
node_id=ast2graphviz_rec(ASTSon3(ast),parent,node_id,3);
}
return node_id;
}
#ifndef _AST_H_
#define _AST_H_
#include <stdio.h>
#include <ctype.h>
typedef enum {
NJoin=1,
/* Lexical Conventions A.4 */
NIdentifier,
/* Expressions A.4 */
NUnqualified_id,
NQualified_id,
NQua_unqualified,
NQua_id,
NNested_name_specifier,
/* Declarations A.6 */
NDeclaration,
NSimple_declaration,
NSimple_type_specifier,
/* Declarators A.7 */
NDeclarator_func,
NDeclarator_id_typename,
NDeclarator_id,
NFunction_definition_ctor,
/* Classes A.8 */
NClass_name,
/* others */
NDos_dos_punts,
NAmbig, NAmbig_join
} node_t;
int identificador_node_ast;
#define MAX_AST_SONS 4
typedef struct node
{
node_t type;
int no_nodes;
struct node *parent;
struct node *sons[MAX_AST_SONS];
int line;
char * text;
int id;
} *AST;
char *type2string (node_t type);
#define ASTLeaf(node,line,text) ASTMake(node,0,0,0,0,line,text)
#define ASTMake1(node,son0,line,text) ASTMake(node,son0,0,0,0,line,text)
#define ASTMake2(node,son0,son1,line,text) ASTMake(node,son0,son1,0,0,line,text)
#define ASTMake3(node,son0,son1,son2,line,text)
ASTMake(node,son0,son1,son2,0,line,text)
#define ASTMake4(node,son0,son1,son2,son3,line,text)
ASTMake(node,son0,son1,son2,son3,line,text)
AST ASTMake( node_t type, AST son0, AST son1, AST son2, AST son3, int line,
char *text);
#define ASTType(a) ((a)->type)
#define ASTParent(a) ((a)->parent)
#define ASTLine(a) ((a)->line)
#define ASTText(a) ((a)->text)
#define ASTSon0(a) ((a)->sons[0])
#define ASTSon1(a) ((a)->sons[1])
#define ASTSon2(a) ((a)->sons[2])
#define ASTSon3(a) ((a)->sons[3])
AST ast_clone_rec(AST tree);
AST ast_clone(AST tree);
#endif
#include <stdlib.h>
//#include <strings.h>
#include "ast.h"
AST ast_join2 (AST tree1, AST tree2)
{
if (!tree1) return tree2;
if (!tree2) return tree1;
return ASTMake2 (NJoin,tree1,tree2,0,0);
}
AST ast_comma2 (AST tree1, AST tree2)
{
if (!tree1) return tree2;
if (!tree2) return tree1;
return ASTMake2 (/*NComma JAIRO: NComma has been deleted from AST; use NJoin
instead*/NJoin,tree1,tree2,0,0);
}
AST ast_clone_rec (AST tree)
{
AST cloned_ast;
AST son0, son1 ,son2, son3;
char *text;
int line;
int type;
int id;
if (!tree) {
return NULL;
}
type = tree -> type;
son0 = ast_clone_rec (ASTSon0 (tree));
son1 = ast_clone_rec (ASTSon1 (tree));
son2 = ast_clone_rec (ASTSon2 (tree));
son3 = ast_clone_rec (ASTSon3 (tree));
line = tree -> line;
id = tree -> id;
text = tree -> text ? strdup (tree -> text) : NULL;
cloned_ast = ASTMake (type, son0, son1, son2, son3, line, text);
return (cloned_ast);
}
AST ast_clone (AST tree)
{
return ast_clone_rec (tree);
}
#ifndef _AST_UTILS_H_
#define _AST_UTILS_H_
typedef struct t_ambig{
AST ast; //el node q es NAmbig
AST actual; //el node actual quan vaig fent les copies
AST parent; //el pare del node NAmbig
int parent_son; //num de fill del pare q es aquest Ambig
//int doing_son;
struct t_ambig* next;
} list_ambig;
#define ast_join(a,b) ast_join2(a,b)
AST ast_join2 (AST tree1, AST tree2);
#define ast_comma(a,b) ast_comma2(a,b)
AST ast_comma2 (AST tree1, AST tree2);
AST aplanar(AST tree);
void eliminar_repetits(AST tree);
#endif
%{
#include "y.tab.h"
int yywrap();
void parse_token();
void parse_token_text();
int no_line=1;
%}
%option 8bit
%option lex-compat
%option stack
hexdigit [a-fA-F0-9]
hexquad {hexdigit}{hexdigit}{hexdigit}{hexdigit}
uchar (\\u{hexquad}|\\U{hexquad}{hexquad})
nondigit ([_a-zA-Z]|uchar)
digit [0-9]
idnondigit ({nondigit}|{uchar})
%%
{idnondigit}({idnondigit}|{digit})* {parse_token_text(); return IDENTIFIER; }
"}" { return '}'; }
"{" { return '{'; }
")" { return ')'; }
"(" { return '('; }
";" { return ';'; }
"::" { return DOS_DOS_PUNTS; }
[\n] {no_line++;}
[ \t\v\f] { }
. { /* ignore bad characters */ }
%%
int yywrap()
{
return 1;
}
void parse_token()
{
yylval.token_atrib.line = no_line;
}
void parse_token_text()
{
parse_token();
yylval.token_atrib.text = strdup(yytext);
}
%{
#define YYDEBUG 1
#define YYERROR_VERBOSE
#include "ast.h"
#include "ast_utils.h"
typedef struct {
char* text;
int line;
} type_token_atrib;
static AST result;
int yyerror(char* s);
yydebug = 1;
%}
%union {
type_token_atrib token_atrib;
AST ast;
};
%token<token_atrib> IDENTIFIER
%token<token_atrib> DOS_DOS_PUNTS
%type<ast>identifier
%type<ast>id_expression qualified_id nested_name_specifier
nested_name_specifier_opt
%type<ast>declaration_seq declaration_seq_opt declaration simple_declaration
decl_specifier decl_specifier_seq decl_specifier_seq_opt simple_type_specifier
type_name
%type<ast>direct_declarator declarator_id function_definition
%type<ast>class_name
%type<ast>dos_dos_punts dos_dos_punts_opt
%debug
%glr-parser
%start declaration_seq
%%
identifier
: IDENTIFIER
{ $$ = ASTLeaf(NIdentifier, $1.line, $1.text); }
;
/* Expressions */
id_expression
: identifier
{ $$ = ASTMake1(NUnqualified_id, $1, 0,0); }
| qualified_id
{ $$ = ASTMake1(NQualified_id, $1, 0,0); }
;
qualified_id
: dos_dos_punts_opt nested_name_specifier identifier
{ $$ = ASTMake4(NQua_unqualified, $1, $2, 0, $3, 0, 0); }
| dos_dos_punts identifier
{ $$ = ASTMake2(NQua_id, $1, $2, 0, 0); }
;
nested_name_specifier
: class_name dos_dos_punts nested_name_specifier_opt
{ $$ = ASTMake3(NNested_name_specifier, $1, $2, $3, 0, 0); }
;
nested_name_specifier_opt
:
{ $$ = 0; }
| nested_name_specifier
{ $$ = $1; }
;
/* Declarations */
declaration_seq
: declaration
{ result = $$ = ASTMake1(NDeclaration, $1,0,0); }
| declaration_seq declaration
{ result = $$ = ast_join($1, ASTMake1(NDeclaration, $2,0,0)); }
;
declaration_seq_opt
:
{ $$ = 0; }
| declaration_seq
{ $$ = $1; }
;
declaration
: simple_declaration
{ $$ = $1; }
| function_definition
{ $$ = $1; }
;
simple_declaration
: simple_type_specifier direct_declarator ';'
{ $$ = ASTMake2(NSimple_declaration,$1,$2,0,0); }
;
decl_specifier
: simple_type_specifier
{ $$ = $1; }
;
decl_specifier_seq
: decl_specifier_seq_opt decl_specifier
{ $$ = ast_join($1,$2); }%merge <merging>
;
decl_specifier_seq_opt
:
{ $$ = 0; }
| decl_specifier_seq
{ $$ = $1; }
;
simple_type_specifier
: dos_dos_punts_opt nested_name_specifier_opt type_name
{ $$ = ASTMake3(NSimple_type_specifier,$1,$2,$3,0,0); }
;
type_name
: class_name
{ $$ = $1; }
;
/* Declarators */
direct_declarator
: declarator_id
{ $$ = $1; }
| direct_declarator '(' ')'
{ $$ = ASTMake4(NDeclarator_func, $1,0,0,0,0,0); }
;
declarator_id
: dos_dos_punts_opt nested_name_specifier_opt type_name
{ $$ = ASTMake3(NDeclarator_id_typename, $1,$2, $3,0,0); }
%merge <merging>
| id_expression
{ $$ = ASTMake1(NDeclarator_id, $1,0,0); } %merge <merging>
;
function_definition
: decl_specifier_seq_opt direct_declarator '{' '}'
{ $$ = ASTMake4(NFunction_definition_ctor,$1,$2,0,0,0,0); }
%merge <merging>
;
/* Classes */
class_name
: identifier
{ $$ = ASTMake1(NClass_name, $1,0,0); }
;
/* others */
dos_dos_punts
: DOS_DOS_PUNTS
{ $$ = ASTLeaf(NDos_dos_punts, $1.line,0); }
;
dos_dos_punts_opt
:
{ $$ = 0; }
| dos_dos_punts
{ $$ = $1; }
;
%%
#include "lex.yy.c"
int yyerror (char* s)
{
fprintf(stderr, "%s in line %d\n", s, no_line);
return 0;
}
AST merging2(YYSTYPE p, YYSTYPE s)
{
AST res=0, primer, segon;
primer = ast_clone(p.ast);
segon = ast_clone(s.ast);
if (ASTType(primer) != NAmbig && ASTType(segon)!=NAmbig) {
AST join = ASTMake1(NAmbig_join,segon,0,"merging2");
AST join2 = ASTMake2(NAmbig_join,primer,join,0,"merging2");
res = ASTMake1(NAmbig,join2,0,"merging2");
}
else
{
AST ambig, nou;
if (ASTType(primer) == NAmbig){
ambig = primer;
nou = segon;
}
else {
ambig = segon;
nou = primer;
}
res = ambig;
ambig = ASTSon0(ambig);
while (ASTSon1(ambig) != 0){
ambig = ASTSon1(ambig);
}
AST join = ASTMake1(NAmbig_join,nou,0,"merging2");
ASTSon1(ambig) = join;
ASTParent(join) = ambig;
}
return res;
}
AST merging(YYSTYPE p, YYSTYPE s){
return merging2(p,s);
}
int main( int argc, char *argv[] )
{
extern FILE *yyin;
yyin = fopen( argv[1], "r");
identificador_node_ast=0;
yyparse();
if (result){
printf("Ok, doned\n");
ast2graphviz(result);
}
else
{
printf("error\n");
return(1);
}
return(0);
}
Starting parse
Entering state 0
Reading a token: Next token is token IDENTIFIER ()
Stack 0 Entering state 0
Splitting off stack 1 from 0.
Reduced stack 1 by rule #27; action deferred. Now in state 10.
Stack 1 Entering state 10
Splitting off stack 2 from 1.
Reduced stack 2 by rule #7; action deferred. Now in state 27.
Stack 2 Entering state 27
On stack 2, shifting token IDENTIFIER (), now in state #13
On stack 1, shifting token IDENTIFIER (), now in state #13
Reduced stack 0 by rule #16; action deferred. Now in state 6.
Stack 0 Entering state 6
Splitting off stack 3 from 0.
Reduced stack 3 by rule #27; action deferred. Now in state 22.
Stack 3 Entering state 22
Splitting off stack 4 from 3.
Reduced stack 4 by rule #7; action deferred. Now in state 33.
Stack 4 Entering state 33
On stack 4, shifting token IDENTIFIER (), now in state #13
On stack 3, shifting token IDENTIFIER (), now in state #13
On stack 0, shifting token IDENTIFIER (), now in state #13
Stack 0 Entering state 13
Reduced stack 0 by rule #1; action deferred. Now in state 14.
Stack 0 Entering state 14
Reduced stack 0 by rule #2; action deferred. Now in state 15.
Stack 0 Entering state 15
Reduced stack 0 by rule #23; action deferred. Now in state 20.
Stack 0 Entering state 20
Reduced stack 0 by rule #20; action deferred. Now in state 19.
Stack 0 Entering state 19
Reading a token: Next token is token IDENTIFIER ()
Stack 0 dies.
Stack 1 Entering state 13
Reduced stack 1 by rule #1; action deferred. Now in state 25.
Stack 1 Entering state 25
Reduced stack 1 by rule #25; action deferred. Now in state 28.
Stack 1 Entering state 28
Stack 1 dies.
Stack 2 Entering state 13
Reduced stack 2 by rule #1; action deferred. Now in state 25.
Stack 2 Entering state 25
Reduced stack 2 by rule #25; action deferred. Now in state 37.
Stack 2 Entering state 37
Reduced stack 2 by rule #19; action deferred. Now in state 36.
Stack 2 Entering state 36
Reduced stack 2 by rule #18; action deferred. Now in state 7.
Stack 2 Entering state 7
Splitting off stack 5 from 2.
Reduced stack 5 by rule #27; action deferred. Now in state 24.
Stack 5 Entering state 24
Splitting off stack 6 from 5.
Reduced stack 6 by rule #7; action deferred. Now in state 35.
Stack 6 Entering state 35
On stack 6, shifting token IDENTIFIER (), now in state #13
On stack 5, shifting token IDENTIFIER (), now in state #13
On stack 2, shifting token IDENTIFIER (), now in state #13
Stack 3 Entering state 13
Reduced stack 3 by rule #1; action deferred. Now in state 25.
Stack 3 Entering state 25
Reduced stack 3 by rule #25; action deferred. Now in state 28.
Stack 3 Entering state 28
Stack 3 dies.
Stack 4 Entering state 13
Reduced stack 4 by rule #1; action deferred. Now in state 25.
Stack 4 Entering state 25
Reduced stack 4 by rule #25; action deferred. Now in state 37.
Stack 4 Entering state 37
Reduced stack 4 by rule #19; action deferred. Now in state 42.
Stack 4 Entering state 42
Reduced stack 4 by rule #18; action deferred. Now in state 18.
Stack 4 Entering state 18
Reduced stack 4 by rule #14; action deferred. Now in state 17.
Stack 4 Entering state 17
Reduced stack 4 by rule #15; action deferred. Now in state 5.
Stack 4 Entering state 5
Reduced stack 4 by rule #17; action deferred. Now in state 6.
Stack 4 Entering state 6
Splitting off stack 7 from 4.
Reduced stack 7 by rule #27; action deferred. Now in state 22.
Stack 7 Entering state 22
Splitting off stack 8 from 7.
Reduced stack 8 by rule #7; action deferred. Now in state 33.
Stack 8 Entering state 33
On stack 8, shifting token IDENTIFIER (), now in state #13
On stack 7, shifting token IDENTIFIER (), now in state #13
On stack 4, shifting token IDENTIFIER (), now in state #13
Removing dead stacks.
Rename stack 2 -> 0.
Rename stack 4 -> 1.
Rename stack 5 -> 2.
Rename stack 6 -> 3.
Rename stack 7 -> 4.
Rename stack 8 -> 5.
Stack 0 Entering state 13
Reduced stack 0 by rule #1; action deferred. Now in state 14.
Stack 0 Entering state 14
Reduced stack 0 by rule #2; action deferred. Now in state 15.
Stack 0 Entering state 15
Reduced stack 0 by rule #23; action deferred. Now in state 20.
Stack 0 Entering state 20
Reduced stack 0 by rule #20; action deferred. Now in state 23.
Stack 0 Entering state 23
Reading a token: Next token is token DOS_DOS_PUNTS ()
Stack 0 dies.
Stack 1 Entering state 13
Reduced stack 1 by rule #1; action deferred. Now in state 14.
Stack 1 Entering state 14
Reduced stack 1 by rule #2; action deferred. Now in state 15.
Stack 1 Entering state 15
Reduced stack 1 by rule #23; action deferred. Now in state 20.
Stack 1 Entering state 20
Reduced stack 1 by rule #20; action deferred. Now in state 19.
Stack 1 Entering state 19
Stack 1 dies.
Stack 2 Entering state 13
Reduced stack 2 by rule #1; action deferred. Now in state 25.
Stack 2 Entering state 25
Reduced stack 2 by rule #25; action deferred. Now in state 28.
Stack 2 Entering state 28
On stack 2, shifting token DOS_DOS_PUNTS (), now in state #1
Stack 3 Entering state 13
Reduced stack 3 by rule #1; action deferred. Now in state 25.
Stack 3 Entering state 25
Reduced stack 3 by rule #25; action deferred. Now in state 37.
Stack 3 Entering state 37
Reduced stack 3 by rule #19; action deferred. Now in state 43.
Stack 3 Entering state 43
Reduced stack 3 by rule #22; action deferred. Now in state 20.
Stack 3 Entering state 20
Reduced stack 3 by rule #20; action deferred. Now in state 23.
Stack 3 Entering state 23
Stack 3 dies.
Stack 4 Entering state 13
Reduced stack 4 by rule #1; action deferred. Now in state 25.
Stack 4 Entering state 25
Reduced stack 4 by rule #25; action deferred. Now in state 28.
Stack 4 Entering state 28
On stack 4, shifting token DOS_DOS_PUNTS (), now in state #1
Stack 5 Entering state 13
Reduced stack 5 by rule #1; action deferred. Now in state 25.
Stack 5 Entering state 25
Reduced stack 5 by rule #25; action deferred. Now in state 37.
Stack 5 Entering state 37
Reduced stack 5 by rule #19; action deferred. Now in state 42.
Stack 5 Entering state 42
Reduced stack 5 by rule #18; action deferred. Now in state 18.
Stack 5 Entering state 18
Reduced stack 5 by rule #14; action deferred. Now in state 17.
Stack 5 Entering state 17
Reduced stack 5 by rule #15; action deferred. Now in state 5.
Stack 5 Entering state 5
Reduced stack 5 by rule #17; action deferred. Now in state 6.
Stack 5 Entering state 6
On stack 5, shifting token DOS_DOS_PUNTS (), now in state #1
Removing dead stacks.
Rename stack 2 -> 0.
Rename stack 4 -> 1.
Rename stack 5 -> 2.
Stack 0 Entering state 1
Reduced stack 0 by rule #26; action deferred. Now in state 38.
Stack 0 Entering state 38
Reading a token: Next token is token IDENTIFIER ()
Splitting off stack 3 from 0.
Reduced stack 3 by rule #7; action deferred. Now in state 44.
Stack 3 Entering state 44
Reduced stack 3 by rule #6; action deferred. Now in state 32.
Stack 3 Entering state 32
Splitting off stack 4 from 3.
Reduced stack 4 by rule #8; action deferred. Now in state 35.
Stack 4 Entering state 35
On stack 4, shifting token IDENTIFIER (), now in state #13
On stack 3, shifting token IDENTIFIER (), now in state #13
On stack 0, shifting token IDENTIFIER (), now in state #13
Stack 1 Entering state 1
Reduced stack 1 by rule #26; action deferred. Now in state 38.
Stack 1 Entering state 38
Splitting off stack 5 from 1.
Reduced stack 5 by rule #7; action deferred. Now in state 44.
Stack 5 Entering state 44
Reduced stack 5 by rule #6; action deferred. Now in state 32.
Stack 5 Entering state 32
Splitting off stack 6 from 5.
Reduced stack 6 by rule #8; action deferred. Now in state 33.
Stack 6 Entering state 33
On stack 6, shifting token IDENTIFIER (), now in state #13
On stack 5, shifting token IDENTIFIER (), now in state #13
On stack 1, shifting token IDENTIFIER (), now in state #13
Stack 2 Entering state 1
Reduced stack 2 by rule #26; action deferred. Now in state 21.
Stack 2 Entering state 21
Splitting off stack 7 from 2.
Reduced stack 7 by rule #28; action deferred. Now in state 22.
Stack 7 Entering state 22
Splitting off stack 8 from 7.
Reduced stack 8 by rule #7; action deferred. Now in state 33.
Stack 8 Entering state 33
On stack 8, shifting token IDENTIFIER (), now in state #13
On stack 7, shifting token IDENTIFIER (), now in state #13
On stack 2, shifting token IDENTIFIER (), now in state #13
Stack 0 Entering state 13
Reduced stack 0 by rule #1; action deferred. Now in state 25.
Stack 0 Entering state 25
Reduced stack 0 by rule #25; action deferred. Now in state 28.
Stack 0 Entering state 28
Reading a token: Next token is token '(' ()
Stack 0 dies.
Stack 1 Entering state 13
Reduced stack 1 by rule #1; action deferred. Now in state 25.
Stack 1 Entering state 25
Reduced stack 1 by rule #25; action deferred. Now in state 28.
Stack 1 Entering state 28
Stack 1 dies.
Stack 2 Entering state 13
Reduced stack 2 by rule #1; action deferred. Now in state 31.
Stack 2 Entering state 31
Reduced stack 2 by rule #5; action deferred. Now in state 16.
Stack 2 Entering state 16
Reduced stack 2 by rule #3; action deferred. Now in state 15.
Stack 2 Entering state 15
Reduced stack 2 by rule #23; action deferred. Now in state 20.
Stack 2 Entering state 20
Reduced stack 2 by rule #20; action deferred. Now in state 19.
Stack 2 Entering state 19
On stack 2, shifting token '(' (), now in state #29
Stack 3 Entering state 13
Reduced stack 3 by rule #1; action deferred. Now in state 41.
Stack 3 Entering state 41
Reduced stack 3 by rule #4; action deferred. Now in state 16.
Stack 3 Entering state 16
Reduced stack 3 by rule #3; action deferred. Now in state 15.
Stack 3 Entering state 15
Reduced stack 3 by rule #23; action deferred. Now in state 20.
Stack 3 Entering state 20
Reduced stack 3 by rule #20; action deferred. Now in state 23.
Stack 3 Entering state 23
On stack 3, shifting token '(' (), now in state #29
Stack 4 Entering state 13
Reduced stack 4 by rule #1; action deferred. Now in state 25.
Stack 4 Entering state 25
Reduced stack 4 by rule #25; action deferred. Now in state 37.
Stack 4 Entering state 37
Reduced stack 4 by rule #19; action deferred. Now in state 43.
Stack 4 Entering state 43
Reduced stack 4 by rule #22; action deferred. Now in state 20.
Stack 4 Entering state 20
Reduced stack 4 by rule #20; action deferred. Now in state 23.
Merging stack 4 into stack 3.
Stack 5 Entering state 13
Reduced stack 5 by rule #1; action deferred. Now in state 41.
Stack 5 Entering state 41
Reduced stack 5 by rule #4; action deferred. Now in state 16.
Stack 5 Entering state 16
Reduced stack 5 by rule #3; action deferred. Now in state 15.
Stack 5 Entering state 15
Reduced stack 5 by rule #23; action deferred. Now in state 20.
Stack 5 Entering state 20
Reduced stack 5 by rule #20; action deferred. Now in state 19.
Stack 5 Entering state 19
On stack 5, shifting token '(' (), now in state #29
Stack 6 Entering state 13
Reduced stack 6 by rule #1; action deferred. Now in state 25.
Stack 6 Entering state 25
Reduced stack 6 by rule #25; action deferred. Now in state 37.
Stack 6 Entering state 37
Reduced stack 6 by rule #19; action deferred. Now in state 42.
Stack 6 Entering state 42
Reduced stack 6 by rule #22; action deferred. Now in state 20.
Stack 6 Entering state 20
Reduced stack 6 by rule #20; action deferred. Now in state 19.
Merging stack 6 into stack 5.
Stack 7 Entering state 13
Reduced stack 7 by rule #1; action deferred. Now in state 25.
Stack 7 Entering state 25
Reduced stack 7 by rule #25; action deferred. Now in state 28.
Stack 7 Entering state 28
Stack 7 dies.
Stack 8 Entering state 13
Reduced stack 8 by rule #1; action deferred. Now in state 25.
Stack 8 Entering state 25
Reduced stack 8 by rule #25; action deferred. Now in state 37.
Stack 8 Entering state 37
Reduced stack 8 by rule #19; action deferred. Now in state 42.
Stack 8 Entering state 42
Reduced stack 8 by rule #22; action deferred. Now in state 20.
Stack 8 Entering state 20
Reduced stack 8 by rule #20; action deferred. Now in state 19.
Merging stack 8 into stack 2.
Removing dead stacks.
Rename stack 2 -> 0.
Rename stack 3 -> 1.
Rename stack 5 -> 2.
Stack 0 Entering state 29
Reading a token: Next token is token ')' ()
On stack 0, shifting token ')' (), now in state #39
Stack 1 Entering state 29
On stack 1, shifting token ')' (), now in state #39
Stack 2 Entering state 29
On stack 2, shifting token ')' (), now in state #39
Stack 0 Entering state 39
Reduced stack 0 by rule #21; action deferred. Now in state 19.
Stack 0 Entering state 19
Reading a token: Next token is token '{' ()
On stack 0, shifting token '{' (), now in state #30
Stack 1 Entering state 39
Reduced stack 1 by rule #21; action deferred. Now in state 23.
Stack 1 Entering state 23
Stack 1 dies.
Stack 2 Entering state 39
Reduced stack 2 by rule #21; action deferred. Now in state 19.
Stack 2 Entering state 19
On stack 2, shifting token '{' (), now in state #30
Removing dead stacks.
Rename stack 2 -> 1.
Stack 0 Entering state 30
Reading a token: Next token is token '}' ()
On stack 0, shifting token '}' (), now in state #40
Stack 1 Entering state 30
On stack 1, shifting token '}' (), now in state #40
Stack 0 Entering state 40
Reduced stack 0 by rule #24; action deferred. Now in state 8.
Stack 0 Entering state 8
Reduced stack 0 by rule #12; action deferred. Now in state 3.
Stack 0 Entering state 3
Reduced stack 0 by rule #9; action deferred. Now in state 2.
Stack 0 Entering state 2
Reading a token: Next token is token IDENTIFIER ()
Splitting off stack 2 from 0.
Reduced stack 2 by rule #27; action deferred. Now in state 10.
Stack 2 Entering state 10
Splitting off stack 3 from 2.
Reduced stack 3 by rule #7; action deferred. Now in state 27.
Stack 3 Entering state 27
On stack 3, shifting token IDENTIFIER (), now in state #13
On stack 2, shifting token IDENTIFIER (), now in state #13
Reduced stack 0 by rule #16; action deferred. Now in state 6.
Stack 0 Entering state 6
Splitting off stack 4 from 0.
Reduced stack 4 by rule #27; action deferred. Now in state 22.
Stack 4 Entering state 22
Splitting off stack 5 from 4.
Reduced stack 5 by rule #7; action deferred. Now in state 33.
Stack 5 Entering state 33
On stack 5, shifting token IDENTIFIER (), now in state #13
On stack 4, shifting token IDENTIFIER (), now in state #13
On stack 0, shifting token IDENTIFIER (), now in state #13
Stack 1 Entering state 40
Reduced stack 1 by rule #24; action deferred. Now in state 8.
Stack 1 Entering state 8
Reduced stack 1 by rule #12; action deferred. Now in state 3.
Stack 1 Entering state 3
Reduced stack 1 by rule #9; action deferred. Now in state 2.
Merging stack 1 into stack 0.
Removing dead stacks.
Rename stack 2 -> 1.
Rename stack 3 -> 2.
Rename stack 4 -> 3.
Rename stack 5 -> 4.
Stack 0 Entering state 13
Reduced stack 0 by rule #1; action deferred. Now in state 14.
Stack 0 Entering state 14
Reduced stack 0 by rule #2; action deferred. Now in state 15.
Stack 0 Entering state 15
Reduced stack 0 by rule #23; action deferred. Now in state 20.
Stack 0 Entering state 20
Reduced stack 0 by rule #20; action deferred. Now in state 19.
Stack 0 Entering state 19
Reading a token: Next token is token IDENTIFIER ()
Stack 0 dies.
Stack 1 Entering state 13
Reduced stack 1 by rule #1; action deferred. Now in state 25.
Stack 1 Entering state 25
Reduced stack 1 by rule #25; action deferred. Now in state 28.
Stack 1 Entering state 28
Stack 1 dies.
Stack 2 Entering state 13
Reduced stack 2 by rule #1; action deferred. Now in state 25.
Stack 2 Entering state 25
Reduced stack 2 by rule #25; action deferred. Now in state 37.
Stack 2 Entering state 37
Reduced stack 2 by rule #19; action deferred. Now in state 36.
Stack 2 Entering state 36
Reduced stack 2 by rule #18; action deferred. Now in state 7.
Stack 2 Entering state 7
Splitting off stack 5 from 2.
Reduced stack 5 by rule #27; action deferred. Now in state 24.
Stack 5 Entering state 24
Splitting off stack 6 from 5.
Reduced stack 6 by rule #7; action deferred. Now in state 35.
Stack 6 Entering state 35
On stack 6, shifting token IDENTIFIER (), now in state #13
On stack 5, shifting token IDENTIFIER (), now in state #13
On stack 2, shifting token IDENTIFIER (), now in state #13
Stack 3 Entering state 13
Reduced stack 3 by rule #1; action deferred. Now in state 25.
Stack 3 Entering state 25
Reduced stack 3 by rule #25; action deferred. Now in state 28.
Stack 3 Entering state 28
Stack 3 dies.
Stack 4 Entering state 13
Reduced stack 4 by rule #1; action deferred. Now in state 25.
Stack 4 Entering state 25
Reduced stack 4 by rule #25; action deferred. Now in state 37.
Stack 4 Entering state 37
Reduced stack 4 by rule #19; action deferred. Now in state 42.
Stack 4 Entering state 42
Reduced stack 4 by rule #18; action deferred. Now in state 18.
Stack 4 Entering state 18
Reduced stack 4 by rule #14; action deferred. Now in state 17.
Stack 4 Entering state 17
Reduced stack 4 by rule #15; action deferred. Now in state 5.
Stack 4 Entering state 5
Reduced stack 4 by rule #17; action deferred. Now in state 6.
Stack 4 Entering state 6
Splitting off stack 7 from 4.
Reduced stack 7 by rule #27; action deferred. Now in state 22.
Stack 7 Entering state 22
Splitting off stack 8 from 7.
Reduced stack 8 by rule #7; action deferred. Now in state 33.
Stack 8 Entering state 33
On stack 8, shifting token IDENTIFIER (), now in state #13
On stack 7, shifting token IDENTIFIER (), now in state #13
On stack 4, shifting token IDENTIFIER (), now in state #13
Removing dead stacks.
Rename stack 2 -> 0.
Rename stack 4 -> 1.
Rename stack 5 -> 2.
Rename stack 6 -> 3.
Rename stack 7 -> 4.
Rename stack 8 -> 5.
Stack 0 Entering state 13
Reduced stack 0 by rule #1; action deferred. Now in state 14.
Stack 0 Entering state 14
Reduced stack 0 by rule #2; action deferred. Now in state 15.
Stack 0 Entering state 15
Reduced stack 0 by rule #23; action deferred. Now in state 20.
Stack 0 Entering state 20
Reduced stack 0 by rule #20; action deferred. Now in state 23.
Stack 0 Entering state 23
Reading a token: Next token is token ';' ()
On stack 0, shifting token ';' (), now in state #34
Stack 1 Entering state 13
Reduced stack 1 by rule #1; action deferred. Now in state 14.
Stack 1 Entering state 14
Reduced stack 1 by rule #2; action deferred. Now in state 15.
Stack 1 Entering state 15
Reduced stack 1 by rule #23; action deferred. Now in state 20.
Stack 1 Entering state 20
Reduced stack 1 by rule #20; action deferred. Now in state 19.
Stack 1 Entering state 19
Stack 1 dies.
Stack 2 Entering state 13
Reduced stack 2 by rule #1; action deferred. Now in state 25.
Stack 2 Entering state 25
Reduced stack 2 by rule #25; action deferred. Now in state 28.
Stack 2 Entering state 28
Stack 2 dies.
Stack 3 Entering state 13
Reduced stack 3 by rule #1; action deferred. Now in state 25.
Stack 3 Entering state 25
Reduced stack 3 by rule #25; action deferred. Now in state 37.
Stack 3 Entering state 37
Reduced stack 3 by rule #19; action deferred. Now in state 43.
Stack 3 Entering state 43
Reduced stack 3 by rule #22; action deferred. Now in state 20.
Stack 3 Entering state 20
Reduced stack 3 by rule #20; action deferred. Now in state 23.
Merging stack 3 into stack 0.
Stack 4 Entering state 13
Reduced stack 4 by rule #1; action deferred. Now in state 25.
Stack 4 Entering state 25
Reduced stack 4 by rule #25; action deferred. Now in state 28.
Stack 4 Entering state 28
Stack 4 dies.
Stack 5 Entering state 13
Reduced stack 5 by rule #1; action deferred. Now in state 25.
Stack 5 Entering state 25
Reduced stack 5 by rule #25; action deferred. Now in state 37.
Stack 5 Entering state 37
Reduced stack 5 by rule #19; action deferred. Now in state 42.
Stack 5 Entering state 42
Reduced stack 5 by rule #18; action deferred. Now in state 18.
Stack 5 Entering state 18
Reduced stack 5 by rule #14; action deferred. Now in state 17.
Stack 5 Entering state 17
Reduced stack 5 by rule #15; action deferred. Now in state 5.
Stack 5 Entering state 5
Reduced stack 5 by rule #17; action deferred. Now in state 6.
Stack 5 Entering state 6
Stack 5 dies.
Removing dead stacks.
Returning to deterministic operation.
Entering state 34
Reducing stack 0 by rule 13 (line 108), simple_type_specifier direct_declarator
';' -> simple_declaration
Entering state 4
Reducing stack 0 by rule 11 (line 101), simple_declaration -> declaration
Entering state 12
Reducing stack 0 by rule 10 (line 89), declaration_seq declaration ->
declaration_seq
Entering state 2
Reading a token: Next token is token $end ()
Shifting token $end ()
Entering state 11
Useless nonterminals
declaration_seq_opt
Useless rules
29 declaration_seq_opt: /* empty */
30 | declaration_seq
State 0 conflicts: 1 shift/reduce, 1 reduce/reduce
State 2 conflicts: 1 shift/reduce, 1 reduce/reduce
State 6 conflicts: 1 shift/reduce
State 7 conflicts: 1 shift/reduce
State 10 conflicts: 1 shift/reduce
State 21 conflicts: 1 shift/reduce
State 22 conflicts: 1 shift/reduce
State 24 conflicts: 1 shift/reduce
State 32 conflicts: 1 shift/reduce
State 38 conflicts: 1 shift/reduce
Grammar
0 $accept: declaration_seq $end
1 identifier: IDENTIFIER
2 id_expression: identifier
3 | qualified_id
4 qualified_id: dos_dos_punts_opt nested_name_specifier identifier
5 | dos_dos_punts identifier
6 nested_name_specifier: class_name dos_dos_punts nested_name_specifier_opt
7 nested_name_specifier_opt: /* empty */
8 | nested_name_specifier
9 declaration_seq: declaration
10 | declaration_seq declaration
11 declaration: simple_declaration
12 | function_definition
13 simple_declaration: simple_type_specifier direct_declarator ';'
14 decl_specifier: simple_type_specifier
15 decl_specifier_seq: decl_specifier_seq_opt decl_specifier
16 decl_specifier_seq_opt: /* empty */
17 | decl_specifier_seq
18 simple_type_specifier: dos_dos_punts_opt nested_name_specifier_opt
type_name
19 type_name: class_name
20 direct_declarator: declarator_id
21 | direct_declarator '(' ')'
22 declarator_id: dos_dos_punts_opt nested_name_specifier_opt type_name
23 | id_expression
24 function_definition: decl_specifier_seq_opt direct_declarator '{' '}'
25 class_name: identifier
26 dos_dos_punts: DOS_DOS_PUNTS
27 dos_dos_punts_opt: /* empty */
28 | dos_dos_punts
Terminals, with rules where they appear
$end (0) 0
'(' (40) 21
')' (41) 21
';' (59) 13
'{' (123) 24
'}' (125) 24
error (256)
IDENTIFIER (258) 1
DOS_DOS_PUNTS (259) 26
Nonterminals, with rules where they appear
$accept (10)
on left: 0
identifier (11)
on left: 1, on right: 2 4 5 25
id_expression (12)
on left: 2 3, on right: 23
qualified_id (13)
on left: 4 5, on right: 3
nested_name_specifier (14)
on left: 6, on right: 4 8
nested_name_specifier_opt (15)
on left: 7 8, on right: 6 18 22
declaration_seq (16)
on left: 9 10, on right: 0 10
declaration (17)
on left: 11 12, on right: 9 10
simple_declaration (18)
on left: 13, on right: 11
decl_specifier (19)
on left: 14, on right: 15
decl_specifier_seq (20)
on left: 15, on right: 17
decl_specifier_seq_opt (21)
on left: 16 17, on right: 15 24
simple_type_specifier (22)
on left: 18, on right: 13 14
type_name (23)
on left: 19, on right: 18 22
direct_declarator (24)
on left: 20 21, on right: 13 21 24
declarator_id (25)
on left: 22 23, on right: 20
function_definition (26)
on left: 24, on right: 12
class_name (27)
on left: 25, on right: 6 19
dos_dos_punts (28)
on left: 26, on right: 5 6 28
dos_dos_punts_opt (29)
on left: 27 28, on right: 4 18 22
state 0
0 $accept: . declaration_seq $end
9 declaration_seq: . declaration
10 | . declaration_seq declaration
11 declaration: . simple_declaration
12 | . function_definition
13 simple_declaration: . simple_type_specifier direct_declarator ';'
15 decl_specifier_seq: . decl_specifier_seq_opt decl_specifier
16 decl_specifier_seq_opt: . [IDENTIFIER, DOS_DOS_PUNTS]
17 | . decl_specifier_seq
18 simple_type_specifier: . dos_dos_punts_opt nested_name_specifier_opt
type_name
24 function_definition: . decl_specifier_seq_opt direct_declarator '{' '}'
26 dos_dos_punts: . DOS_DOS_PUNTS
27 dos_dos_punts_opt: . [IDENTIFIER]
28 | . dos_dos_punts
DOS_DOS_PUNTS shift, and go to state 1
IDENTIFIER reduce using rule 16 (decl_specifier_seq_opt)
IDENTIFIER [reduce using rule 27 (dos_dos_punts_opt)]
DOS_DOS_PUNTS [reduce using rule 16 (decl_specifier_seq_opt)]
$default reduce using rule 16 (decl_specifier_seq_opt)
declaration_seq go to state 2
declaration go to state 3
simple_declaration go to state 4
decl_specifier_seq go to state 5
decl_specifier_seq_opt go to state 6
simple_type_specifier go to state 7
function_definition go to state 8
dos_dos_punts go to state 9
dos_dos_punts_opt go to state 10
state 1
26 dos_dos_punts: DOS_DOS_PUNTS .
$default reduce using rule 26 (dos_dos_punts)
state 2
0 $accept: declaration_seq . $end
10 declaration_seq: declaration_seq . declaration
11 declaration: . simple_declaration
12 | . function_definition
13 simple_declaration: . simple_type_specifier direct_declarator ';'
15 decl_specifier_seq: . decl_specifier_seq_opt decl_specifier
16 decl_specifier_seq_opt: . [IDENTIFIER, DOS_DOS_PUNTS]
17 | . decl_specifier_seq
18 simple_type_specifier: . dos_dos_punts_opt nested_name_specifier_opt
type_name
24 function_definition: . decl_specifier_seq_opt direct_declarator '{' '}'
26 dos_dos_punts: . DOS_DOS_PUNTS
27 dos_dos_punts_opt: . [IDENTIFIER]
28 | . dos_dos_punts
$end shift, and go to state 11
DOS_DOS_PUNTS shift, and go to state 1
IDENTIFIER reduce using rule 16 (decl_specifier_seq_opt)
IDENTIFIER [reduce using rule 27 (dos_dos_punts_opt)]
DOS_DOS_PUNTS [reduce using rule 16 (decl_specifier_seq_opt)]
$default reduce using rule 16 (decl_specifier_seq_opt)
declaration go to state 12
simple_declaration go to state 4
decl_specifier_seq go to state 5
decl_specifier_seq_opt go to state 6
simple_type_specifier go to state 7
function_definition go to state 8
dos_dos_punts go to state 9
dos_dos_punts_opt go to state 10
state 3
9 declaration_seq: declaration .
$default reduce using rule 9 (declaration_seq)
state 4
11 declaration: simple_declaration .
$default reduce using rule 11 (declaration)
state 5
17 decl_specifier_seq_opt: decl_specifier_seq .
$default reduce using rule 17 (decl_specifier_seq_opt)
state 6
1 identifier: . IDENTIFIER
2 id_expression: . identifier
3 | . qualified_id
4 qualified_id: . dos_dos_punts_opt nested_name_specifier identifier
5 | . dos_dos_punts identifier
14 decl_specifier: . simple_type_specifier
15 decl_specifier_seq: decl_specifier_seq_opt . decl_specifier
18 simple_type_specifier: . dos_dos_punts_opt nested_name_specifier_opt
type_name
20 direct_declarator: . declarator_id
21 | . direct_declarator '(' ')'
22 declarator_id: . dos_dos_punts_opt nested_name_specifier_opt type_name
23 | . id_expression
24 function_definition: decl_specifier_seq_opt . direct_declarator '{' '}'
26 dos_dos_punts: . DOS_DOS_PUNTS
27 dos_dos_punts_opt: . [IDENTIFIER]
28 | . dos_dos_punts
IDENTIFIER shift, and go to state 13
DOS_DOS_PUNTS shift, and go to state 1
IDENTIFIER [reduce using rule 27 (dos_dos_punts_opt)]
identifier go to state 14
id_expression go to state 15
qualified_id go to state 16
decl_specifier go to state 17
simple_type_specifier go to state 18
direct_declarator go to state 19
declarator_id go to state 20
dos_dos_punts go to state 21
dos_dos_punts_opt go to state 22
state 7
1 identifier: . IDENTIFIER
2 id_expression: . identifier
3 | . qualified_id
4 qualified_id: . dos_dos_punts_opt nested_name_specifier identifier
5 | . dos_dos_punts identifier
13 simple_declaration: simple_type_specifier . direct_declarator ';'
20 direct_declarator: . declarator_id
21 | . direct_declarator '(' ')'
22 declarator_id: . dos_dos_punts_opt nested_name_specifier_opt type_name
23 | . id_expression
26 dos_dos_punts: . DOS_DOS_PUNTS
27 dos_dos_punts_opt: . [IDENTIFIER]
28 | . dos_dos_punts
IDENTIFIER shift, and go to state 13
DOS_DOS_PUNTS shift, and go to state 1
IDENTIFIER [reduce using rule 27 (dos_dos_punts_opt)]
identifier go to state 14
id_expression go to state 15
qualified_id go to state 16
direct_declarator go to state 23
declarator_id go to state 20
dos_dos_punts go to state 21
dos_dos_punts_opt go to state 24
state 8
12 declaration: function_definition .
$default reduce using rule 12 (declaration)
state 9
28 dos_dos_punts_opt: dos_dos_punts .
$default reduce using rule 28 (dos_dos_punts_opt)
state 10
1 identifier: . IDENTIFIER
6 nested_name_specifier: . class_name dos_dos_punts
nested_name_specifier_opt
7 nested_name_specifier_opt: . [IDENTIFIER]
8 | . nested_name_specifier
18 simple_type_specifier: dos_dos_punts_opt . nested_name_specifier_opt
type_name
25 class_name: . identifier
IDENTIFIER shift, and go to state 13
IDENTIFIER [reduce using rule 7 (nested_name_specifier_opt)]
identifier go to state 25
nested_name_specifier go to state 26
nested_name_specifier_opt go to state 27
class_name go to state 28
state 11
0 $accept: declaration_seq $end .
$default accept
state 12
10 declaration_seq: declaration_seq declaration .
$default reduce using rule 10 (declaration_seq)
state 13
1 identifier: IDENTIFIER .
$default reduce using rule 1 (identifier)
state 14
2 id_expression: identifier .
$default reduce using rule 2 (id_expression)
state 15
23 declarator_id: id_expression .
$default reduce using rule 23 (declarator_id)
state 16
3 id_expression: qualified_id .
$default reduce using rule 3 (id_expression)
state 17
15 decl_specifier_seq: decl_specifier_seq_opt decl_specifier .
$default reduce using rule 15 (decl_specifier_seq)
state 18
14 decl_specifier: simple_type_specifier .
$default reduce using rule 14 (decl_specifier)
state 19
21 direct_declarator: direct_declarator . '(' ')'
24 function_definition: decl_specifier_seq_opt direct_declarator . '{' '}'
'(' shift, and go to state 29
'{' shift, and go to state 30
state 20
20 direct_declarator: declarator_id .
$default reduce using rule 20 (direct_declarator)
state 21
1 identifier: . IDENTIFIER
5 qualified_id: dos_dos_punts . identifier
28 dos_dos_punts_opt: dos_dos_punts . [IDENTIFIER]
IDENTIFIER shift, and go to state 13
IDENTIFIER [reduce using rule 28 (dos_dos_punts_opt)]
identifier go to state 31
state 22
1 identifier: . IDENTIFIER
4 qualified_id: dos_dos_punts_opt . nested_name_specifier identifier
6 nested_name_specifier: . class_name dos_dos_punts
nested_name_specifier_opt
7 nested_name_specifier_opt: . [IDENTIFIER]
8 | . nested_name_specifier
18 simple_type_specifier: dos_dos_punts_opt . nested_name_specifier_opt
type_name
22 declarator_id: dos_dos_punts_opt . nested_name_specifier_opt type_name
25 class_name: . identifier
IDENTIFIER shift, and go to state 13
IDENTIFIER [reduce using rule 7 (nested_name_specifier_opt)]
identifier go to state 25
nested_name_specifier go to state 32
nested_name_specifier_opt go to state 33
class_name go to state 28
state 23
13 simple_declaration: simple_type_specifier direct_declarator . ';'
21 direct_declarator: direct_declarator . '(' ')'
';' shift, and go to state 34
'(' shift, and go to state 29
state 24
1 identifier: . IDENTIFIER
4 qualified_id: dos_dos_punts_opt . nested_name_specifier identifier
6 nested_name_specifier: . class_name dos_dos_punts
nested_name_specifier_opt
7 nested_name_specifier_opt: . [IDENTIFIER]
8 | . nested_name_specifier
22 declarator_id: dos_dos_punts_opt . nested_name_specifier_opt type_name
25 class_name: . identifier
IDENTIFIER shift, and go to state 13
IDENTIFIER [reduce using rule 7 (nested_name_specifier_opt)]
identifier go to state 25
nested_name_specifier go to state 32
nested_name_specifier_opt go to state 35
class_name go to state 28
state 25
25 class_name: identifier .
$default reduce using rule 25 (class_name)
state 26
8 nested_name_specifier_opt: nested_name_specifier .
$default reduce using rule 8 (nested_name_specifier_opt)
state 27
1 identifier: . IDENTIFIER
18 simple_type_specifier: dos_dos_punts_opt nested_name_specifier_opt .
type_name
19 type_name: . class_name
25 class_name: . identifier
IDENTIFIER shift, and go to state 13
identifier go to state 25
type_name go to state 36
class_name go to state 37
state 28
6 nested_name_specifier: class_name . dos_dos_punts
nested_name_specifier_opt
26 dos_dos_punts: . DOS_DOS_PUNTS
DOS_DOS_PUNTS shift, and go to state 1
dos_dos_punts go to state 38
state 29
21 direct_declarator: direct_declarator '(' . ')'
')' shift, and go to state 39
state 30
24 function_definition: decl_specifier_seq_opt direct_declarator '{' . '}'
'}' shift, and go to state 40
state 31
5 qualified_id: dos_dos_punts identifier .
$default reduce using rule 5 (qualified_id)
state 32
1 identifier: . IDENTIFIER
4 qualified_id: dos_dos_punts_opt nested_name_specifier . identifier
8 nested_name_specifier_opt: nested_name_specifier . [IDENTIFIER]
IDENTIFIER shift, and go to state 13
IDENTIFIER [reduce using rule 8 (nested_name_specifier_opt)]
identifier go to state 41
state 33
1 identifier: . IDENTIFIER
18 simple_type_specifier: dos_dos_punts_opt nested_name_specifier_opt .
type_name
19 type_name: . class_name
22 declarator_id: dos_dos_punts_opt nested_name_specifier_opt . type_name
25 class_name: . identifier
IDENTIFIER shift, and go to state 13
identifier go to state 25
type_name go to state 42
class_name go to state 37
state 34
13 simple_declaration: simple_type_specifier direct_declarator ';' .
$default reduce using rule 13 (simple_declaration)
state 35
1 identifier: . IDENTIFIER
19 type_name: . class_name
22 declarator_id: dos_dos_punts_opt nested_name_specifier_opt . type_name
25 class_name: . identifier
IDENTIFIER shift, and go to state 13
identifier go to state 25
type_name go to state 43
class_name go to state 37
state 36
18 simple_type_specifier: dos_dos_punts_opt nested_name_specifier_opt
type_name .
$default reduce using rule 18 (simple_type_specifier)
state 37
19 type_name: class_name .
$default reduce using rule 19 (type_name)
state 38
1 identifier: . IDENTIFIER
6 nested_name_specifier: . class_name dos_dos_punts
nested_name_specifier_opt
6 | class_name dos_dos_punts .
nested_name_specifier_opt
7 nested_name_specifier_opt: . [IDENTIFIER]
8 | . nested_name_specifier
25 class_name: . identifier
IDENTIFIER shift, and go to state 13
IDENTIFIER [reduce using rule 7 (nested_name_specifier_opt)]
identifier go to state 25
nested_name_specifier go to state 26
nested_name_specifier_opt go to state 44
class_name go to state 28
state 39
21 direct_declarator: direct_declarator '(' ')' .
$default reduce using rule 21 (direct_declarator)
state 40
24 function_definition: decl_specifier_seq_opt direct_declarator '{' '}' .
$default reduce using rule 24 (function_definition)
state 41
4 qualified_id: dos_dos_punts_opt nested_name_specifier identifier .
$default reduce using rule 4 (qualified_id)
state 42
18 simple_type_specifier: dos_dos_punts_opt nested_name_specifier_opt
type_name . [IDENTIFIER, DOS_DOS_PUNTS]
22 declarator_id: dos_dos_punts_opt nested_name_specifier_opt type_name .
['(', '{']
'(' reduce using rule 22 (declarator_id)
'{' reduce using rule 22 (declarator_id)
$default reduce using rule 18 (simple_type_specifier)
state 43
22 declarator_id: dos_dos_punts_opt nested_name_specifier_opt type_name .
$default reduce using rule 22 (declarator_id)
state 44
6 nested_name_specifier: class_name dos_dos_punts nested_name_specifier_opt
.
$default reduce using rule 6 (nested_name_specifier)
a a::b(){}
d c;