Programming Languages Final

Programming Languages Final

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

variable lifetime: static

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 14, 2020

Cards (83)

Section 1

(50 cards)

variable lifetime: static

Front

bound before execution and never changes (global variables)

Back

free union

Front

no language support for type checking

Back

major influences on language design

Front

machine architecture and software development methodologies

Back

locks-and-keys

Front

pointer values are represented as key, address pairs, heap-dynamic variables are variable plus a cell for integer lock value, when allocated the lock value is in the lock cell and key cell, each dereference must compare the key and the lock

Back

variable lifetime: stack dynamic

Front

bound when elaborated (local variables)

Back

primitive data types

Front

not defined in terms of other data types

Back

discriminated union

Front

each union includes a type indicator called the discriminant to aid in type checking

Back

coercion

Front

automatic compiler-generated conversion of one type to another

Back

cons vs. list vs. append

Front

cons takes the first parameter and makes it the head of the second parameter (that should be a list) [note cons makes a dot pair if the second parameter is not a list], list takes any number of parameters and returns a list of those elements, append, takes the second parameter (either list or atom) and appends to the end of the first parameter (which must be a list)

Back

function side effects

Front

when a function changes a parameter or global variable

Back

types of static type binding

Front

explicit (stated in source code) and implicit (implied/ inferred by compiler)

Back

major methods of implementing programming languages

Front

compilation, pure interpretation, hybrid implementation

Back

enumeration types

Front

user-defined ordinal types with named constants

Back

compare the 4 categories of arrays

Front

static (subscript ranges & storage allocation are both static), fixed stack-dynamic (subscript ranges are statically bound but allocation is at elaboration time), fixed heap-dynamic (subscript binding is fixed after allocation but storage is dynamic), heap-dynamic (subscript ranges and storage allocation are both dynamic)

Back

referential transparency

Front

any two expressions in the program with the same value can be substituted for one another anywhere in the program without affecting the action of the program

Back

union types

Front

variables are allowed to store different type values at different times during execution

Back

name type equivalence

Front

two variables have equivalent types if they are in the same declaration or in declarations that use the same type name

Back

tombstone

Front

there is an extra heap cell as a pointer to the heap-dynamic variable, pointers only point to tombstones, when heap-dynamic variable is deallocated, the tombstone is set to null

Back

let vs. let* vs. letrec

Front

let uses the value immediately previous to the let environment, let uses the most recent value, even if within the current let environment, letrec is like let* but allows later bindings to be referenced by earlier bindings

Back

stream set-up (generic)

Front

(define (stream-name parameters) (letrec ([f (parameters if any) do-stuff-here (cons next-element (lambda ( ) (f parameters)))]) (lambda ( ) (f starting-parameters)))

Back

reference counter

Front

eager approach, reclamation is gradual/ continual, maintain a counter in every cell which stores the number of pointers currently pointing at the cell, reclaim cells when their count drops to zero, requires space, time, and is complicated with circularly connected cells

Back

generational copiers

Front

exploits the fact that some objects have long lives what others have long lives; keeps track of lifetimes and collects long lifetime objects less frequently

Back

array slice

Front

some subsection of an array

Back

the prolog interpreter process

Front

start at the beginning of the database; left-to-right and depth-first search using stack and backtracking

Back

elliptical reference

Front

allows leaving out record names as long as the reference is unambiguous

Back

compare the 3 string length types

Front

static (determined at compile time), limited dynamic (buffer), dynamic (unbounded)

Back

fully-qualified reference

Front

must include all record names

Back

dangling pointer

Front

pointer points to a heap-dynamic variable that has been deallocated

Back

associative arrays

Front

unordered collection of elements indexed by keys

Back

stream

Front

infinite sequence of values generated as needed via thunks

Back

heterogeneous array

Front

elements might not be of the same type

Back

most important criteria for evaluating programming languages

Front

readability, writability, reliability, cost

Back

memory leak

Front

allocated heap-dynamic variable is no longer accessible to the user program

Back

ordinal types

Front

range of possible values can be easily associated with the set of positive integers

Back

rectangular array

Front

rows have same number of elements, columns have same number of elements, number of rows != number of columns

Back

stop-and-copy

Front

lazy approach, splits heap memory in half, all new allocations go into the active half, at collection time recursively follow all live pointers and copy all discovered structures to other half which becomes the active half, the inactive half now only contains garbage that is reclaimed en masse

Back

variable lifetime: implicit heap dynamic

Front

dynamic allocation and deallocation implicitly via assignment statements (happens during execution)

Back

thunk

Front

parameter-less function wrapped around a first-order function to delay its evaluation

Back

jagged array

Front

rows have varying number of elements

Back

variable lifetime: explicit heap dynamic

Front

allocated and deallocated explicitly by the programmer (happens during execution)

Back

4 categories of variable lifetimes

Front

static, stack dynamic, explicit heap dynamic, implicit heap dynamic

Back

mark-and-sweep

Front

lazy approach, recursively follow all live pointers, marking all discovered structures as useful, then sweep over the entire heap and reclaim any structures not marked as useful and turn off marks in preparation for next time

Back

strong typing

Front

type errors always detected whether at compile time or run time

Back

row major order vs. column major order

Front

determines if stored as array of rows or as array of columns

Back

r-value vs. l-value

Front

l-value is the memory address, r-value is the value stored at that memory address

Back

returning values other than true/ false in prolog

Front

add another parameter to carry back the result

Back

structure type equivalence

Front

two variables have equivalent types if their types have identical structures

Back

static scope vs. dynamic scope

Front

in static scoping, the subprogram can view variables at the same level or above, but not variables within other subprograms; in dynamic scoping, can view all variables in above calling sequence

Back

variable scope in Prolog

Front

the clause in which it appears; on the LHS implied for-all; on the RHS implied there-exists

Back

what is returned by ( cdar '( (A B) C D ) )

Front

(B)

Back

Section 2

(33 cards)

pass-by-reference

Front

pass an access path (pointer/ reference)

Back

chain offset/ nesting depth

Front

static depth of reference - static depth of where it is declared

Back

displays

Front

single array with static links; at any given time is a list of addresses of accessible ARIs (one for each static level)

Back

pass-by-value-result

Front

value is copied in and then copied back out (local storage)

Back

activation record

Front

the format/ layout of the non-code part of an executing subprogram (local variables and data that can change)

Back

keyword parameter correspondence

Front

name of the formal parameter is used to specify correspondence

Back

static depth

Front

depth of nesting of that scope

Back

procedure vs. function

Front

procedures don't return values while functions do

Back

block implementation options

Front

separate parameterless subprogram (new ARI with every execution; runtime overhead) OR there is space included in activation record for the block data

Back

static chain

Front

a chain of static links that connects certain ARIs (connects one to all of its static ancestors)

Back

pass-by-name

Front

pass na unevaluated expression to the formal parameter that is evaluated every time the formal parameter is used

Back

blocks

Front

user-specified local scopes for variables

Back

call-by-name

Front

arguments to functions are not evaluated at all until used (thunk)

Back

activation record instance (ARI)

Front

concrete example of an activation record

Back

closure

Front

subprogram and the referencing environment where it was defined

Back

pass-by-value

Front

usually copying

Back

coercion vs casting

Front

coercion is implicit while casting is explicit

Back

pass-by-result

Front

empty parameter is passed in and value is assigned to that

Back

location where ARIs reside

Front

run-time stack

Back

positional parameter correspondence

Front

parameters must follow the same order in call statement and definition

Back

short circuit evaluation

Front

expression result is determined without evaluating all of the operands/ operators

Back

shallow access

Front

central table with entry for each local variable name; each entry is a stack with the most recent value on top

Back

local offset

Front

offset of a local variable from the EP

Back

deep binding

Front

environment of the definition of the passed subprogram

Back

static link

Front

a link in an ARI for a subprogram that points to the most recent ARI of its static parent

Back

deep access

Front

find non-local references by searching the ARIs on the dynamic chain

Back

call-by-need

Front

expression is evaluated once and result is remembered to be used later

Back

dynamic link

Front

points to the bottom of the ARI of the caller (old EP)

Back

environment pointer (EP)

Front

maintained by run-time system; points to base of the ARI of currently executing program unit

Back

shallow binding

Front

environment of the call statement that enacts the passed subprogram (within the function that has the subprogram as a parameter)

Back

ad hoc binding

Front

environment of the call statement that passed the subprogram (environment of the call to the function that has the subprogram as a parameter)

Back

mixed mode expressions vs. mixed mode assignments

Front

the result of a mixed mode expression could be part of a mixed mode assignment statement

Back

dynamic chain/ call chain

Front

collection of dynamic links in the stack at a given time

Back