|
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 |
 |
mrzdiva79: stop the madness and be a man and say what u want and stop Dangling ppl in the wind..u either do or u dont u either will or u |
 |
AgentKodak: Grown ass man with red dickies,white hat n red n black Dangling earrings#onlynrichmond |
 |
mcwbr: .@SpzKaz You folks applied that term to yourselves when your movement began. Wore hats with teabags Dangling in your faces. |
|