rules for creating SLR Table
Rows are the number of groups that have ex: i0-ix
Columns are all the symbols, terminals, and variables
If the input is a variable, input the number of the group it results to
If input is a terminal or symbol, do the same as variable but add
S
before the number
If there is a grammar that is completed (
.
is at the end) and is an augmented grammar, put accepted in the dollar column
If its complete and NOT augmented grammar , check i0 which line does it correspond / similar to, and use
R + line number
as the value for the FollowFollowcheat: terminal or symbol after the variable Algorithm 1. If S is the start symbol, ex: S -> Ab | c, then $ is the Follow value of S 1. If A -> αBβ, then all First of β is the Follow of B except ε 1. a. A -> αB, then all Follow of *A* is the Follow of B 1. b. A -> αBβ and First of β is ε, then all Follow of *A* is the Follow of B Special case If A -> α, i.e production result contains only 1 variable, add ε in front of the variable to conform to rule 3.a. A -> α\*B You can only find the values of the producer variable
If Go To operationGo To operationSteps: 1. Make sure that one grammar has only 1 production result by removing the OR (essentially splitting the grammar) 1. Add augmented grammar (added grammar than can result a start symbol) 1. Add numbers to each grammar except augmented grammar 1. Add . at the front of each production result (used for kernel method) 1. Use the kernel method starting from the top most grammar 1. Group the grammars 1. Input the thing after the . to each grammar and group them 1. If the result has a . is wrong, table is wrong
how to check??
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