Question: 1 ) What is the difference between syntax and semantics? 2 ) Why is it important for a grammar to be unambiguous? 3 ) Show

1) What is the difference between syntax and semantics?
2) Why is it important for a grammar to be unambiguous?
3) Show that the following grammar is ambiguous show two distinct parse
trees for one terminal string.
->+|*|()| a | b| c
4) Show that the following grammar is ambiguous show two distinct parse
trees for one terminal string.
E-> E + E | id
5) Write a grammar for the language consisting of strings over the alphabet {a,b}
where all strings start with the letter a and can have as and bs after.
6) Write a grammar for the language over the alphabet {a,b,c} consisting of
strings that start and end with the letter a and have as bs cs in between.
7) Write a grammar for the language over the alphabet {a,b,c} consisting of
strings where every b is immediately followed by the letter c
8) Write an EBNF statement for a C++ float constant.
9) Compute the weakest precondition for the following assignment statement
given the postcondition.
y =2y 1{ y >1}
10) Compute the weakest precondition for the sequence of statements:
(Statement 1) b =2b +1;
(Statement 2) b = b-3{b <0}
11) Compute the weakest precondition for the selection construct.
if (a ==5)
b =2b +1
else
b =2b;
{b >1}

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!