Home
Explore
Exams
Search for anything
Login
Get started
Home
Engineering
Computer Science
Compiler Construction Quizlet
0.0
(0)
Rate it
Studied by 2 people
Learn
Practice Test
Spaced Repetition
Match
Flashcards
Card Sorting
1/146
Earn XP
Description and Tags
Computer Science
Add tags
Study Analytics
All
Learn
Practice Test
Matching
Spaced Repetition
Name
Mastery
Learn
Test
Matching
Spaced
No study sessions yet.
147 Terms
View all (147)
Star these 147
1
New cards
Every compiler converts a \_____ program to a \_____ program
source
2
New cards
What type of compilers do many Java interpreters use?
just-in-time
3
New cards
What do macros get converted into?
source language statements
4
New cards
What does the assembler do?
converts assembly code into machine code
5
New cards
What are the two main parts of a compiler?
analysis and synthesis
6
New cards
What does the analysis part of the compiler pass to the synthesis part?
a symbol table and intermediate representation
7
New cards
The synthesis part of a compiler is also called the \_____
back end
8
New cards
The symbol table is...
used by all phases of the compiler
9
New cards
Another name for scanning is
lexical analysis
10
New cards
Another name for parsing is...
syntax analysis
11
New cards
In a syntax tree an interior node represents...
an operation
12
New cards
During what stage of analysis is the syntax tree built?
syntax analysis
13
New cards
In what stage of analysis does type checking occur?
semantic analysis
14
New cards
How can we support multiple target machines for a single source language?
develop multiple backends
15
New cards
What is the most important objective of compiler optimizations?
correctness
16
New cards
What do finite-state machines and regular expressions model?
keywords and identifiers
17
New cards
What is true of programming language features that make programming easier?
they incur run-time overhead
18
New cards
What can be found in most computers both at the instruction level and at the processor level?
parallelism
19
New cards
What is the most important problem in optimizing a program?
using registers effectively
20
New cards
What maps names to locations (variables) in memory (the store)?
environment
21
New cards
What maps memory locations to values?
state
22
New cards
A procedure...
is like a function but doesn't return a value
23
New cards
The proper form of a program is called...
syntax
24
New cards
What a program means is called...
semantics
25
New cards
Sytnax trees and three-address code are both
intermediate representations
26
New cards
In a context free grammar the -\> in A -\> B(C) means...
can have the form
27
New cards
In a grammer A -\> B(C) is called a...
production
28
New cards
In a grammer the elementary symbols
thos not defined by other symbols are called...
29
New cards
The left side of a production is called the...
head
30
New cards
What appears on the right side of grammer productions?
terminals and nonterminals
31
New cards
In all but trivial grammars the start symbol is a...
nonterminal
32
New cards
If multiple productions have the same nonterminal on the left side...
they con be combined into 1 production with the right sides separated by |
33
New cards
What does epsilon stand for in grammars?
the empty string
34
New cards
What is the input to parsing?
a string of terminals
35
New cards
What is the output of parsing?
a parse tree
36
New cards
A parse tree shows how a start symbol derives a
string in the language
37
New cards
The root of a parse tree is...
the start symbol
38
New cards
How do you show that a grammar is ambiguous?
show that a terminal string has more than one parse tree
39
New cards
Parse trees for left-associative oparators grow
down to the left
40
New cards
Precendence of operators...
can be encoded into grammars
41
New cards
What attaches rules or program fragments to grammar productions?
syntax directed translation.
42
New cards
In a sytax directed translation an attribute for a node N that can be determined by N and N's children is called....
synthesized
43
New cards
Program fragmenst imbedded within production boddies are...
ematic actions
44
New cards
What is the process of determining how a string of terminals can be generated by a grammar?
parsing
45
New cards
The current symbol being scanned is called...
the lookahead symbol
46
New cards
Sometimes there are multiple productions we could use
how do we determine if a production is not suitable?
47
New cards
What is FIRST(X)?
the set of symbols that appear first in the strings of terminals generated from x
48
New cards
Given multiple productions how does a predictive parser choose one?
comparing the FIRST of each right hand side
49
New cards
In a predictive parser
if a terminal in the body of a production doesn't match the lookahead
50
New cards
In lexical analysis
a token is...
51
New cards
What does the lexical analyzer allow to appear within expressions?
white space
52
New cards
The symbol table is constructed during \_____ and used during \_____
analysis
53
New cards
Parsers are better at \_____ than lexical analyzers
distinguishing between different declarations of an identifier
54
New cards
Technically scope refers to... (operators
identifiers
55
New cards
All the symbol tables for a program form a...
tree
56
New cards
What are the two most important intermediate representations?
linear representations and trees
57
New cards
Is static checking done at runtime or compile time?
compile time
58
New cards
Making sure that an identifier is not declared multiple times in a scope is an example of...
syntactic checking
59
New cards
What are two types of static checking?
syntactic checking and type checking
60
New cards
In the expression 2 * 3.14
converting 2 to 2.0 is an example of...
61
New cards
A symbol with different meanings base don its context is said to be...
overloaded
62
New cards
An if statement in 3 address code needs...
a jump instruction
63
New cards
Many compilers attempt to generate code that is as good as or better than assembly code produced by...
experts
64
New cards
One task of the lexical analyzer is to...
group input characters into lexemes
65
New cards
For what type of lexemes does the lexeme need to be added to the symbol table?
identifiers
66
New cards
What function on the lexical analyzer is commonly called by the parser?
getNextToken
67
New cards
Correlating error messages with the source program is a function of the...
lexical alyzer
68
New cards
What are two reasons the analysis portion of the compiler is split into lexical analysis and syntax analysis?
compiler efficiency and simplicity of design
69
New cards
What is a pair consisting of a token name and an optional attribute called?
a token
70
New cards
A pointer is generally the attribute for an identifier
why?
71
New cards
A proper prefix of string s....
cannot be equal to s
72
New cards
What do we call a language that can be defined by a regular expression?
a regular set
73
New cards
What does + operator represent in a regular expression?
one or more
74
New cards
What does ? represent in a regular expression?
one or zero
75
New cards
What is [a-z] shorthand for?
a|b|c|...|z
76
New cards
What are the nodes in a transition diagram?
states
77
New cards
If a transition diagram is deterministic
there is never more than one...
78
New cards
An accepting state is indicated by...
a double circle
79
New cards
The start state is indicated by...
an edge from nowhere leading to it
80
New cards
In a lexical analyzer each state has...
a piece of code
81
New cards
The set of languages recognized by DFAs and NFAs are what? (the same
NFA represents more than DFA
82
New cards
In an NFA
the same symbol can label edges...
83
New cards
In a NFA
the set of strings labeling some path from the start to an accepting state defines...
84
New cards
What is the difference between an NFA and a DFA?
There are no epsilon transitions
85
New cards
What does the parser get from the lexical analyzer?
a string of tokens
86
New cards
What are some kinds of parsers?
bottum-up
87
New cards
The input the the parser is scanned
one symbol at a time
88
New cards
What kind of error is a misspelling?
lexical erorr
89
New cards
What kind of error is a misplaced semicolon?
syntactic error
90
New cards
What kind of error is a mismatch between an operator and its operands?
semantic error
91
New cards
What kind of error is incorrect reasoning?
logical error
92
New cards
The simplest error recovery strategy for a parser is...
to quit on the first error
93
New cards
When creating a derivation each rewriting step replaces a nonterminal with
the body of a production
94
New cards
In generating a derivation from the start symbol what symbol what does \=\> mean?
derives in one step
95
New cards
Given a \=\> b \=\> c what is true?
a derives c
96
New cards
In a parse tree what does each interior node represent?
the application of a production
97
New cards
If more than one leftmost derivation for a sentence exists then
the grammar is ambiguous
98
New cards
What is the relationship between grammars and regular expression? (They are as expressive as each other
regular expressions are more expressive than grammars
99
New cards
Which of the following languages cannot be accepted by a finite automaton? ab^n
a^nb^n
100
New cards
Bottom-up parsing can be though of as...
reducing a string to the start symbol
Load more