Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I would be really thankful if you could help me out with the details. I am really confused about this assignment. And please don't copy

I would be really thankful if you could help me out with the details. I am really confused about this assignment. And please don't copy other answers to here.

image text in transcribed

Create an EBNF specification for the following language as described below. Please note that the EBNF does not indicate WHAT the keywords do, simply the syntax of the language: (in this description, keywords are in bold.) The language has a very simple syntax in which you can assign values to variables, perform basic arithmetic operations on these variables, and print the values of variables. There is no string manipulation, but there is string output. All tokens must be separated by a space or whitespace. A variable is declared by using the keyword var and then the variable name. You may only declare one variable per line. Assignment statements are in the form of a variable name, and equal sign, and then an expression that evaluates to a numeric answer. For the sake of simplicity, assume only integers and floating-point numbers (in other words, you do not need to worry about scientific notation). Variables names must start with a letter and then may contain letters, numbers, or the _ character. Variable names must be no longer than 63 characters. To print something, use the . keyword followed by a variable, constant, or a list of variables or constants separated by commas or semicolons. A comma indicates that you want a space between the items in the output and a semicolon means no space between the two items. You may also include strings as constants by enclosing them in double quotes. The output will automatically go to the next line unless the line ends with a comma or semicolon. The input statement is the > operator, followed by a space and then a single variable that will receive the input. Comments begin with // and proceed to the end of the line. They must be on a line by themselves. Math operators are +/% (modulo) and (exponent) Parentheses are allowed in math expressions and behave as you would expect. You may not define functions. A program must start with the keyword begin and must end with the keyword end. These keywords must appear on lines by themselves. Example program to help you check your EBNF: // Sample program in the tiny language begin varx ." Input your age: "; x ." You are", x, "years old." vary y=x+10 ." In 10 years, you will be", y, "years old." end As you can see, this language can't do much, but it's just for an exercise

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

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions