Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

11. (10pts) Recall the attributed grammar from question 8. Consider the following ax- iomatic semantics: {Q1D-0,8 = 0} {Q10 +0,8 = 0} {Q ID ---}

image text in transcribed
image text in transcribed
image text in transcribed
11. (10pts) Recall the attributed grammar from question 8. Consider the following ax- iomatic semantics: {Q1D-0,8 = 0} {Q10 +0,8 = 0} {Q ID ---} ID -> {Q} {P1}S,{P2}, {P2}S,{Q} {PI}S, ENDLINE S,{Q} {Pl}S:{P2},{P2}S:{Q} {P1}S, ENDLINE S,{Q} {Qs+8+1}&{Q} {Q8-28+}%{Q} {Q&-++ ID ) ID {Q} {Qs482) {Q} {P1}S{P2},{P2}S,{Q} {PI}S, S,{Q} NOTE: The semantics in this questions is different from the one presented in other questions. For the following progams, assuming the precondition is {}, what is the vlaue of main in the postcondition? Show the proof. You may also use the Rule of Consequence. (6) main -> step, show step -> , show -> %.&, (6) main -> one, two, three, four one -> two,k, two-> R,& three -> four, .. four-> 6. (10pts) Consider the following grammar: + | ENDLINE " | "" ID "&" | "%" | *** Assume is the start symbol. Assume that all caps represents a token, quoted sequence of symbols lexemes, and angle brackets nonterminals. Also assume that the ENDLINE token is the groups of lexemes representing an end of line. The ID token represents ids in the "C" sense (start with letter or underscore, a seqence of alphanumeric and underscore characters). (a) Give a sentence in this language that is generated from at least 3 (6) Show the left-most derivation for your sentence. (c) Show the right-most derivation for your sentence, (a) Show the panse tree for your sentence. 8. (10pts) Recall the following grammar from question 6: + | ID ">" | ids (2) ids = { id) (3) [0].id = { d) U (prod.list> [1].id (1) (prod>id - ID.id .id = .id (6) [0].id (1).id [0].id (7) Predicate: {Q10 +0,8 = 0} {Q ID ---} ID -> {Q} {P1}S,{P2}, {P2}S,{Q} {PI}S, ENDLINE S,{Q} {Pl}S:{P2},{P2}S:{Q} {P1}S, ENDLINE S,{Q} {Qs+8+1}&{Q} {Q8-28+}%{Q} {Q&-++ ID ) ID {Q} {Qs482) {Q} {P1}S{P2},{P2}S,{Q} {PI}S, S,{Q} NOTE: The semantics in this questions is different from the one presented in other questions. For the following progams, assuming the precondition is {}, what is the vlaue of main in the postcondition? Show the proof. You may also use the Rule of Consequence. (6) main -> step, show step -> , show -> %.&, (6) main -> one, two, three, four one -> two,k, two-> R,& three -> four, .. four-> 6. (10pts) Consider the following grammar: + | ENDLINE " | "" ID "&" | "%" | *** Assume is the start symbol. Assume that all caps represents a token, quoted sequence of symbols lexemes, and angle brackets nonterminals. Also assume that the ENDLINE token is the groups of lexemes representing an end of line. The ID token represents ids in the "C" sense (start with letter or underscore, a seqence of alphanumeric and underscore characters). (a) Give a sentence in this language that is generated from at least 3 (6) Show the left-most derivation for your sentence. (c) Show the right-most derivation for your sentence, (a) Show the panse tree for your sentence. 8. (10pts) Recall the following grammar from question 6: + | ID ">" | ids (2) ids = { id) (3) [0].id = { d) U (prod.list> [1].id (1) (prod>id - ID.id .id = .id (6) [0].id (1).id [0].id (7) Predicate:

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

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

Why are we asking the supplier to measure this?

Answered: 1 week ago