CPSC Quiz 5-7 Flashcards
A binding is an association between an attribute and an entity. Identify which is a binding category.
Static, Explicit heap-dynamic, Stack-dynamic
What is an attribute?
An attribute is any quantity associated with a programming construct.
True or False: A variable is a three tuple V = (T, L, C) where T = token, L = lexeme, and C = class.
False
What is a semantic rule?
A semantic rule is a specification declaring which attributes to associate with a given nonterminal.
True or False: An explicitly typed language may also be dynamically typed.
False
Which IR are linear?
TAC, IL
Which IR are graphical?
DAG, CST
True or False: A name is a string of characters used to identify an entity in a program.
True
What are the jobs of the semantic analysis phase?
Type checking, Access control and Scope Checking, Function Parameter Count and Consistency
The edges of a control flow graph represent
Control flow changes
The nodes of a control flow graph represent
Basic Blocks
A language that requires variables to have a declared type in the source code is called
Explicitly Typed
True or False: Side effects don’t impact the order that the operands are evaluated in
False
Which of the following are common primitive types?
Integer Types, Character Types
What is the difference between a pointer and a reference type?
A pointer is when a variable has a range of values that consists of memory addresses and nil. A reference type is a value of object in memory that can’t be changed to refer to a different variable once initialized.
A language that allows operators to work with operands of different types is said to contain
Mixed-mode Expressions
True or False: A side effect is when an operation, expression, or function has any observable effect other than its primary effect of reading the values of its operands and returning a value to the invoker.
True
True or False: An expression is an syntactic entity in a programming language that may be evaluated to determine its value
True
True or False: The creation of basic blocks from the input code forms a partition over the code
True
What is a partition?
Dividing the set of code into smaller, distinct sections based on specific criteria
When performing local optimization, which form are the TAC instructions inside the basic blocks converted into?
DAG
True or False: Local optimization is performed on the code contained within a basic block.
True
Data flow equations allow us to identify which of the following?
If an expression is available, has been killed, or is live on exit from the block
What are the two primary forms of data-flow analysis?
Forward flow analysis and backward flow analysis
Three optimization techniques:
Constant folding, strength reduction, common subexpression elimination
For which intermediate representations does our basic block identification algorithm operate on?
Three Address Code
How are basic blocks identified?
We define a leader to be the first instruction of the block. After leaders are assigned then basic block will consist of that and the instructions after until there is a new leader or a jump.
True or False: The dominance relation among nodes in a control flow graph is partial ordering.
True
True or False: A control flow graph is a DAG
False
True or False: Global optimization isn’t performed on the control flow graph
False