Compiler Flashcards
When viewing programming languages as natural languages, the word ANSWER is used instead of `words’.
tokens
The routine in a compiler that takes as input a sequence of characters outputs these characters grouped into meaningful units is called ANSWER.
a lexical analyzer
The specifications for how to group characters into meaningful units are traditionally written as ANSWER.
regular expressions
The specifications of how to group characters into meaningful basic units of a programming language are generally implemented in code that has the abstract form of ANSWER.
a finite state machine
When viewed abstractly, a language is defined as a set of ANSWER.
strings
The Greek letter epsilon, when talking about languages, is used to represent ANSWER.
the empty string
In automatically generating the code that reads characters and outputs the part of a programming language that is analogous to its words, we start with a specification and then traditionally convert it into code in two stages. In the first stage, we produce ANSWER.
a nondeterministic finite state machine
In automatically generating the code that reads characters and outputs the part of a programming language that is analogous to its words, we start with a specification and then traditionally convert it into code in two stages. The main problem that can arise in moving from the first stage to the second stage is ANSWER.
an exponential explosion in the number of states needed
The central idea of context-free grammars is to define a language by productions. These productions say that a nonterminal symbol can be replaced by ANSWER.
a sequence of terminals and nonterminals
a sequence of symbols
The specific type of grammar that was the main focus of the portion of the Syntax Analysis chapter that was assigned was ANSWER.
LL(1)
In a context-free grammar, the nonterminal that derives an entire member of the language being defined is called ANSWER.
a start symbol
Using the context-free grammar based on the two rules A -> b A and A -> b, ANSWER would be the derivation sequence for bbb.
A => Ab => Abb => bbb
ANSWER is the regular expression that corresponds to the language defined by the context-free grammar with the three rules A -> A a, A -> A b, A -> a.
a (a | b)*
That’s the bar, not a letter in between
ANSWER would be the derivation of ((1)) in the language defined by the context-free grammar consisting of the two rules E -> ( E ) and E -> 1.
E => (E) => ((E)) => ((1))
ANSWER are two derivations of the string cc that produce distinct syntax trees from the context-free grammar X -> X c Y , Y -> X, Y -> and X -> .
X => XcY => XcYcY => cYcY => ccY => cc
AND
X => XcY => XcX => XcXcY => cXcY => ccY => cc
When a grammar can produce two distinct syntax trees for the same string, the grammar is said to be ANSWER.
ambiguous
If I wanted to fix the grammar E -> E + E and E -> id, so that it would only produce one syntax, which is left recursive, the new grammar would be ANSWER.
E -> E + F and E -> F and F -> id
E -> E + F and E -> id and F -> id
One aspect of the if then else end syntax of Ruby is that it avoids the ANSWER problem.
dangling else
In the context-free grammar A -> B A , B -> A B, A -> B, A -> a, B -> b, and B -> the value of Nullable(A) is ANSWER.
true
In the context-free grammar A -> B A , B -> A B, A -> a, B -> b, B -> the value of Nullable(A) is ANSWER.
false
In the context-free grammar A -> B A , B -> A B, A -> B, A -> a, B -> b, and B -> the value of FIRST(A) is ANSWER.
{a,b}
In the context-free grammar A -> B A , B -> A B, A -> a, B -> b, B -> the value of FIRST(A) is ANSWER.
{a,b}
In the context-free grammar A -> B A , B -> A B, A -> B, A -> a, B -> b, and B -> the value of FOLLOW(A) is ANSWER.
{a,b}
In the context-free grammar A -> B A , B -> A B, A -> a, B -> b, B -> the value of FOLLOW(A) is ANSWER.
{b}
The context-free grammar A -> B A , B -> A B, A -> a, B -> b, B -> is not LL(1) specifically because ANSWER.
FIRST(BA) and FIRST(a) both include a, so we do not know which A rule to use
When you write a parser for a context-free grammar that satisfies the LL(1) criteria by representing each non-terminal by a function that chooses what functions to invoke by the LL(1) criteria, this sort of parser is called ANSWER.
a recursive descent parser
Programming languages that view programming as describing a step-by-step process to do something are called ANSWER languages.
imperative
Programming languages that view programming as describing characteristics of the problem domain and characteristics of the solution and leaving it to the language processor to find a solution are called ANSWER languages.
declarative
Each named object will have ANSWER, where the name is defined as a synonym for the object.
a declaration
The technical term for connecting a name with an object is called ANSWER.
binding
The portion of the program where the name is visible is called its ANSWER.
scope
When the structure of the syntax tree is used to determine which object corresponds to a name, this is called ANSWER.
static scoping
A compiler typically keeps track of which names are associated with which objects by using ANSWER.
a symbol table
ANSWER data structures have the property that no operation on the structure will destroy or modify it.
immutable
ANSWER data structures have the property that there are operations on the structure can destroy or modify it.
mutable
Since a compiler may have to look up what object is associated with a name many times, it is typical to use ANSWER to avoid linear search times.
hash tables
In the example interpreter for evaluating expressions, in the row labelled id, we have the code: v = lookup(vtable, getname(id)) ; if v = unbound then error() else v. It says getname(id) instead of id, because ANSWER.
id indicates a token with a type and value field
In the example interpreter for evaluating expressions, in the row labelled id, we have the code: v = lookup(vtable, getname(id)) ; if v = unbound then error() else v. The value of v would be unbound in the situation that ANSWER.
getname(id) was not bound
In the ICD textbook’s example interpreter for evaluating expressions, in the row labelled id(Exps), we have the code: args = EvalExps(Exps,vtable,ftable). We pass vtable to EvalExps to handle ANSWER.
expressions that contain identifiers
In the ICD textbook’s example interpreter for evaluating expressions, in the row labelled id(Exps), we have the code: args = EvalExps(Exps,vtable,ftable). We pass ftable to EvalExps to handle ANSWER.
expressions that contain function usages
In the ICD textbook’s example interpreter for evaluating expressions, in the row labelled let id = Exp1 in Exp2, we have the code: v1 = EvalExp(Exp1, vtable, ftable); vtableP = bind(vtable, getname(id), v1), EvalExp(Exp2, vtableP, ftable). The bind function changes vtable into vtableP by ANSWER.
inserting the binding of getname(id) with the value v1 into the table
One approach to speeding up an interpreter is to translate pieces of the code being interpreted directly into machine code during program execution, this is called ANSWER.
just-in-time compilation
The technical term for the compiler design methodology where the translation closely follows the syntax of the language is ANSWER.
syntax-directed translation
Using the straightfoward expression translation scheme in the ICD 2nd edition textbook, if I were to TransExp(‘3 * x + 1’, vtable, ftable), newvar() will be invoked ANSWER times.
5
Using the straightfoward statement translation scheme in the ICD textbook, if I were to TransStat(‘if true then z := 1 else z := 2’, vtable, ftable), newlabel() will be invoked ANSWER times.
3
Using the straightfoward statement translation scheme in the ICD textbook, if I were to TransStat(‘while true do z := 1 + z’, vtable, ftable), newlabel() will be invoked ANSWER times.
3
Using the straightfoward statement translation scheme in the ICD textbook, if I were to TransStat(‘while z < 3 do z := 1 + z’, vtable, ftable), newvar() will be invoked ANSWER times.
5
When type checking done during program execution, the type system is called ANSWER.
dynamic typing
When type checking done during program compilation, the type system is called ANSWER.
static typing
ANSWER typing is when the language implementation ensures that the arguments of an operation are of the type the operation is defined for.
Strong
ANSWER is the data structure used in language translation to track the binding of variables and functions to their type.
A symbol table
The different traversals of a syntax tree done during compilation associate information with the nodes of the tree. The technical term for this kind of information is ANSWER.
attributes
ANSWER means that the language allows the same name to be used for different operations over different types.
Overloading
Some languages allow a function to be ANSWER, that is to be defined over a large class of similar types, e.g., over arrays no matter what type their elements are.
polymorphic
generic
When a function is invoked, if the language passes a copy of the value of each parameter to the code that performs the function, this is called ANSWER.
pass-by-value
If the system stack is used for a call stack, then it becomes important for the caller to update the top of the stack before copying items into it. The reason is because we are worried about the top of the stack being changed by ANSWER after we have copied in information but before we updated the stack top.
an interrupt
The portion of the call stack associated with a single function invocation and execution is called ANSWER.
an activation record
Another method of parameter passing, whose technical name is ANSWER, is implemented by passing the address of the variable (or whatever the given parameter is). Assigning to such a parameter would then change the value stored at the address.
pass-by-reference
In C, when you pass a function as a parameter to another function, it is implemented as passing ANSWER.
the address of the start of the function code