 Hello everyone, I am Mrs. Sunita Role working as an assistant professor in Computer Science and Engineering department of Walshian Institute of Technology, Solapur. Topic cover here is top-down passing. There are two types of passers, top-down and bottom-up passers. Top-down passers build the pass tree from top to bottom, while bottom-up passers start from the leaves and work up to the road. In both cases, the input to the passer is scanned from left to right, one symbol at a time. In previous video, I considered the top-down passers, recursive-descent passers and the predictive passers. And in this video, I am going to consider one more top-down passers, that is, non-recursive-predictive passers, learning outcome. At the end of this session, students will be able to know what the non-recursive-predictive passing is and pass the string using the non-recursive-predictive passer. It is possible to build a non-recursive-predictive passer by maintaining a stack explicitly. The key problem during the predictive passing is that of determining the production to be applied for a non-terminal. The non-recursive passer look up the production to be applied in a passing table. A table-driven predictive passer has an input buffer, a stack, a passing table and an output string. The input buffer contains the string to be passed, followed by the dollar, a symbol used as a right-end marker to indicate the end of the input string. The stack contains a sequence of grammar symbols with dollar on the bottom, indicating the bottom of the stack. Initially, the stack contains the start symbol of the grammar on the top of the dollar. The passing table is a two-dimensional array m of capital A, a, where capital A is a non-terminal and small a is a terminal or the symbol dollar. In passing table, each row is a non-terminal symbol, each column is a terminal symbol or the symbol dollar and each entry holds a production rule. The passer is controlled by a program that behaves as follows. The program consider capital X, the symbol on the top of the stack and small a, the current input symbol. These two symbols determines the action of the passer. There are four possible passer actions. First, if X is equal to A is equal to dollar, then the passer hides and announces the successful completion of passing. Second, if X and A are the same terminal symbol different from dollar, that is X equals to A which is not equals to dollar, then passer pops X from the stack and advances the input pointer to the next input symbol. If X is a non-terminal, the program concerns the passing table entry m of capital X, A. If m of X, A holds a production, X derives y1, y2 up to yk, it pops X from the stack and pushes yk, yk minus 1 and so on up to y1 into the stack. The passer also outputs the production rule X derives y1, y2 up to yk to represent a step of the derivation. Fourth, if none of the above, then error. All empty entries in the passing table are error and the passer calls an error recovery routine. If X is a terminal symbol different from A, this is also an error case. Non-recursive predictive passer algorithm. Now these four possible actions are explained in the following flowchart. Input to the algorithm, a string w and a passing table m for grammar g. Initially, the passer is in the configuration with w dollar in the input buffer and the start symbol s of the grammar g on the top of the stack about dollar. The flowchart shown below uses the predictive passing table m to produce a predictive passer for the input. First step, set ip to point to the first symbol of w. Repeat, let X be the top stack symbol and A the symbol pointed by the ip. If X is a terminal or dollar, then if X is equal to small a, then pop X from the stack and advance ip, else error, else X is a non-terminal. So if m of X comma a equals to X derives y1, y2 up to yk, then begin, pop X from the stack, then push yk, yk minus 1 and so on up to y1 on to the stack with y1 on top and output the production X derives y1, y2 up to yk, and else error until X is equal to dollar that is stack is empty. And if w is in L of g that is the language of that grammar g, a leftmost derivation of w otherwise an error indication. Till now I consider the topic what is non-recursive predictive passer and working of it. Now pause this video and reflect on this question for a minute or two minute and write your response. Once you return the answer to this question, then you can restart playing this video. The question is what is the difference between recursive descent passing, predictive passing and non-recursive predictive passing? I hope all of you have completed this activity. So the question was what is the difference between recursive descent passing, predictive passing and non-recursive predictive passing? So the recursive descent passing requires backtracking while the predictive passing requires the implicit recursive call and no backtracking and the non-recursive predictive passing maintain a stack rather than implicitly via recursive call. Consider the grammar given below a predictive passing table for this grammar is shown in figure. In passing table blanks are error entries while non-blanks indicate a production with which to expand the top non-terminal on this stack. The input string is id plus id. With the input id plus id the predictive passer makes a sequence of moves shown below. Initially the passer is in configuration with w dollar that is id plus id dollar in the input buffer and the start symbol e of the grammar g on the top of this stack above dollar. The input pointer points to the leftmost symbol of the string in the input column. The passer traces out a leftmost derivation for the input that is the production output are those of a leftmost derivation. The input symbols that have already been scanned followed by a grammar symbol on the stack make make up the left sentential form in the derivation. Finally stack as well as the input contains dollar hence the passer hearts and announce the successful completion of passing. Here the second example as derives a capital B a, b derives b capital B or epsilon and input string is abba. A predictive passing table for this grammar is shown in figure. Initially the passer is in configuration with w dollar that is abba dollar in the input buffer and the start symbol s of the grammar g on the top of the stack above dollar as shown in step one. Initially input pointer points to the input symbol a so output the production as derives a capital B a as shown in step one. Push a capital B a into the stack as shown in step two. Top terminal symbol of the stack a matches with the input symbol a hence pop a from the stack and delete input symbol a from the input buffer as shown in step three. Now stack contains a capital B and the input buffer contains bba. Now input pointer points to the input symbol b and the top of the stack is capital B. So output the production as derives b capital B as shown in step three. So push b capital B into the stack as shown in step four. Top terminal symbol of stack b matches with the input symbol b hence pop b from the stack and delete the input symbol b from the input buffer as shown in step five. A stack contains a capital B and the input buffer contains b. Now the input pointer points to the input symbol b and the top of the stack is capital B. So output the production as b derives b capital B as shown in step five. So push b capital B into the stack as shown in step six. Top terminal symbol of stack b matches with the input symbol b hence pop b from the stack and delete the input symbol b from the input buffer as shown in step seven. Now the stack contains a capital B and the input buffer contains b. Now input buffer points to the input symbol a and the top of the stack is capital B. So output the production capital B derives epsilon as shown in step seven. So replace capital B by epsilon on the stack as shown in step eight. Now the top terminal symbol of the stack a matches with the input symbol a hence pop a from the stack and delete input symbol a from the input buffer as shown in step nine. Here the passes traces out a leftmost derivation for the input. So finally stack as well as the input contains the dollar hence the parser hearts and announce the successful completion of the parsing. This is the reference thank you.