A final solution to the Dangling else of ALGOL 60 and related languages

Author:

Abrahams Paul W.1

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)

Subject

General Computer Science

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

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3