Give a context-free grammar describing the syntax of the following: Non-empty st
ID: 3747303 • Letter: G
Question
Give a context-free grammar describing the syntax of the following: Non-empty strings of O's and l's that represent binary numbers that are not multiples of 4. Write a C++ program which clearly demonstrates the relationship between the operators "7" and "-". Your program should print distinct results depending on if in a. “7" has higher or lower precedence than "-". b. "" is right or left associative. Turn in a listing of your program, the output, and a description of how your program demonstrates the semantic resolution of the ambiguityExplanation / Answer
1. 0 or 11 or 101
0|11|101
2. Only os
0*
3. All binary strings
(0|1)*
4. All binary strings except empty string
(0|1)(0|1)*
5. Begins with 1, ends with 1
1|(0|1)*|1
6. Ends with 00
(0|1)*00
7. Contains at least three 1s
(0|1)* 1(0|1)* 1(0|1)* 1(0|1)*
8.Contains at least three consecutive 1s
(0|1)*111(0|1)*
9. Contains the substring 110
(0|1)*110(0|1)*
10. Doesn't contain the substring 110
((0|10)*1)*
11 contains at least two os but not consecutive 0s
1*011*0(11*0)*1*
12. Has a least 3 character, and the
Third character is 0
(0|1)(0|1)0(0|1)*
2.
#include <iostream>
Int main()
{
Int num =10;
num-=5;
Cout<<"enter a number"<<num;
num=10;
num/=5;
Cout<<"enter a number" <<num;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.