Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(10 points) Consider a fictitious programming language containing only two numerical types integer and real), in which arbitrarily long (possibly empty) 1-dimensional arrays of numbers

image text in transcribed

(10 points) Consider a fictitious programming language containing only two numerical types integer and real), in which arbitrarily long (possibly empty) 1-dimensional arrays of numbers are declared, instantiated, and initialized in a single statement, two of which are given below: integer [] numbers = { 1, 5, 7, 9, 10 }; reall) reals = { 2.0, 3.35, 1.24, 54.145, -4.9 }; Write an EBNF grammar with as its start symbol that can generate all and only the syntactically correct array declarations of this form. Instead of creating rules to generate the set of all possible identifiers (variable names), integer constants, and floating point constants, your grammar must refer to the non-terminals , , and , which can be assumed to be already defined elsewhere. (To think about: Why does it make sense for these non-terminals to be defined in another grammar, or in a distinct part of the grammar?) For full credit, you MUST use EBNF extensions WHENEVER possible to minimize the number of productions in your grammar (10 points) Consider a fictitious programming language containing only two numerical types integer and real), in which arbitrarily long (possibly empty) 1-dimensional arrays of numbers are declared, instantiated, and initialized in a single statement, two of which are given below: integer [] numbers = { 1, 5, 7, 9, 10 }; reall) reals = { 2.0, 3.35, 1.24, 54.145, -4.9 }; Write an EBNF grammar with as its start symbol that can generate all and only the syntactically correct array declarations of this form. Instead of creating rules to generate the set of all possible identifiers (variable names), integer constants, and floating point constants, your grammar must refer to the non-terminals , , and , which can be assumed to be already defined elsewhere. (To think about: Why does it make sense for these non-terminals to be defined in another grammar, or in a distinct part of the grammar?) For full credit, you MUST use EBNF extensions WHENEVER possible to minimize the number of productions in your grammar

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_2

Step: 3

blur-text-image_3

Students also viewed these Databases questions

Question

What is the pH of a 0.050 M solution of formic acid, pKa = 3.75?

Answered: 1 week ago

Question

What are three myths about mindfulness?

Answered: 1 week ago

Question

Add the spelling and grammar command to the quick access toolbar

Answered: 1 week ago