
CS 671 – Test 1 – The Front End
General Compilers
• Front-end vs. Back-end
• Compiler phases and interfaces
• Compilers vs. Interpreters vs. JITs
Lexical Analysis
• Tokenizing
• Regular Expressions
• Deterministic Finite Automata
o Transition Tables
• Non-deterministic finite automata
o Epsilon closure
• RegExp → NFA → DFA
• Ad-hoc lexers
Syntactic Analysis
• Context-free grammars
• Derivations: leftmost vs. rightmost
• Ambiguous grammars
o Eliminating ambiguity
• Parse Trees
• Abstract Syntax Trees
• Top-Down Parsing
• Bottom-Up Parsing
• Recursive descent
• Left recursion vs. right recursion
• Predictive parsing tables
• First, follow sets
• Shift-reduce parsing
• Yacc/Bison
o Specification file
o Conflicts: shift/reduce vs. reduce/reduce
o Precedence rules
• Error recovery
o Local vs. Global
Semantic Analysis
• Why we separate syntactic/semantic analysis
• Static vs. dynamic checks
• Typical semantic errors
• Scope (static and dynamic)
• Overloading
• Symbol tables
o Implementation options
• Bindings
• Types
o Statically typed
o Dynamically typed
o Untyped
o Benefits, trade-offs of each