Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Give an example of the shortest CASE statement in Modula-2. (Shortest means fewest number of lexemes.) Use the EBNF description of the Modula-2 language below

Give an example of the shortest CASE statement in Modula-2. ("Shortest" means fewest number of lexemes.)

Use the EBNF description of the Modula-2 language below to answer the question.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

APPENDIX II EBNF Description of Modula-2's Syntax This appendix contains a complete EBNF (Extended Backus-Naur Form) descrip- tion of Modula-2's syntax. An EBNF description of a language consists of a series of productions. Each production defines a syntactic construct; for example, the production Enumeration-"(" IdentList ")". states that an enumeration type consists of a left parenthesis, followed by an iden- tifier list, followed by a right parenthesis. The symbol to the left of the equals sign is called a nonterminal; it represents the syntactic construct being defined. The symbols to the right of the equals sign define the construct; these symbols include both nonterminals (IdentList, in the preceding example) and terminals (symbols that can actually appear in a program, including letters, digits, reserved words, and special symbols). Each production ends with a period. The equals sign and period are called metasymbols, because they are part of the EBNF description, not part of the language being defined. Terminals (other than reserved words) are always enclosed in quotation marks to avoid confusion with metasymbols. In addition to the equals sign and period, several other metasymbols can appear in productions A vertical bar | separates alternate definitions of a syntactic construct. For example, the production Number = Integer l Real. states that a Number can be either an Integer or a Real. duction Forma!Type = [ARRAY OF] Qualident. states that a FormalType is a Qualident, possibly preceded by the words ARRAY Square brackets [] surround an optional portion of a construct. The pro- OF Braces )surround a portion that we can omit or repeat as many times as we desire. The production 499 APPENDIX II EBNF Description of Modula-2's Syntax This appendix contains a complete EBNF (Extended Backus-Naur Form) descrip- tion of Modula-2's syntax. An EBNF description of a language consists of a series of productions. Each production defines a syntactic construct; for example, the production Enumeration-"(" IdentList ")". states that an enumeration type consists of a left parenthesis, followed by an iden- tifier list, followed by a right parenthesis. The symbol to the left of the equals sign is called a nonterminal; it represents the syntactic construct being defined. The symbols to the right of the equals sign define the construct; these symbols include both nonterminals (IdentList, in the preceding example) and terminals (symbols that can actually appear in a program, including letters, digits, reserved words, and special symbols). Each production ends with a period. The equals sign and period are called metasymbols, because they are part of the EBNF description, not part of the language being defined. Terminals (other than reserved words) are always enclosed in quotation marks to avoid confusion with metasymbols. In addition to the equals sign and period, several other metasymbols can appear in productions A vertical bar | separates alternate definitions of a syntactic construct. For example, the production Number = Integer l Real. states that a Number can be either an Integer or a Real. duction Forma!Type = [ARRAY OF] Qualident. states that a FormalType is a Qualident, possibly preceded by the words ARRAY Square brackets [] surround an optional portion of a construct. The pro- OF Braces )surround a portion that we can omit or repeat as many times as we desire. The production 499

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Investing All In One For Dummies

Authors: Eric Tyson

2nd Edition

1119873037, 978-1119873037

Students also viewed these Databases questions