Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
3 answers
106 views

I have used a normal if-elseif ladder to update some variables depending upon conditions. The condition can be either a, b or c. That's why I am using an if-elseif ladder. But, when I use the if-...
ppl_call_me_tima's user avatar
1 vote
1 answer
320 views

I am using antlr 'org.antlr:antlr4:4.9.2' and come across the "dangling else" ambiguity problem; see the following grammar IfStat.g4. // file: IfStat.g4 grammar IfStat; stat : 'if' expr '...
hengxin's user avatar
  • 2,011
0 votes
0 answers
88 views

I am trying to get rid of dangling else in my grammar. Terminals are capital-letter words. I have: statement: expression_statement (not important now ) | compound_statement (not important now ...
Riomare's user avatar
  • 85
0 votes
1 answer
224 views

I am feeding a (generated) grammar to Beaver parser generator. Multiple shift-reduce conflicts are caused by it seems like the dangling else problem in this rules: Condition = IF LPAR Expression....
Hawk's user avatar
  • 2,132
0 votes
1 answer
121 views

I am currently moving a fun-project of mine over to bison/flex as parser and have trouble solving a reduce/reduce conflict: // https://github.com/X39/yaoosl/blob/master/code-gen/yaoosl.y#L761-L766 ...
X39's user avatar
  • 827
1 vote
1 answer
384 views

I am implementing a parser for a language that has if-elsif-else statements and can't seem to make my grammar unambiguous. Our compilers class was given a handout on solving the dangling else problem ...
Corbin Schueller's user avatar
-7 votes
1 answer
238 views

How can the code work like this? Which if-else statements are linked with each other? So why is the output like that "$$$$$"? #include <stdio.h> int main() { int x = 11; int y = 9; ...
Atakan's user avatar
  • 1
-1 votes
2 answers
94 views

The book I'm reading (C How to Program with an into to C++ Global Edition, Deitel&Dietel, 2016) gives the following code: Note that this is how the book presents the code in the exercise section, ...
PerfectContrast's user avatar
-1 votes
1 answer
279 views

I have this doubt guys, I don't know; any example to understand will be great. Does the Kotlin programming language suffer from the "dangling else" problem? If the problem is there then what is the ...
Adam's user avatar
  • 21
2 votes
2 answers
1k views

In the case of the dangling else problem for compiler design, is there a reason to left factor it before removing ambiguity? We are transforming a CFG into an LL(1) grammar so my professor is asking ...
CSharpFiasco's user avatar
0 votes
1 answer
350 views

I have a dangling-else problem in Coco/R. I try to understand the Coco/R User Manual and I ask Google, but I can't solve the problem on my own. I simplified my problem to the following Coco/R grammar ...
Eric's user avatar
  • 1
1 vote
0 answers
765 views

I'm writing a small parser to recognize a subset of Java and I've run into an issue that I believe is called the dangling else problem. My grammar for matching if-else statements started off like ...
momonkey's user avatar
2 votes
0 answers
1k views

I am trying to write a simple compiler using Flex for scanner and a special tool named PGen to define grammars. Now, I am trying to solve unambiguous grammar for dangling else. I have searched for ...
Linda's user avatar
  • 251
3 votes
1 answer
3k views

In compiler construction, one of the main ambiguity problems is dangling else. As mentioned in Compilers: Principles, Techniques, and Tools book by Aho, Lam, Sethi and Ullman, the grammar for the ...
HATEM EL-AZAB's user avatar
1 vote
1 answer
1k views

I have the following if statement that parses correctly: ifStatement : 'IF' expression 'THEN' statementBlock (options {greedy=true;} : 'ELSE' statementBlock)? ; Now, I ...
pantelis's user avatar
  • 113