Questions tagged [shift-reduce]
25 questions
0
votes
1 answer
Nested Shift/reduce conflict in bison?
I am new to this and I am trying to understand what is going on here, where I get two shift reduce conflicts. I have grammar (If I am missing something I can add the needed rules):
%start translation_unit
%token EOF 0 "end of…

Riomare
- 65
- 1
- 10
0
votes
0 answers
Way to create productions for boolean operands in Bison
I'm creating a parser in Bison, and I am trying to convert the rules:
E := E op E
op := + | - | > | &
There are other rules for E, such as negation, and of course, E can be a number. I was wondering what the best way would be to create these…

Naz1706
- 5
- 3
0
votes
1 answer
How does a shift reduce parser know when to reduce?
I am writing a shift reduce parser in c#. I looked at some articles explaining it, but none of them go into much detail. Could someone point me to the direction of detailed explanations of shift reduce parsers, like how does it know when to reduce?

82.dev
- 1
- 1
0
votes
1 answer
Shift-Reduce Conflict in YACC for a rule starting with Action
%token A B
%%
start: {printf("Starting…\n");} A A
| A B;
My book says that there is a shift-reduce conflict when the token is A because yacc converts to code to this.
%token A B
%%
start: empty A A
| A B;
empty: {printf("Starting…\n");} ;
I…

BoraKurucu
- 39
- 1
- 1
- 8
0
votes
2 answers
Parsing a CFG with alternatives
I have a fairly simple language represented as a CFG.
S → A z
A → A y A
| A x A
| A w
| v
Since there's left-recursion, a recursive descent parser isn't going to cut it. However, I also need to find every possible interpretation: given v x v…

Draconis
- 3,209
- 1
- 19
- 31
0
votes
1 answer
Shift Reduce Conflicts
Below the grammar i make.
S' -> sqf
sqf -> declarations
declarations -> declaration
declarations -> declaration declarations
declaration -> relation
declaration -> norelation
relation -> head body
norelation -> relatts
norelation ->…

LChampo
- 77
- 1
- 8
0
votes
1 answer
How should binary operators be defined in bison?
I'm writing a parser in C with bison, and while it appears to work correctly in all circumstances I've tried so far, I get a bunch of shift/reduce warnings on my binary operators (and one on my unary NOT operator as well).
binary_op :
PLUS {…

mynameisash
- 1
- 1
- 2
0
votes
1 answer
Get TypedDependencies using StanfordParser Shift Reduce Parser
I am trying to use the Stanford Shift Reduce Parser with the Spanish model supplied. I am noticing, however, that unlike the Lexicalized Parser, I cannot get the TypedDependencies, despite sending the adequate flag -outputFormat typedDependencies,…

SoManyGoblins
- 5,605
- 8
- 45
- 65
0
votes
1 answer
yacc stop doing shift&& reduce once cannot get any more symbol from yylex()
here is my code:
%{
#include
#include "y.tab.h"
#define DEBUG 0
void yyerror(char* s);
void debug(char* string) {
if (DEBUG) {
printf(string);
}
}
%}
selector "selector"[0-9]+
positive "+"
negtive "-"
contains …

yeren1989
- 291
- 1
- 3
- 13
-2
votes
1 answer
Shift/Reduce conflict in first state due to epsilon rule
I have shift/reduce conflict in bison.
I checked the parser.output file:
State 0
0 $accept: . Prog $end
STRUCT shift, and go to state 1
$default reduce using rule 6 (Structs)
Prog go to state 2
Structs go to state 3
StructDec go…

SuzLy
- 133
- 1
- 10