|
Dangling else - Definition and Overview |
|
|
|
|
The dangling else is a well-known problem in computer programming in which a seemingly well-defined grammar can become ambiguous. In many programming languages you can write code like this:
if a then if b then s1 else s2
which can be understood in two ways. Either as
if a then
if b then
s1
else
s2
or as
if a then
if b then
s1
else
s2
This is a problem that often comes up in compiler construction. It can be solved either at the implementation level, by telling the parser what the right way to solve the ambiguity is, or at the grammar level by using a Parsing expression grammar or equivalent.
External links
- [1] (http://www.scit.wlv.ac.uk/cbook/chap5.dangling.else.html)
|
|
Example Usage of Dangling |
 |
Ocean_Bay: Amethyst Beaded Dangling Earrings by OceanBayDesigns on Etsy http://ow.ly/Buvl |
 |
KemDotLifer: i cannot stand it when dudes have dumb shyt Dangling from their jeans. cudi did it and it was whack. omarion's doing it. still.whack. |
 |
autopsytheclown: lol, naa I would of had the kid Dangling by 1 leg RT @PhoneTrips To @autopsytheclown Is the entry for SEP 15 you? http://bit.ly/39rOhm |
|