Please answer the questions below:
7. Rewrite the following BNF grammar using the form of EBNF
described on the bottom
half of page 127 in Sebesta.
<import_decl> → import <import_list> ;
<import_list> → <package_list>
| <package_list> . *
<package_list> → <identifier>
| <package_list> . <identifier>
<identifier> → a | b | c
Make the resulting grammar as simple as possible, but keep all four
of the original
nonterminals, which will now be named ImportDecl, ImportList,
PackageList, and
Identifier. (Note: There are some typographical errors on page 127.
See page 3-21 of the
course notes for a better description of this form of EBNF.)
8. (a) What is the weakest precondition needed to prove the
correctness of the following
loop?
while i < j do
i = i + 1;
j = j - 1;
end
{i = j or i = j + 1}
(b) Give an invariant that is strong enough to prove the
correctness of the loop.
Please answer the questions below: 7. Rewrite the following BNF grammar using the form of EBNF...
P2) Given grammar in BNF, answer the following questions (30 points) <stmt-list>→<stmt> | <stmt»; <stmt-list> (a) Rewrite the given grammar into a EBNF (b) Is the given grammar ambiguous? Support your answer to receive the full credit. (c) Given string A-B C-D: B-C-A-D, draw a parsing tree P2) Given grammar in BNF, answer the following questions (30 points) → |