Directed Acyclic Graph

steps
  1. Look for Three Address Code (TAC)
  2. Create DAGDirected Acyclic Graphsteps 1. Look for Three Address Code (TAC) 1. Create DAG based on TAC From left to right Don't repeat any nodes Example Alvina Aulia Directed Acyclic Graph 1. x = a + a \* (b - c) + (b - c) \* d T1 T1 1. x = a + a * T1 +T1 \* d T2 1. x = a + T2 + T1 * d T3 1. x = a + T2 + T3 T4 1. x = T4 + T3 T5 1. x = T5 T1 = b - c T2 = a \* T1 T3 = T1 \* d T4 = a + T2 T5 = T4 + T3 x = T5 Screenshot 2024-12-09 at 1.06.21 PM.png Status: #idea Tags: compilation-techniques > Fi based on TAC

From left to right

Don't repeat any nodes

Example Alvina Aulia Directed Acyclic Graph

  1. x = a + a * (b - c) + (b - c) * d T1 T1

  2. x = a + a * T1 +T1 * d T2

  3. x = a + T2 + T1 * d T3

  4. x = a + T2 + T3 T4

  5. x = T4 + T3 T5

  6. x = T5

T1 = b - c
T2 = a * T1
T3 = T1 * d
T4 = a + T2
T5 = T4 + T3
x = T5

Screenshot 2024-12-09 at 1.06.21 PM.png 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:


References