Jaypee Institute of Information Technology –Noida Theory Of Computation Tutorial –04 Context Free-Grammar Note: Ask all the students to make a tutorial notebook and all the questions given in the tutorial must be solved in it. Questions in bold are to be solved in the tutorial class only. 1.Let G={V, ,R,E) where V, ,r are as follows V={+,*,(,),id,T,F,E}(id means identifier. = {+,*,(,),id} R={E E+T,E T,T T*F,T F,F (E),F id} E E+T………1 E T …………….2 T T*F…………..3 T F…………….4 F (E)…………..5 F id…………….6 The symbol E,T,F ARE EXPRESSION,TERM AND FACTOR. TO GENRATE STRING (id*id+id)*(id+id) 2.Genrate context free grammer which generates a string containing only ‘a’s 3. To generate a string in which consecutive ‘b’s can occur only but only ‘a’s’ can be consecutive. 4.Give the C.F.G. for generating an alternating sequence of 0’s and 1’s. 5. To generate the string which contains at least one occurance of ‘aaa’. 6.write the C.F.G. for genrating string which contains at least 2 a’s. 7. Write the C.F.G. to genrate the variable name . The rules for the variable names are (i)They contain alphanumeric and (ii) they will start with alphabet. 8.construct a C.F.G. generating all integers (with sign).