Question: ( 1 8 Points ) Recursive descent is a parsing technique that generates a parse tree using a top - down approach. The technique takes
Points Recursive descent is a parsing technique that generates a parse tree using a topdown approach. The technique takes advantage of backtracking when there is a mismatch between a token and a production rule. However, recursive descent is not free of its limitations For each of the following contextfree grammars, identify whether it is possible to apply recursive descent parsing on all possible inputs. If it is possible, clearly explain why it is possible you do not need to provide a formal proof Further, provide two nontrivial examples eg not the empty string of valid inputs for the given CFG If it is not possible, clearly explain why it is not possible and provide an example of an input that would not be properly parsed by the given CFG using recursive descent. Finally, rewrite the production rules of the CFG except for S E; leave it as is using as few production rules as possible, such that recursive descent can be applied. Note: "int" is not the string int but can be any number. To avoid any confusion, we further make the following assumptions: The order of production rules does matter, ie if you have X A B then A will be chosen in preference to B We assume full backtracking. An example of the difference between full backtracking and limited backtracking is as the following: if X a ab and the input is ab then limited backtracking would fail because X a succeeds and youre left with an incomplete b But full backtracking would come back and try X ab which would successfully parse the entire input.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
