Lexing, parsing, ASTs, semantic analysis, intermediate representations, code generation, JIT, bytecode and virtual machines.
39 cards · basic cards · AI-written, checked twice. Edit anything.
- What is lexical analysis?
Show answer
Breaking source code into tokens
- What is a token?
Show answer
The smallest unit of syntax (keyword, identifier, operator, etc)
- What is a lexeme?
Show answer
The actual text string matched by a token pattern
- What role do regular expressions play in lexers?
Show answer
They define patterns that identify and classify tokens
- What is a finite automaton in lexing?
Show answer
A state machine used to recognize patterns and define tokens
- What is syntax analysis?
Show answer
Converting a sequence of tokens into a hierarchical tree structure
- What does a context-free grammar (CFG) define?
Show answer
The syntax rules of a language using production rules (rewrite rules)
- What is the difference between a parse tree and an AST?
Show answer
Parse trees show every grammar derivation step; ASTs show only semantically relevant nodes
- What is recursive descent parsing?
Show answer
A top-down parsing approach where each grammar rule is implemented as a recursive function
- What does an LL(1) parser do?
Show answer
Reads input left-to-right and produces a leftmost derivation with one-token lookahead
- What does an LR parser do?
Show answer
Performs bottom-up parsing by shifting tokens onto a stack and reducing via grammar rules
- What does lookahead mean in parsing?
Show answer
Examining the next token(s) to decide which grammar rule to apply
- What is semantic analysis?
Show answer
Checking that code follows language rules beyond syntax (types, scope, declarations)
- What is a symbol table?
Show answer
A data structure that records identifiers, their types, and their scope information
- What is type checking?
Show answer
Verifying that operations apply to values of compatible types