Affiliation:
1. Information International, Inc., New York, NY
Abstract
The dangling else problem consists of a class of potential ambiguities in ALGOL-like conditional statements whose basic form is “if
B
1 then if
B
2 then
S
1 else
S
2” where
B
1 and
B
2 are Boolean expressions and
S
1 and
S
2 are basic statements. The difficulty lies in whether to attach the else to the first if or to the second one. Existing solutions to the problem are either ambiguous or unnecessarily restrictive. Let
S
and
S
1 be statements. We define
S
to be
closed
if “
S
else
S
1” is not a statement, and to be
open
if “
S
else
S
1” is a statement. Thus an unconditional statement is a closed statement. Open and closed conditional statements are defined by syntax equations in such a way as to preserve openness and closure. In each case, an else must always be preceded by a closed statement. It is shown that the syntax equations are unambiguous, and that any change in the statement types required within the syntax equations would lead to either ambiguity or unnecessary restriction.
Publisher
Association for Computing Machinery (ACM)
Reference10 articles.
1. Letters to the editor: syntax and generalization of ALGOL 60
2. COBOL-1961: revised specifications for a common business oriented language. Publ. 0-598941 U.S. Government Printing Office Washington D.C. 1961. COBOL-1961: revised specifications for a common business oriented language. Publ. 0-598941 U.S. Government Printing Office Washington D.C. 1961.
3. Syntactic Analysis and Operator Precedence
4. PL/I: Language specifications. Form C26-6571-2 IBM Programming Systems Publications Poughkeepsie N.Y. Jan. 1966. PL/I: Language specifications. Form C26-6571-2 IBM Programming Systems Publications Poughkeepsie N.Y. Jan. 1966.
Cited by
8 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. JISET;Proceedings of the 35th IEEE/ACM International Conference on Automated Software Engineering;2020-12-21
2. RTFM-core;ACM SIGBED Review;2017-01-05
3. RTFM-core;Proceedings of the WESE'14: Workshop on Embedded and Cyber-Physical Systems Education;2014-10-12
4. Security Applications of Formal Language Theory;IEEE Systems Journal;2013-09
5. BNF Programming, Analyzing, and Compiling;Studies in Computer Science and Artificial Intelligence;1988