Question: 5. The programming language Pascal has a repeat...until construct for a logical post-test loop. 5. The programming language Pascal has a repeat...until construct for a

5. The programming language Pascal has a repeat...until construct for a logical post-test loop.

5. The programming language Pascal has a repeat...until construct for a logical

post-test loop. 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

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} > while (id[1] relop id[2]) {.begin = newLabel() .end = newLabel() .code = .begin: if (id[1].string negation(relop) id[2].string) goto L.end || .code || goto .begin || .end: } Here, negation(relop) yields the negation of the relational operator (for example, negation(>=) is if (id[1] relop id[2]) {.end = newLabel(). .code = if (id[1].string negation(relop) id[2].string) goto .end || .code || .end: } 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} > while (id[1] relop id[2]) {.begin = newLabel() .end = newLabel() .code = .begin: if (id[1].string negation(relop) id[2].string) goto L.end || .code || goto .begin || .end: } Here, negation(relop) yields the negation of the relational operator (for example, negation(>=) is if (id[1] relop id[2]) {.end = newLabel(). .code = if (id[1].string negation(relop) id[2].string) goto .end || .code || .end: }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!