Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The programming language Pascal has a repeat...until construct for a logical post-test loop. The syntax is given by the following BNF (with the relevant production

  1. The programming language Pascal has a repeat...until construct for a logical post-test loop. The syntax is given by the following BNF (with the relevant production underlined)...Extend the attribute grammar from the slides to include operational semantics for repeat...until loops.

Everything you need to complete the problem is here. The language is the normal BNF.

Syntax and Semantics on "slides":

image text in transcribed

Problem:

image text in transcribed

id = {.code = .code || id.lexeme = .place} > [2] + [3] {.place = new Temp() .code = "[2].code || [3].code ||.place = [2].place + [3].place"} > [2] * [3] { // similar to above} > ([2]) {.place = [2].place .code = [2].code } > id {.place = id.lexeme .code = { } int-literal { .place = new Temp() .code = .place = int-literal.value 5. The programming language Pascal has a repeat...until construct for a logical post-test loop. The syntax is given by the following BNF (with the relevant production underlined): | | | // Syntax and semantics for , , and are as given in // slides (using an attribute grammar). repeat until (id[1] relop id[2]). The loop executes the statement(s) between the repeat and the until, tests the logical condition following the until keyword, and repeats the loop body if the condition is false. If exits the loop when the condition is true. Note that it always executes the loop body at least once. Extend the attribute grammar from the slides to include operational semantics for repeat...until loops. id = {.code = .code || id.lexeme = .place} > [2] + [3] {.place = new Temp() .code = "[2].code || [3].code ||.place = [2].place + [3].place"} > [2] * [3] { // similar to above} > ([2]) {.place = [2].place .code = [2].code } > id {.place = id.lexeme .code = { } int-literal { .place = new Temp() .code = .place = int-literal.value 5. The programming language Pascal has a repeat...until construct for a logical post-test loop. The syntax is given by the following BNF (with the relevant production underlined): | | | // Syntax and semantics for , , and are as given in // slides (using an attribute grammar). repeat until (id[1] relop id[2]). The loop executes the statement(s) between the repeat and the until, tests the logical condition following the until keyword, and repeats the loop body if the condition is false. If exits the loop when the condition is true. Note that it always executes the loop body at least once. Extend the attribute grammar from the slides to include operational semantics for repeat...until loops

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

Students also viewed these Databases questions