Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is an informal description of a simple language. Statements in the language are as follows: input a: output a: a: = b: a: =

image text in transcribed
Here is an informal description of a simple language. Statements in the language are as follows: input a: output a: a: = b: a: = 58: a: = a + 1: a: a - 1: if a o goto L: goto L: halt: read an integer from standard input device into the variable a. a can be any lower case letter. Write the value of a on standard output device (whatever it is), a can be any lower case letter. Assign to the variable a the value of the variable b. a and b can be any letter between a and z. Assign the value of 58 to the variable a. a can be any letter between a and x. 58 can be any single digit or multiple digit integer. Add 1 to a. a can be any lower case letter. Subtract 1 from a. a can be any lower case letter. If a 0, transfer control to statement labeled with L. L can be any letter between A and Z. a can be any lower case letter. Transfer control to statement labeled with L. L can be any letter between A and Z. Stop execution, program should always and with halt Lower case letters a-z represents names of integer variables, upper case letters A-Z represents names of labels. Each statement may have a label as a prefix, separated For example, the following program computes sum of two positive integers a + b. Preconditions: Variables a and b contain positive integers. Preconditions: Variables a and b contain positive integers, the contents of variable b is destroyed. input a: input b: a: = a + 1: b: b - 1: if b > 0 goto L: output a: halt: Task 1: Using the statements of the simple language described above, write a program compute the sum of two integers a and b, with the following specification Preconditions: Variables a and b contain positive integers. (might be positive, negative, or zero.) Preconditions: Variables x contains the sum a + b, the contents of a and b are preserved. Task 2: Develop a formal definitions of the language syntax using BNF notation. Make sure your grammar covers all the valid statements in this language. Here is an informal description of a simple language. Statements in the language are as follows: input a: output a: a: = b: a: = 58: a: = a + 1: a: a - 1: if a o goto L: goto L: halt: read an integer from standard input device into the variable a. a can be any lower case letter. Write the value of a on standard output device (whatever it is), a can be any lower case letter. Assign to the variable a the value of the variable b. a and b can be any letter between a and z. Assign the value of 58 to the variable a. a can be any letter between a and x. 58 can be any single digit or multiple digit integer. Add 1 to a. a can be any lower case letter. Subtract 1 from a. a can be any lower case letter. If a 0, transfer control to statement labeled with L. L can be any letter between A and Z. a can be any lower case letter. Transfer control to statement labeled with L. L can be any letter between A and Z. Stop execution, program should always and with halt Lower case letters a-z represents names of integer variables, upper case letters A-Z represents names of labels. Each statement may have a label as a prefix, separated For example, the following program computes sum of two positive integers a + b. Preconditions: Variables a and b contain positive integers. Preconditions: Variables a and b contain positive integers, the contents of variable b is destroyed. input a: input b: a: = a + 1: b: b - 1: if b > 0 goto L: output a: halt: Task 1: Using the statements of the simple language described above, write a program compute the sum of two integers a and b, with the following specification Preconditions: Variables a and b contain positive integers. (might be positive, negative, or zero.) Preconditions: Variables x contains the sum a + b, the contents of a and b are preserved. Task 2: Develop a formal definitions of the language syntax using BNF notation. Make sure your grammar covers all the valid statements in this language

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

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

1. How do media shape our thinking?

Answered: 1 week ago

Question

=+ What is the role of government in bargaining?

Answered: 1 week ago

Question

=+ Who is the negotiation partner at company level?

Answered: 1 week ago