Please enable JavaScript.
Coggle requires JavaScript to display documents.
Compiler Construction - Coggle Diagram
Compiler Construction
Back-end
-
-
Bytecode to HIR
-
In practice
Create a CFG, detect loops, remove unreachable blocks, compute immediate dominator for each basic block, convert JVM to HIR, eliminate redundant phi functions.
Register allocation
Local, round robin approach
Global, graph coloring approach
-
-
Front-end
Parsing
Context-free grammars (i.e. grammar that generates a^n b^n, n>0)
Terminal and non-terminal symbols, production rule and starting symbol
-
Derivations
Left-most derivation: production rule applied on the left-most non-terminal symbol. Right-most derivation: opposite.
Ambiguity
A sentence s is ambiguous if there is at least another set of production rules that lead to that sentence.
-
Top-down deterministic parsing (left to right, one token at a time)
-
-
-
Scanner
Based on RegEx
A regular expression describes a "matching pattern", and defines a language L(r) of strings over an alphabet
N-FSA
Constructed with the Thompson construction, it is inefficient and needs backtracking. Makes use of epsilon moves.
Minimal FSA
Constructed partitioning the states, first in final and non-final states. Goal: for all states in each block, each input symbol leads to a same target block. Perfect.
D-FSA
Constructed with the powerset
(or subset) construction procedure, based on the epsilon-closure. It groups states reachable with the epsilon move. It is too big.
-
-