Question: Answer all the questions 1. Write a BNF grammar for the for loop statement of C . Assume this is the 89 standard that does
Answer all the questions
1. Write a BNF grammar for the for loop statement of C. Assume this is the 89 standard that does NOT allow new variables as C++ did (not allowed is the int in for (int i=0; i<5; i++). Also assume block is NOT a statement (different books take different take on this). Further assume
2. For the above, write informal operational semantics (as you would give to someone new to C, trying to explain what it is)
3. Design a regular language where every sentence has to start with any number of strings 101 (any number is none or more), then repeats 00 any number of times, then repeats 01 at least once.
4. For the above, how many valid strings there are?
5. For the above, how many valid strings are there if we restrict the total length to a) at most 7 bits? b) exactly 7 bits?
6. If you were designing a new programming language, would you make it regular, context free, context sensitive, or unrestricted and why?
7. If translation of your programs was not your concern at all (aliens offered to do it for you), would the above answer change and how and why?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
