53 questions
2
votes
1
answer
109
views
Can an SLR(1) Parser Have Accept/Reduce Conflicts?
Consider the following grammar:
S → A
A → S | a
This grammar would have an accept/reduce conflict in the SLR(1) parsing table in the state with the following kernel when reading the end symbol($):
...
1
vote
1
answer
535
views
What do reduce/reduce and shift/reduce conflicts mean in terms of the grammar structure? [closed]
I have to construct LR(0) table to know if there are any sort of conflicts? Is there a way to look at the grammar and tell if there's a conflict without constructing the table? So yeah, the question ...
1
vote
1
answer
49
views
Eliminating shift/reduce conflict in bison parser
I am working on defining a bison grammar for http and am dealing with a number of shift/reduce conflicts with regards to how optional whitespace is handled at the end of the header field value. Here ...
1
vote
0
answers
54
views
Can the grammar of the concatenation of two lists with common elements be written as an LALR grammar without any collisions
Can the following ABNF rules be written as a bison LALR grammar without any conflicts (shift/reduce or reduce/reduce)?
Among them, lowercase letters are non-terminal symbols, and uppercase letters are ...
0
votes
1
answer
180
views
How to resolve reduce-reduce conflict in Irony?
I'm writing an extended mathematical expression evaluator. It is supposed to allow defining macros in the form:
f(x):=2*x
I'm using Irony to break the expression into the parse tree. Grammar looks ...
0
votes
0
answers
53
views
Cannot find shift/reduce & reduce/reduce errors
Ive been working on a project and have come across:
Below is the list of if declarations, I have everything here except for the types in typeSpec, but we don't have to worry about those for right now....
2
votes
1
answer
944
views
Bison reduce/reduce conflict between lambda expression and parenthesized identifier
I'm attempting to write my own programming language at the moment, and I have the following simplified grammar:
...
%%
prog: stmtlist | %empty;
block: "{" stmtlist "}";
...
0
votes
1
answer
250
views
Multiplication by juxtaposition in yacc
I'm trying to implement a grammar that allows multiplication by juxtaposition.
This is for parsing polynomial inputs for a CAS.
It works quite well, except few edge cases, as far as I'm aware of.
...
0
votes
2
answers
426
views
reduce-reduce, shift-reduce conflicts in a grammar
expression -> expression OPER expression
expression -> PREFIX expression
expression -> expression POSTFIX
expression -> expression ‘?’ expression ‘:’ expression
expression -> expression ...
0
votes
1
answer
52
views
Shift-reduce and reduce-reduce conflicts with LR
This is the grammar:
expr-> expr OPER expr
expr->PREFIX expr
expr->expr POSTFIX
expr->expr ‘?’ expr ‘:’ expr
expr->expr‘[’ expr ‘]’
expr->expr‘(’ expr ‘)’
expr->ID
expr->...
0
votes
1
answer
539
views
How to resolve reduce reduce conflicts in bison?
Firstly, I have already referred to many similar questions here, but unable to resolve the conflicts.
I have this piece in my .y file
.
.
.
obj
: INT { $$ = objNew($1, INT_T); }
| FLOAT { $$ = ...
1
vote
0
answers
101
views
Reduce/reduce conflicts
I'm trying to create a parser for a simple language, but I can't get rid of some reduce/reduce conflicts because of the rules expr: l_value and r_value: '@' l_value. I tried to fix it determining a ...
1
vote
1
answer
323
views
LR(1) Parser: Why adding an epsilon production makes r/r or s/r conflicts
I wanted to make a reader which reads configuration files similar to INI files for mswin.
It is for exercise to teach myself using a lexer/parser generator which I made.
The grammar is:
%lexer
...
2
votes
1
answer
1k
views
How to resolve this reduce/reduce conflict?
I am writing a compiler for the B programming language. The grammar of this language distinguishes lvalues and rvalues syntactically. While translating the grammar into yacc syntax, I stumbled upon ...
0
votes
1
answer
128
views
Bison eliminate reduce/reduce conflict among nullable non-terminals?
I am using Bison (AFAIK they use LL(1) parsing as default).
My grammar says something like this:
function_decl: ID '(' params ')' ':' TYPE ... // body may go here
function_call: ID '(' arguments ')'
...
1
vote
0
answers
381
views
Redux state is not updated Issue. But redux logger shows the correct action and next state update
I am using Redux for my web application. State has to be updated after user login. Redux logger is used for debugging. Everything is fine in redux logger but state is not updated. Please give any idea ...
1
vote
1
answer
261
views
Bison shift/reduce and reduce/reduce conflict
OK, I have tried to rewrite this Bison grammar three times now and keep running into shift/reduce and reduce/reduce conflicts. The Syntax that I am trying to parse is as follows. The items in the {.....
7
votes
0
answers
97
views
Happy: Order of Productions Removes R/R Conflicts
I have a grammar that, depending on the order of productions, happy reports 3 reduce/reduce conflicts or none. The minimal example I can find is:
%tokentype {Token}
%token
int { Int }
'-' ...
2
votes
0
answers
113
views
Finding reduce-reduce conflict examples
While many questions are asking to help solve reduce-reduce conflicts, I don't have any of those and I am actually asking your help to find some.
I am writing documentation and exercices about LR(1) ...
0
votes
0
answers
40
views
conflicts: 1 reduce/reduce, error: expected ',' or '}' before '.' token
Problem Part of grammar:
tracelevel
: TRACELEVEL LPAREN IDENT RPAREN { $$ = makeFuncTraceLevel($3); }
| TRACELEVEL error { $$ = 0; error("Expected 'log(<EV_TRACE>...
1
vote
2
answers
696
views
Bison reduce/reduce conflicts
I have written following grammar:
%union{
string *s;
float num;
}
%token div_token mod_token sqrt_token it_token abs_token
%token <num> num_token
%token <s> Stampa
%type <num&...
0
votes
1
answer
470
views
Resolving reduce-reduce conflict
Problem part of grammar:
expr_var: var_or_ID
| expr_var '[' expr ']'
| NEW expr_var '(' expr_listE ')'
| expr_var '(' expr_listE ')'
| expr_var ARROW expr_var
| expr_var ARROW '{' expr_var '}'
| ...
0
votes
1
answer
77
views
Why doesn't this grammar have a reduce/reduce conflict?
Consider the following (admittedly nonsensical - it has been vastly simplified to illustrate the point) grammar:
negationExpression
: TOK_MINUS constantExpression %prec UNARYOP
| testRule
...
0
votes
0
answers
122
views
bison - can't solve reduce-reduce conflict
I tried some of the solutions I found here but it didn't work (could be that I applied them wrong though).
Here is some of my grammar:
Program: Marker1 PROGRAM DECLARATIONS STATEMENTS END
;
...
0
votes
1
answer
149
views
Bison issue with reduce/reduce conflict
So I am new to Bison and I am trying to make a simple calculator.
When I do the bison -d command it says there are 7 reduce/reduce conflicts and I am not really sure why is this, I know it's because ...
0
votes
1
answer
104
views
Bison reduce/reduce conflict in grammar
I'm building a grammar in bison and I have a r/r conflict (which I know where it is), but I don't know how to fix it. I would appreciate any possible help.
The part of my code that includes the ...
0
votes
1
answer
129
views
Javascript function declaration bison grammar reduce/reduce error
I'm implementing a javascript interpreter and I'm having trouble with a bison reduce/reduce conflict in the grammar for function declarations and function expressions. I'm not all that experienced ...
4
votes
2
answers
8k
views
Resolving reduce/reduce conflicts
We have a CFG grammar and we construct LR(1) Parsing Table. We see that one cell on the parsing table have a reduce - reduce conflict. Is it possible to solve this conflict by using more input symbols ...
1
vote
1
answer
218
views
Reduce/reduce conflict
I am writing a grammar (YACC - "LALR") that should recognize the following words, for example:
ident(ident,...,ident) = ident(num,ident,num,...,num)
ident(ident,...,ident) = num
ident = num
ident = ...
0
votes
1
answer
425
views
Irony Reduce-Reduce Problems
I have been trying to figure out this same issue for almost 2 weeks now. At first it was shift-reduce errors now its reduce-reduce problems. I have tried doing it so many ways and now I have came to ...
0
votes
0
answers
378
views
Irony Shift Reduce Problems
I have been trying to figure out how to fix some shift reduce conflicts I have. I have looked around and found different topics on fixing it but it seems like no matter what I do I just can't seem to ...
1
vote
2
answers
136
views
Text/String values sent in the Mapper are wrong when I read them in the Reducer
I am sending some data in the Mapper and when I try to read them in the Reducer, they have changed a little. In resume, I fill the data using the set functions and then I read them in the reducer ...
0
votes
1
answer
169
views
reduce/reduce conflict with untyped variables and function calls
i want to create a parser for a dynamically typed language.
in my bison file i have a rule for runtimetyped which is a variable name or a function call.
runtimetyped : T_ID { $$ = create_identifier($...
1
vote
1
answer
2k
views
How to solve casting error from IntWritable to Mutation? Map Reduce HBase
I have the following error when I try to pass an IntWritable from my mapper to my reducer:
INFO mapreduce.Job: Task Id : attempt_1413976354988_0009_r_000000_1, Status : FAILED
Error: java.lang....
0
votes
1
answer
140
views
How to get rid of reduce-reduce bison
my code is the following:
%%
%token blablabla
%%
expresion: operand
operand '-' expresion
|operand '+' expresion
| '(' expresion ')' /*Conflict line*/
;
/*...
0
votes
3
answers
360
views
Reduce/reduce conflict in a C-style cast operator
I am writing a bison+flex parser for a certain query language and I need to add a C-style cast operator to it. Here is the relevant part of the code:
%token <characterToken> Identifier
%token &...
0
votes
1
answer
253
views
Grammar conflict - Reduce Reduce Conflict Gold sparser
Im get a conflict reduce-reduce in the below code , ive tried almost all i ideas i came up with to solving it heres the report of the problem, this is a BNF->Gold parser conversion any ideas to solve ...
0
votes
1
answer
559
views
Bison/Yacc reduce reduce conflict for a specific grammar example
I have a parser project for my compilers class. I could not resolve a reduce/reduce conflict for one of the rules.
The graphical representation of this grammar rule is available at this link (sorry I ...
1
vote
2
answers
534
views
Removing reduce/reduce conflicts
I've created a compiler for a language which has the following grammer, as defined by ML-Yacc (Starting symbol is "program" which is defined at the bottom):
%nonassoc FUN VAR ASSIGN PLUSASSIGN ...
0
votes
0
answers
205
views
Conflicts in ocamlyacc
I am trying to write a parser for a simple language that recognizes integer and float expressions using ocamlyacc. However I want to introduce the possiblity of having variables. So i defined the ...
1
vote
1
answer
766
views
Reduce/Reduce conflict when introducing pointers in my grammar
I'm working on a small compiler in order to get a greater appreciation of the difficulties of creating one's own language. Right now I'm at the stage of adding pointer functionality to my grammar but ...
0
votes
2
answers
190
views
Reduce -reduce conflict in grammar
I am getting a reduce/reduce conflict for the following grammar in bison because n is also an epsilon production.
m : {$$=line_no;}
;
n : {
...
0
votes
1
answer
72
views
Controlling token reduction
is there a way to controll the reduction operation of a token with ANTLR at runtime.
For example, I've an ANTLR grammar that looks like:
s: ( a | b);
a: WORD;
b: WORD;
WORD: ('a'..'z')+
Where the ...
3
votes
1
answer
428
views
Simple ambiguous grammar with reduce-reduce conflict
The following simple grammar to parse a logical expression results in a reduce/reduce conflict:
%token AND OR
%token NUMBER VARIABLE
%%
logical_expr
: logical_expr AND logical_term
| ...
0
votes
1
answer
968
views
EBNF to Bison - Reduce/Reduce error
i have to translate this EBNF to bison:
<compound-statement> ::= begin [ <statement> ( ; <statement> )*] end
<statement> ::=
| <assignment>
| <if-statement>
| &...
1
vote
2
answers
612
views
How do I solve this reduce/reduce conflict in Bison?
Here is an excerpt from [filename].output
state 94
32 expr: expr . opt_at_type '.' TYPEID '(' opt_expr_list ')'
39 | expr . '+' expr
40 | expr . '-' expr
41 | expr . '*' ...
3
votes
1
answer
1k
views
happy: reduce/reduce conflict
Why this raises a warning about reduce/reduce conflict
root : set1 'X'
| set2 'X' 'X'
set1 : 'A'
| 'B'
set2 : 'B'
| 'C'
but the next is ok?
...
1
vote
1
answer
253
views
YACC grammar reduce/reduce conflict
I have the following grammar for checking the validity of an XML file, the file starts with an element and then the root node.
program
: terminal_node
root
;
root
: '<' ID ...
1
vote
2
answers
286
views
How do i tell bison there is a syntax error?
What happen is there is a specific case where after analyzing the AST i will know if there is an error or not when the rule is finished. I tried yyerror("blah") with no luck.
Because i cant tell it ...
4
votes
1
answer
4k
views
Bison reduce/reduce
I am new to Bison parsing and I cannot understand how it works. I have the following grammar, where I have kept the bare minimum to highlight the problem.
%left '~'
%left '+'
%token T_VARIABLE
%%
...