Principles of Programming Languages Final

Principles of Programming Languages Final

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

top down

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (196)

Section 1

(50 cards)

top down

Front

A ___ ____ parser produces the parse tree, beginning at the root. The order is that of a leftmost derivation. This traces or builds the parse tree in preorder.

Back

inherited

Front

Syntax <assign> -> <var> = <expr> <expr> -> <var> + <var> | <var> <var> A | B | C actual_type: ___________ for <var> and <expr> expected_type: _________ for <expr> What is the blank for expected type?

Back

terminal

Front

For any rule with multiple definitions, the FIRST set is the first ________ symbol that appears in each definition

Back

Denotational

Front

___________ Semantics: The process of building a ____________ specification for a language: - Define a mathematical object for each language entity. - Define a function that maps instances of the language entities onto instances of the corresponding mathematical objects.

Back

left factoring

Front

You can use ____ ________ to remove pairwise disjointness. Example: replace <variable> -> ident | ident[<expression>] with <variable> -> ident <new> <new> -> eplison | [<expression>]

Back

rule

Front

(In BNF)A ____ has a left-hand side (LHS), which is a nonterminal, and a right-hand side (RHS), which is a string of terminals and or nonterminals.

Back

abstraction

Front

A variable is an ___________ of a memory cell.

Back

table

Front

LR parsers are _____ driven, where the _____ has two components: an ACTION _____ and a GOTO _____.

Back

Operational

Front

In ___________ semantics, the state changes are defined by coded algorithms.

Back

Token

Front

This is a category of lexemes.

Back

sentential form

Front

(In BNF) Every string of symbols in a derivation is a __________ ____.

Back

Lexeme

Front

This is the lowest level syntactic unit of a language.

Back

repetition or iteration

Front

In Extended BNF form, what does the metasymbol {}, {}+ stand for?

Back

Syntax

Front

The form or structure of the expressions, statements, and program units.

Back

Type

Front

Variables can be characterizes as a sextuple of these following attributes: - Name - Address - Value - _____ - Lifetime - Scope

Back

choose one

Front

In Extended BNF form, what does the metasymbol (choices | separated | by | or bar) stand for?

Back

Pairwise Disjointness

Front

________ ____________ is when more than one RHS of a rule begins with the same terminal identifier Example: <variable> → identifier | identifier[<expression>]

Back

attributes

Front

Variables are characterized by _____________. To design a type, you must consider scope, lifetime, type checking, initilazition, and type compatibility.

Back

Terminals

Front

_________ are lexemes or tokens in BNF.

Back

Axiomatic

Front

__________ Semantics: Axioms or inference rules are defined for each statement type in teh language. The logic expressions are called assertions. An assertion before a statement states the relationships and constraints among variables that are true at that point in execution.

Back

goto

Front

The ____ table specifies which state to put on top of the parse stack after a reduction action is done.

Back

Repetition

Front

What is this an example of in Extended BNF? <ident> -> letter {letter | digit}

Back

Lifetime

Front

Variables can be characterizes as a sextuple of these following attributes: - Name - Address - Value - Type - ________ - Scope

Back

leftmost

Front

(In BNF) A ________ derivation is one in which the leftmost nontermainal in each sentential form is the one that is expanded.

Back

attribute grammar

Front

An ___________ _______ is a context-free grammar G = (S, N, T, P) with the following additions. - For each grammar symbol x, there is a set A(x) of attribute values. -Each rule has a set of functions that define the nontermainals in the rule. - Each rule has a (possibly empty) set of for attribute consistency.

Back

parser

Front

The ______ finds all syntax errors; for each, produce and approximate diagnostic message and recover quickly. Produce the parse tree, or at least a trace of the parse tree for the program.

Back

Value

Front

Variables can be characterizes as a sextuple of these following attributes: - Name - Address - _____ - Type - Lifetime - Scope

Back

closure

Front

A _______ represents all possible configurations for a given state. If the next symbol (after the .) is a non-terminal, then all productions of that non-terminal are included in that _______.

Back

sentence

Front

(In BNF) A ________ is a sentential form that has only terminal symbols.

Back

Semantics

Front

The meaning of the expressions, statements, and program units.

Back

Backus-Naur Form

Front

This was invented by John Backus to describe the syntax of Algol in 1958.

Back

derivation

Front

(In BNF) A _________ is a repeated application of rules, starting with the start symbol and ending with a sentence (all terminal symbols)

Back

left

Front

Why is left recursion a problem for a LL (top-down) parser? If a grammar has ____ recursion, either direct or indirect, it cannot be the basis for a top-down parser. You can get stuck in a loop forever.

Back

angle brackets

Front

In BNF, nonterminals are usually enclosed in _____ _________.

Back

lexer

Front

A _____ is a pattern matcher for character strings. It is the "front end" for the parser.

Back

bottom-up

Front

The LR parser is a _____ ____ parser. Given a right sentential form, A, it determines what substring of A is the right-hand side of rule in the grammar and then reduces it to produce the previous sentential form in the right most derivation.

Back

action

Front

The ______ table specifies the action of the LR parser, given the parser state and the next token.

Back

denotational

Front

In ____________ semantics, the state changes are defined by rigorous mathematical functions.

Back

Scope

Front

Variables can be characterizes as a sextuple of these following attributes: - Name - Address - Value - Type - Lifetime - _____

Back

synthesized

Front

In an attribute grammar, Functions of the form S(X0) = f(A(X1), ... , A(Xn)) define ____________ attributes.

Back

Optional or repeated

Front

In Extended BNF form, what does the metasymbol [] stand for?

Back

ambiguous

Front

A grammar is __________ if and only if it generates a sentential form that has two or more distinct parse trees.

Back

Lexer

Front

The _____ goes through the program source code and tries to identify all the lexemes.

Back

Operational

Front

___________ Semantics: This describes the meaning of a program by executing its statements on a machine, either simulated or actual. The change in the state of the machine (memory, registers, etc) defines the meaning of the statement. A virtual machine is needed for this type fo semantics.

Back

synthesized

Front

Syntax <assign> -> <var> = <expr> <expr> -> <var> + <var> | <var> <var> A | B | C actual_type: ___________ for <var> and <expr> expected_type: _________ for <expr> What is the blank for actual type?

Back

bottom up

Front

A ______ __ parser produces the parse tree, beginning at the leaves. The order is that of a rightmost derivation.

Back

inherited

Front

in an attritube grammar Functions of the form I(Xj) = f(A(X0), ... , A(Xn)), for i <= j <= n, define _________ attributes

Back

LR

Front

Advantages of __ Parsers: - They will work for nearly all grammars that describe programming languages. - They work on a larger class of grammars than other bottom-up algorithms but are as efficient as any other bottom-up parser. - They can detect syntax errors as soon as it is possible. - The __ class of grammars is a superset of the class parsable by the LL parsers.

Back

top-down

Front

the LL parser is a ___ ____ parser, it uses a table-driven implementation. This type looks from left to right, and uses the next character to determine what the next sentential form is.

Back

Address

Front

Variables can be characterizes as a sextuple of these following attributes: - Name - ________ - Value - Type - Lifetime - Scope

Back

Section 2

(50 cards)

Enumeration

Front

The ____________ type is a type where all possible values, which are named constants, are provided in the definition. Ex enum days {mon, tue, wed, thurs, fri, sat, sun};

Back

Integer

Front

An _______ is almost always an exact reflection of the hardware so the mapping is trivial. Primitive Data Type

Back

data type

Front

A ____ ____ defines a collection of data objects and a set of predefined operations on those objects.

Back

nonlocal

Front

The _______ variables of a program unit are those that are visible in the unit but not declared there.

Back

allocation

Front

Storage __________ is getting a cell from some pool of available cells.

Back

dynamic

Front

A binding is _______ if it first occurs during execution or can change during execution of the program.

Back

Explicit

Front

________ heap dynamic-- allocated and deallocated by explicit directives, specified by the programmer, which take effect during execution. These are referenced only through pointers or references.

Back

Abstract memory cell

Front

________ ______ ____: The physical cell or collection of cells associated with a variable.

Back

deallocation

Front

Storage ____________ is putting a cell back into the pool to be selected from.

Back

descriptor

Front

A __________ is the collection of the attributes of a variable.

Back

array

Front

An _____ is a homogeneous aggregate of data elements in which an individual element is identified by its position in the aggregate, relative to the first element.

Back

local

Front

the _____ variables of a program unit are those that are declared in that unit.

Back

Language implementation time

Front

________ ______________ ____: Type of binding time where floating point types are bound to a represenetation.

Back

Heap-Dynamic

Front

________ array: binding of subscript ranges and storage allocation is dynamic and can change any number of times.

Back

Dynamic

Front

_______ Scope: Based on calling sequences of program units, not their textual layout. references to variables are connected to declarations by searching back through the chain of subprogram calls that forced execution to this point.

Back

Value

Front

Variable _____ is the contents of the location with which the variable is associated. The I-_____ of a variable is its address. The r-_____ of a variable is its value.

Back

lifetime

Front

Consider the following function void myf(){ static int x; } _______ = begin to end of program life?

Back

Language Design Time

Front

________ _______ ____: Type of binding time where the operator symbols are bound to operations.

Back

Stack-Dynamic

Front

_________ Storage bindings are created for variables when their declaration statements are elaborated. (A declaration is elaborated when the executable code associated with it is executed) Advantage: allows recursion Disadvantages: Overhead of allocation and deallocation Subprograms cannot be history sensitive.

Back

Binding time

Front

_______ ____ is the time at which a binding takes place.

Back

address

Front

Variable _______: The memory address with which it is associated.

Back

Name

Front

Variables can be characterizes as a sextuple of these following attributes: - ______ - Address - Value - Type - Lifetime - Scope

Back

Primitive

Front

________ Data types: These are data types that are not defined in terms of other data types.

Back

binding

Front

A _______ is an association between an entity and an attribute, such as between a variable and its type or value, or between an operation and a symbol.

Back

static

Front

A binding is ________ if it first occurs before run time and remains unchanged throughout program execution.

Back

object

Front

An ______ represents an instance of a user-defined data type.

Back

implicit declaration

Front

An ________ ____________ is a default mechanism for specifying types of variables through default conventions, rather than declaration statements.

Back

Global

Front

______ variables are a special category of nonlocal variables.

Back

Runtime

Front

_______: Bind a non static local variable to a memory cell.

Back

Fixed heap-dynamic

Front

______ array: similar to fixed stack-dynamic: storage binding is dynamic but fixed after allocation ( binding is done when requested and storage is allocated from the heap, not the stack). Ex malloc()

Back

local

Front

The referencing environment of a static-scoped language is the _____ variables plus all the visible variables in all of the enclosing scopes.

Back

Static

Front

______ Scope is based on program text. To connect a name reference to a variable, the compiler must find the declaration. _____ Scope looks for the declaration first locally, then in increasingly larger enclosing scopes, until one is found for the given name.

Back

ordinal

Front

An ________ type is one in which the range of possible values can be easily associated with the set of positive integers.

Back

ancestors

Front

Enclosing static scopes (to a specific scope) are called its static _________; the nearest static ancestor is called a static parent.

Back

static

Front

______ Binding happens when the variable is bound to memory cells before execution begins and remains bound to the same memory cell throughout execution.

Back

explicit declaration

Front

An ________ ___________ is a program statement used for declaring the types of variables

Back

scope

Front

Consider the following function void myf(){ static int x; } _______ = function body?

Back

lifetime

Front

The ________ of a variable is the time during which it is bound to a particular memory cell.

Back

Type

Front

Variable ____ determines the range of values of variables and the set of operations that are defined for values for that type; in the case of floating point, the ____ also determines precision.

Back

name

Front

Variable ____: not all variables have these.

Back

Implicit

Front

________ heap-dynamic -- Allocation and deallocation caused by assignment statements. All variables are dynamic.

Back

referencing environment

Front

The _________ _________ of a statement is the collection of all names that are visible in the statement.

Back

named constant

Front

A _____ _______ is a variable that is bound to a value only when it is bound to storage.

Back

Load Time

Front

____ ____: time in C or C++ then a static variable is bound to a memory Cell.

Back

Static

Front

______ Subsbscript ranges are statically bound and storage allocation is static.

Back

dynamic

Front

_______ Type binding is specified through an assignment statement. example in javascript list = [2, 4.33, 6, 8] list = 17.3 This offers flexibility.

Back

aliases

Front

If two variable names can be used to access the same memory location, they are called ________. These are created by pointers.

Back

scope

Front

The _____ of a variable is the range of statements over which it is visible.

Back

Compile Time

Front

_______ ____: Type of binding where a variable is bound to a type in C or java.

Back

Fixed stack-dynamic

Front

________ array: subscript ranges are statically bound, but the allocation is done at declaration time.

Back

Section 3

(50 cards)

mixed-mode

Front

A _____-____ expression is one that has operands of different types.

Back

referential transparency

Front

A program has the property of ___ ___ if any two expressions with the same value can be substituted for each other without affecting the program's behavior.

Back

strongly

Front

A programming language is ________ typed if type errors are always detected.

Back

ternary

Front

A _______ operator has three operands: ;choice = (x < y)? "yes" "no"

Back

associative

Front

An ____________ array is an unordered collection of data elements that are indexed by an equal number of values called keys.

Back

keyword

Front

Actual/Formal Parameter Correspondence: _______: The name of the formal parameter to which an actual parameter is to be bound is specified with the actual parameter. Advantage: Parameters can appear in any order, thereby avoiding parameter correspondence errors.

Back

unary

Front

A _____ operator has only one operand: i++

Back

Name Type equivalence

Front

_____ _____ ___________ means the two variables have equivalent types if they are in either the same declaratino or in declarations that use the same type name.

Back

point

Front

Jagged arrays are arrays that _____ to other arrays, while Rectangular arrays are represented as a single matrix.

Back

subprogram header

Front

A _________ ______ is the first part of the definition, including the name, the kind of subprogram, and the formal parameters.

Back

Jagged

Front

A ______ matrix has rows with varying number of elements.

Back

Mark Sweep

Front

a method of garbage collection in which all storage that is in use is marked, then all storage that is not marked is swept up for reuse.

Back

Dangling Pointer

Front

This happens when a pointer points to a heap-dynamic variable that has been deallocated.

Back

Heterogeneous Array

Front

A _____________ ______ is one in which the elements need not be the same type.

Back

Reference Counter

Front

A managed memory technique that tracks the number of references to allocated memory, so that the memory can be freed when the count reaches zero

Back

Type error

Front

A _____ _____ is the application of an operator to an operand of an inappropriate type.

Back

narrowing conversion

Front

A conversion from one data type into another in which information could be lost. Converting from "double" to an "int" is a _________ _________-

Back

positional

Front

Actual/formal parameter Correspondence: __________: THe binding of actual parameters to formal parameters is by position: The first actual parameter is bound to the first formal parameter and so forth.

Back

Tombstone

Front

This is an extra heap cell that is a pointer to the heap-dynamic variable. The actual pointer variable points only at __________

Back

Locks and Keys

Front

pointer values are represented as (key, address) pairs

Back

binary

Front

A ______ operator has two operands: x + y

Back

constants

Front

Operand evaluation order: 1.) Variables: fetch the value from memory. 2.) _________: sometimes a fetch from memory; sometimes the constant is in the machine instruction. 3.) Parenthesized expressions: evaluate all operands and operators first. 4.) The most interesting case is when an operand is a function call: ex: a = b + c (evaluate b or c first)?

Back

Widening conversion

Front

A conversion between one data type and another in which information is not lost. ex int to float

Back

tuple

Front

A _____ is a data type that is similar to a record, except that the elements are not named.

Back

parameter profile

Front

The _________ _______ (aka signature) of a subprogram is the number, order, and types of its parameters.

Back

Boolean Expressions

Front

Evaluates to either true or false; used in the conditional of an if-structure. One odd characteristic of C's expressions: a<b<c is a legal expression, but only the left operator is evaluated, producing a 0 or a 1.

Back

pointer

Front

A _______ type variable has a range of values that consists of memory addresses and a special value, nil.

Back

union

Front

A ______ is a type whose variables are allowed to store different type values at different times during execution (but only one at a given time).

Back

Type checking

Front

____ ________ is the activity of ensuring that the operands of an operator are of compatible types.

Back

coercion

Front

A ________ is an implicit type conversion.

Back

operator precedence

Front

The ______ __________ rules for expression evaluation define the order in which "adjacent" operators of different precedence levels are evalueted.

Back

operator overloading

Front

Use of an operator for more than one purpose is called ________ __________-

Back

record

Front

A ______ is a possibly heterogeneous aggregate of data elements in which the individual elements are identified by names.

Back

Rectangular

Front

A __________ array is a multi-dimensioned array in which all of the rows have the same number of elements and all of the columns have the same number of elements.

Back

protocol

Front

The ________ is a subprogram's parameter profile and, if it is a function, its return type.

Back

Assignment

Front

__________ is used to set a pointer variable's value to some useful address.

Back

Dereferencing

Front

_______________ yields the value stored at the location represented by tht pointer's value. C++ ex j = *ptr;

Back

variables

Front

Operand evaluation order: 1.) _________: fetch the value from memory. 2.) COnstants: sometimes a fetch from memory; sometimes the constant is in the machine instruction. 3.) Parenthesized expressions: evaluate all operands and operators first. 4.) The most interesting case is when an operand is a function call: ex: a = b + c (evaluate b or c first)?

Back

formal parameter

Front

A ______ _________ is a dummy variable listed in the subprogram header and used in the subprogram.

Back

actual parameter

Front

An ______ _________ represents a value or address used in the subprogram call statement.

Back

parenthesized expressions

Front

Operand evaluation order: 1.) Variebles: fetch the value from memory. 2.) COnstants: sometimes a fetch from memory; sometimes the constant is in the machine instruction. 3.) ___________ ___________: evaluate all operands and operators first. 4.) The most interesting case is when an operand is a function call: ex: a = b + c (evaluate b or c first)?

Back

Compatible type

Front

A ___________ ______ is one that is either legal for the operator, or is allowed under language rules to be implicitly converted, by compiler-generated code, to a legal type.

Back

Short Circuit Evaluation

Front

An expression in which the result is determined withouut evaluating all of the operands and/or operators.

Back

subprogram definition

Front

A _________ __________ describes the interface and the actions of the subprogram abstraction.

Back

slice

Front

A _____ is some substructure of an array; nothing more than a referencing mechanism.

Back

Procedures

Front

____________ are collections of statements that define paremeterized computations.

Back

control structure

Front

A _______ _________ is a control statement and the statements whose execution it controls.

Back

Structure Type Equivalence

Front

__________ ____ ____________ means that two variables have equivalent types if their tyypes have identical structures.

Back

selection statement

Front

A _________ ________ provides the means of choosing between two or more paths of execution.

Back

subprogram call

Front

A _________ _____ is an explicit request that the subprogram be executed.

Back

Section 4

(46 cards)

Functions

Front

________ structurally resemble procedures but are semantically modeled on mathematical functions.

Back

Call semantics

Front

_____ _________: -Save the execution status of the caller - Pass the parameters - Pass the return address to the called program.

Back

symmetric control

Front

_________ _______: caller and called coroutines are on a more equal basis.

Back

modify

Front

Ways a class can differ from its parents: - The subclass can ________ the behavior of one or more of its inherited methods.

Back

Shallow Binding

Front

Parameters that are Subprogram Names: Referencing Enviornment _______ _______: The enviornment of the call statement that enacts the passed subprogram. -Most natural for synamic-scoped languages.

Back

Activation record instance

Front

A concrete example of an activation record, a collection of data in the form of an activation record.

Back

object slicing

Front

If objects are stack-dynamic, there is a problem with regaurd to subtype: _______ _______

Back

subprogram linkage

Front

The subprogram call and return operations of a language are together called its _________ _______

Back

superclass

Front

The classs from which another class inherits is a _____________

Back

coroutine

Front

A ________ is a subprogram that has multiple entries and controls them itself.

Back

hide

Front

A class can _____ entities from its subclasses, clients

Back

messages

Front

Calls to methods are called ________

Back

dynamic

Front

When a class hierarchy includes classes that override methods and such methods are called through a polymorphic variable, the binding to the correct method will be ______

Back

classes

Front

Abstract data types are usually called ________

Back

outmode

Front

Pass-by-Result

Back

Return Semantics

Front

_______ _________: - If pass-by-value-result or outmode parameters are used, move the current values of those parameters to their corresponding actual parameters - If it is a function, move the functional value to a place the caller can get it. - restore the execution status of the caller. - Transfer control back to the caller.

Back

syntactic

Front

Language Requirements for ADT's - A ________ unit in which to encapsulate the type definition.

Back

add

Front

Ways a class can differ from its parents: -The subclass can ____ variables and/or methods to those inherited from the parent.

Back

resume

Front

A coroutine call is named a _______

Back

objects

Front

Class instances are called ________

Back

Reliability

Front

Advantages of allowing object modification only through that object's methods: ____________: By hiding the data representations, user code cannot directly access objects of the type or depend on the representation allowing the representation to change without affecting user code. This reduces the range of code and variables of which the programmer must be aware.

Back

Ploymorphic subprogram

Front

A ___________ ________ takes parameters of different types on different activations.

Back

message protocol

Front

The entire collection of messages of an object are called its ________ ________

Back

class

Front

There are two kinds of variables in a class: - ______ Variables: one/class - Instance variables: One/object

Back

Inheritance

Front

_____________ allows new classes defined in terms of existing ones, by allowing them to inherit common parts.

Back

inmode

Front

Pass-by-value =

Back

overloaded subprogram

Front

An _________ __________ one that has the same name as another subprogram in the same referencing environment

Back

semantics

Front

General _________ of calls to a subprogram: - Parameter passing methods - Stack-Dynamic allocation of local variables - Save the execution status of calling program - Transfer of control and arrange for the return - If subprogram nesting is supported, access to nonlocal variables must be arranged.

Back

instance

Front

There are two kinds of methods in a class: Class methods: accept messages to the class _________ Methods: Accept messages to objects.

Back

Ad hoc binding

Front

The environment of the call statement that passed the subprogram

Back

inoutmode

Front

Pass-by-reference

Back

methods

Front

Subprograms that define operations on objects are called ________

Back

define

Front

Ways a class can differ from its parents: - The parent class can _______ some of its variables or methods to have private access which means they will not be visible in the subclass.

Back

abstract data type

Front

An _________ _____ _____ is a user-defined data type that satisfies the following two conditions: - The representation of objects of the type is hidden from the program units that use these objects, so the only operations possible are those provided in the type's definition. - The declarations of the type and the protocols of the operations on objects of the type are contained in a single syntactic unit other program units are allowed to create variables of the defined type.

Back

subprogram returns

Front

General semantics of ___________ _________: -Inmode and inout mode parameters must have their values returned. - Deallocation of stack-dynamic locals - Restore the execution status - Return control to the caller

Back

activation record

Front

The format, or layout, of the non-code part of an executing subprogram is called an ___________ ______

Back

abstraction

Front

An ___________ is a view or representation of an entity that includes only the most significant attributes.

Back

subclass

Front

A class that inherits another class is called a __________

Back

Encapsulation

Front

The provision of an interface for a piece of software or hardware to allow or simplify access for the user.

Back

closure

Front

A _______ is a subprogram and the referencing environment where it was defined. -The referencing enviornment is needed if the subprogram can be called from any arbirtaty place in the program. -A static-scoped language that does not permit nested subprograms doesn't need ________ -________ are only needed if a subprogram can access variables in nesting scipes and it can be called from anywhere.

Back

Deep Binding

Front

Parameters that are subprogram Names: Referencing enviornment: _____ _______: The enviornment of hte definition of the passed subprogram -Most Natural for static-scoped languages

Back

polymorphic variable

Front

A __________ _________ can be defined in a class that is able to reference objects of the class and objects of any of its descandants.

Back

resume

Front

Coroutines repeatedly ______ each other, possibly forever.

Back

parametric polymorphism

Front

A subprogram that takes a generic parameter that is used in a type expression that desctibes the type of the parameters of the subprogram provides __________ ____________

Back

quasi-concurrent

Front

Coroutines provide _____-__________ execution of program units (the coroutines); their execution is interleaves, but not overlapped.

Back

first

Front

The _____ resume of a coroutine is to its beginning, but subsequent calls enter at the point just after the last executed statement in the coroutine.

Back