Docsity

Study Guide for Test 1 - Compilers | CS 6620, Study notes of Computer Science

Toggle sidebar
bg1
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
pf2

Partial preview of the text

Download Study Guide for Test 1 - Compilers | CS 6620 and more Study notes Computer Science in PDF only on Docsity!

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
  • Type checking vs. type inference
  • Built-in types
  • Type constructors
  • Type equivalence – structural vs. name
  • Type coercion Activation Records / Stack Frames
  • Invocations vs. instantiations
  • Stack pointer vs. frame pointer
  • Address space: stack, heap, static data, code o Stack allocation vs. heap allocation vs. static allocation
  • Handling local variables
  • Handling nested procedures
  • Passing parameters o why we need calling conventions o register windows
  • Calling sequence
  • Caller save vs. callee save o Optimizations, leaf procedures
  • Passing return values
  • Return address – why we need it, when we store it
  • Static link vs. dynamic link – why we need each
  • Registers vs. memory – tradeoffs, why compilers care Intermediate Representations
  • Reasons for an IR
  • What makes a good IR
  • Three-address code o Shorthand: triples, quadruples o Converting sample code into three-address code
  • The IR machine
  • Multiple IR stages (HIR, MIR, LIR) – features, motivation, examples
  • Graphical vs. linear IR o DAGs o Dependence graphs o CFGs
  • Stack machine code Basic Blocks and Traces
  • Partitioning code into basic blocks
  • Ordering basic blocks
  • Trace creation – heuristics, benefits IR CodeGen

• Converting HIR to LIR

• generate functions (for statements, conditionals, loops, functions, etc)

• Short circuiting