Compilers Exam 1 Def

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/102

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 2:21 AM on 9/14/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

103 Terms

1
New cards

Compiler

A program that accepts source code and translates it into machine code for a target computer architecture.

2
New cards

Source Code

The original program written in a programming language that is given to the compiler as input.

3
New cards

Target Architecture

The computer architecture for which the compiler generates machine code, such as x86, ARM, or MIPS.

4
New cards

Portability

The ability of a compiler to support different source languages or target architectures without redesigning the entire compiler.

5
New cards

Intermediate Representation (IR)

A machine-independent internal representation of a program used between the compiler's front end and back end.

6
New cards

Front End

The part of the compiler that analyzes source code and translates it into an intermediate representation.

7
New cards

Back End

The part of the compiler that translates the intermediate representation into code for a specific target architecture.

8
New cards

Scanning

The compiler phase that groups input characters into tokens.

9
New cards

Parsing

The compiler phase that recognizes sequences of tokens according to a grammar and determines their syntactic structure.

10
New cards

Semantic Analysis

The compiler phase that checks whether variables, functions, types, and other program elements are used consistently with the language's rules.

11
New cards

Type Checking

The process of verifying that operations and expressions use compatible data types.

12
New cards

Optimization

The process of improving intermediate code without changing the program's meaning.

13
New cards

Instruction Selection

The back-end phase that maps intermediate representation instructions into assembly instructions.

14
New cards

Code Optimization

The process of improving generated assembly code using techniques such as control-flow analysis, data-flow analysis, and register allocation.

15
New cards

Code Generation

The compiler phase that generates machine code from assembly code.

16
New cards

Object File

A file containing generated machine code that may still contain unresolved references to external symbols.

17
New cards

Linking

The process of combining object files and libraries into one executable and resolving external references.

18
New cards

Loading

The process of placing an executable into memory, initializing the program environment, and beginning execution.

19
New cards

Scanner

The component that performs lexical analysis by grouping source-code characters into lexemes and assigning tokens to them.

20
New cards

Lexical Analysis

The process of dividing program text into its basic words or tokens.

21
New cards

Lexeme

The actual sequence of characters in source code corresponding to a token.

22
New cards

Token

A category assigned to a lexeme, such as keyword, identifier, integer, or operator.

23
New cards

Scanner Generator

A tool that automatically creates a scanner from token specifications written using regular expressions.

24
New cards

JFlex

A scanner generator for Java that generates a lexical analyzer from regular-expression specifications.

25
New cards

Alphabet (Σ)

A finite set of symbols from which strings in a language are constructed.

26
New cards

String

A finite sequence of symbols from an alphabet.

27
New cards

Empty String (ε)

A string containing zero symbols.

28
New cards

Empty Language (∅)

A language containing no strings.

29
New cards

Language

A set of strings over an alphabet.

30
New cards

Regular Language

A language that can be represented by a regular expression or recognized by a finite automaton.

31
New cards

Regular Expression (RE)

A notation used to describe a regular language using symbols and regular operations.

32
New cards

Union (∪)

A regular operation that represents strings belonging to either of two languages.

33
New cards

Concatenation (∘)

A regular operation that combines a string from one language with a string from another language.

34
New cards

Kleene Star (*)

A regular operation representing zero or more repetitions of strings from a language.

35
New cards

Regular Expression Precedence

The order of RE operations from highest to lowest is Kleene star, concatenation, then union.

36
New cards

Closure

A collection is closed under an operation if applying the operation to members of the collection always produces another member of that collection.

37
New cards

Closure of Regular Languages

Regular languages remain regular when operations such as union, concatenation, and Kleene star are applied to them.

38
New cards

Finite Automaton

A mathematical machine with a finite number of states used to recognize strings belonging to a language.

39
New cards

Deterministic Finite Automaton (DFA)

A finite automaton with exactly one transition for each state and input-symbol combination.

40
New cards

DFA 5-Tuple

A DFA is formally defined as (Q, Σ, δ, q₀, F).

41
New cards

Q

The finite set of states in a finite automaton.

42
New cards

Transition Function (δ)

A function that determines which state the automaton moves to based on its current state and input.

43
New cards

Start State (q₀)

The state where a finite automaton begins processing input.

44
New cards

Accepting States (F)

The states in which an automaton accepts an input after the entire string has been consumed.

45
New cards

DFA Acceptance

A DFA accepts a string when consuming the entire input causes it to finish in an accepting state.

46
New cards

Error State

A nonaccepting state that acts as a black hole; once entered, the DFA cannot escape.

47
New cards

Transition Table

A table that specifies the next state for each combination of current state and input symbol.

48
New cards

Nondeterministic Finite Automaton (NFA)

A finite automaton that may have multiple transitions for the same input symbol and may contain ε-transitions.

49
New cards

ε-Transition

A transition that allows an NFA to change states without consuming an input symbol.

50
New cards

NFA Acceptance

An NFA accepts a string if at least one possible path consumes the entire input and finishes in an accepting state.

51
New cards

DFA and NFA Equivalence

DFAs and NFAs have the same expressive power; every NFA has an equivalent DFA recognizing the same language.

52
New cards

Equivalent Automata

Two automata are equivalent if they recognize exactly the same language.

53
New cards

Subset Construction

The method used to convert an NFA into an equivalent DFA where each DFA state represents a set of NFA states.

54
New cards

ε-Closure(s)

The set of NFA states reachable from state s using only ε-transitions, including s itself.

55
New cards

ε-Closure(T)

The set of states reachable from any state in set T using only ε-transitions.

56
New cards

move(T, a)

The set of NFA states reachable from states in T by consuming input symbol a.

57
New cards

RE to DFA Conversion

The usual process is Regular Expression → NFA → DFA → optionally minimize the DFA.

58
New cards

State Minimization

The process of converting a DFA into an equivalent DFA containing as few states as possible.

59
New cards

Unreachable State

A state that can never be reached from the DFA's start state and can therefore be removed during minimization.

60
New cards

Equivalent DFA States

States that behave identically for all possible future inputs and can therefore be combined during minimization.

61
New cards

Parser

The compiler component that receives tokens from the lexer and determines whether they follow the language's grammatical structure.

62
New cards

Parser Input

A sequence of tokens produced by the lexical analyzer.

63
New cards

Parser Output

A representation of the program's syntactic structure, typically a parse tree or similar tree structure.

64
New cards

Parse Tree

A tree representing how a sequence of tokens is generated according to a grammar.

65
New cards

Regular Language Limitation

Regular languages cannot naturally represent recursive or nested structures such as balanced parentheses and nested expressions.

66
New cards

Context-Free Grammar (CFG)

A formal grammar used to describe recursive syntactic structures in programming languages.

67
New cards

CFG 4-Tuple

A context-free grammar is formally defined as (N, T, R, S).

68
New cards

Nonterminal

A grammar symbol representing a syntactic category that can be replaced using production rules.

69
New cards

Terminal

A grammar symbol corresponding to an actual token that cannot be replaced by another grammar production.

70
New cards

Production Rule

A rule describing how a nonterminal may be replaced by a sequence of terminals and nonterminals.

71
New cards

Start Symbol

The designated nonterminal from which generation or parsing of strings begins.

72
New cards

Yield (⇒)

A relationship where one string is transformed into another using one production-rule substitution.

73
New cards

Derivation (⇒*)

A sequence of zero or more production-rule substitutions used to generate a string.

74
New cards

Leftmost Derivation

A derivation in which the leftmost nonterminal is replaced at every step.

75
New cards

Rightmost Derivation

A derivation in which the rightmost nonterminal is replaced at every step.

76
New cards

Ambiguous Grammar

A grammar in which at least one string can have more than one parse tree.

77
New cards

Associativity

A rule determining how repeated operators of the same precedence are grouped.

78
New cards

Operator Precedence

A rule determining which operators bind more strongly and are evaluated first.

79
New cards

Top-Down Parsing

A parsing approach that begins with the start symbol and attempts to derive the input tokens.

80
New cards

Bottom-Up Parsing

A parsing approach that begins with the input tokens and repeatedly reduces them until reaching the start symbol.

81
New cards

Predictive Parsing

A top-down parsing technique that uses the current input token to predict which grammar production should be applied.

82
New cards

Recursive-Descent Parsing

A top-down parsing method that generally uses one procedure for each nonterminal in the grammar.

83
New cards

Left Recursion

A grammar structure where a nonterminal can derive a string beginning with itself, which can cause infinite recursion in recursive-descent parsing.

84
New cards

Left Recursion Elimination

The process of rewriting a left-recursive grammar into an equivalent form suitable for predictive or recursive-descent parsing.

85
New cards

Predictive Parsing Table

A table M[X, token] that specifies which production to use based on the current nonterminal and input token.

86
New cards

End-of-Input Symbol ($)

A special symbol used by a parser to indicate the end of the input.

87
New cards

FIRST(α)

The set of terminals that can appear first in strings derived from the symbol sequence α.

88
New cards

FOLLOW(X)

The set of terminals that can immediately follow nonterminal X in a legal derivation.

89
New cards

Shift-Reduce Parser

Another name for a bottom-up parser because its two main operations are shifting input and reducing handles.

90
New cards

Shift

The bottom-up parsing action that pushes the current input token and advances to the next token.

91
New cards

Reduce

The bottom-up parsing action that replaces symbols matching the right-hand side of a production with that production's left-hand side.

92
New cards

Handle

A sequence of symbols that matches the right-hand side of a production and can be reduced during bottom-up parsing.

93
New cards

ACTION Table

The shift-reduce parsing table that determines whether the parser should shift, reduce, accept, or report an error based on the current state and token.

94
New cards

GOTO Table

The shift-reduce parsing table that determines which state to enter after reducing to a particular nonterminal.

95
New cards

ACTION vs. GOTO

ACTION handles transitions involving terminals and parser actions, while GOTO determines state transitions involving nonterminals after reductions.

96
New cards

Item

A production containing a dot that indicates how far the parser has progressed through that production.

97
New cards

Itemset

A set of items representing all grammar productions that could currently be applicable during parsing.

98
New cards

Dot at Beginning of an Item

Indicates that none of the right-hand side of that production has been recognized yet.

99
New cards

Dot in Middle of an Item

Indicates that symbols before the dot have been recognized and the parser expects the symbol immediately after the dot.

100
New cards

Dot at End of an Item

Indicates that the entire right-hand side has been recognized and a handle has been found for reduction.