how to do parsing search for bottom up

The first stack is the first group 0 and add $ AFTER it

Input will be given and add $ AFTER it

How to determine the output?

  • By comparing the left most of the stack and the left most of the input
rules
  • if the output is SX then append number X as the left most of the stack, followed by the input that resulted the output and the stack from the previous operation

when input is moved to the stack, it gets removed from the input

  • If the output is RX then replace the production result of the line X with the producer variable (replace the number before the production result as well )
  • if the left most of the stack has no number, compare with the number beside it and append to the left
  • if the output has a production result that is long reverse it and replace with the numbers until the last letter

Status: #idea
Tags: compilation-techniques > Final ExamCompilation Techniques NotesMid Exam RE to DFA RE to E-NFA to DFA Context Free Grammar Top down parsing Final Exam Bottom Up Parsing Directed Acyclic Graph TAC, Triples, Quadriples Intermediate Code Generator Annotated Parse Tree Three Address Statement https://www.youtube.com/watch?v=\_Jng5xgLxkI&list=PLB2GiO0mMjw9J_OwnDMAqtsANzWsIylQz&index=9&ab_channel=HIMTIBINUS Status: #MOC Tags:, Bottom Up ParsingBottom Up Parsingsteps 1. Perform Go To operation 1. Find Follow value 1. Create SLR Table 1. Search through parsing no need to remove Left Recursive Example Alvina Aulia Bottom Up Parsing 1. E -> E + T | T 1. T -> T * F | F 1. F -> (E) | id Perform Go To operation: i0: E' -> .E 1. E -> .E + T 1. E -> .T 1. T -> .T * F 1. T -> .F 1. F -> .(E) 1. F -> .id (Input E to i0) i1: E' -> E. 1. E -> E. + T (Input T to i0) i2: 2. E -> T. 3. T -> T. * F (Input F to i0) i3: 4. T -> F. Screenshot 2024-11-17


References