LALR parsers (lookahead LR) are a family of parsers that are often used in parser generators. They provide a balance between the expressivity of LR(1) parsers and the size of LR(0) parsers.
Questions tagged [lalr]
176 questions
0
votes
1 answer
How does an LALR(1) grammar differentiate between a variable and a function call?
Given the following input:
int x = y;
and
int x = y();
Is there any way for an LALR(1) grammar to avoid a shift/reduce conflict? The shift/reduce conflict is deciding to reduce at y or continue to (.
(This is assuming that a variable name can be…

sdasdadas
- 23,917
- 20
- 63
- 148
0
votes
2 answers
Where is this shift/reduce conflict coming from in Bison?
I am trying to get the hang of parsing by defining a very simple language in Jison (a javascript parser). It accepts the same / very similar syntax to bison.
Here is my grammar:
%token INT TRUE FALSE WHILE DO IF THEN ELSE LOCATION ASSIGN EOF…

user2269972
- 31
- 1
- 2
0
votes
1 answer
How to fix grammar with optional non-terminal?
I wrote grammar for LALR parser and I am stuck at optional non-terminal. Consider for example C++ dereference, when you can write:
******expression;
Of course you can write:
expression;
And here is my problem, dereference non terminal is optional…

greenoldman
- 16,895
- 26
- 119
- 185
0
votes
1 answer
Bison - handling non LALR(1) grammars
I am making a simple calculator using flex, bison.
I developed a grammar which includes two type of expressions - integer expressions and real expressions.
The grammar is similar to this:
exp -> intExp | realExp
intExp -> INT | intExp '+'…

Jayanth Koushik
- 9,476
- 1
- 44
- 52
0
votes
1 answer
LALR grammar ambiguous
I have made a grammar for boolean and arithmetic expressions. I want to handle arithmetic expressions like:
(1+5)+(-3)
I'm done with that work: I can handle all the expressions I want.
My problem is that a boolean expression can be something…

Jorge Silva
- 225
- 1
- 3
- 10
0
votes
1 answer
PCYACC expect keyword equivalent
Is there a keyword in PCYACC which is equivalent to BISON's expect declaration:
%expect NUMBER

manu_dilip_shah
- 880
- 14
- 32
-1
votes
1 answer
Recursive descent vs recursive ascent parsing
If I'm writing my own custom parser, how can I know if I'm writing a recursive ascent parser? I'm definitely interested in the O(n) complexity of LALR parsing (plus I already have a LALR grammar) and don't want to find out later that I've written an…

Puppy
- 144,682
- 38
- 256
- 465
-1
votes
1 answer
LALR(1) Parser Not Parsing The Text At All
I have to admit I'm an absolute newbie in this and might not even understand what I am doing.
I am trying to make a grammar that at least contains grammar from BABA IS YOU, and if possible expands on it. I am using this tool to debug my grammar:…

Ludwig Von Chesterfield
- 140
- 11
-1
votes
1 answer
Why JDT parser didn't pops elements when the state is shift-reduce?
According to A pratyical method for constructing efficient LALR(K) Parsers with Automatic Error Recovery
in chapter 4.2 .
When the parser encounters a shift-reduce , it should pops |α| elements. But the parser in JDT ,it did't pops elements. I…

kuafuking
- 89
- 6
-1
votes
1 answer
A Grammar And some challenge about SLR, LALR
I know:
A language is said to be LL(1) if it can be generated by a LL(1) grammar. It can be shown that LL(1) grammars are
not ambiguous and
not left-recursive.
but i ran into a problem.
Why the Grammar
S-> aBDb
B -> lambda
D-> dD |…
user3929084
-2
votes
1 answer
Can this be parsed by a LALR(1) parser?
I am writing a parser in Bison for a language which has the following constructs, among others:
self-dispatch: [identifier arguments]
dispatch: [expression . identifier arguments]
string slicing: expression[expression,expression] - similar to…

Călin
- 347
- 2
- 13