programming languages final

0.0(0)
studied byStudied by 0 people
0.0(0)
call with kaiCall with Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/102

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 4:31 AM on 12/11/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

103 Terms

1
New cards

Binding

The association between a name and the entity it refers to (value, type, memory location), occurring at a specific time.

2
New cards

Leftmost derivation

A derivation where the leftmost nonterminal is replaced at each step.

3
New cards

Rightmost derivation

A derivation where the rightmost nonterminal is replaced at each step.

4
New cards

Grammar (formal)

A set of terminals, nonterminals, productions, and a start symbol that defines a language.

5
New cards

Lexeme

A sequence of characters forming a meaningful unit (e.g., "while", "x", "==").

6
New cards

Token

A category of lexemes (e.g., IDENTIFIER, INTEGER_LITERAL).

7
New cards

Ambiguous grammar

A grammar that produces more than one parse tree for the same string.

8
New cards

Slice (array)

A subset of an array selected by indexing without copying the data.

9
New cards

Free union

A union with no tag/discriminant, making type checking impossible and unsafe.

10
New cards

Discriminated union

A union with an explicit tag indicating the active type, enabling type checking.

11
New cards

Strong typing

A language property where all type errors are guaranteed to be detected.

12
New cards

Coercion

Implicit conversion of a value from one type to another.

13
New cards

Name type equivalence

Two types are equivalent only if they share the same type name.

14
New cards

Structural type equivalence

Two types are equivalent if they have identical structure.

15
New cards

L-value

A memory location that can appear on the left side of an assignment.

16
New cards

R-value

The value stored at an L-value's memory location.

17
New cards

Activation record

The data structure that holds everything that a subprogram needs

A stack frame containing locals, parameters, return address, static link, and dynamic link.

18
New cards

Static link

An activation record instance for subprogram A points to one of the activation record instances of A's static parent

19
New cards

Dynamic link

points to the top of an instance of the activation record of the caller

20
New cards

Closure

a subprogram and the referencing the environment where it was defined

21
New cards

Tail recursion

A recursive call that is the final action in a function, enabling optimization.

22
New cards

Referential transparency

An expression can be replaced by its value without changing program behavior.

23
New cards

Critical section

A code region that must be executed atomically to avoid race conditions.

24
New cards

Semaphore

A synchronization primitive with atomic wait() and signal() operations.

25
New cards

Monitor

A structure combining shared data and procedures with enforced mutual exclusion.

26
New cards

Exception propagation

The process where an exception is passed up the call chain until handled.

27
New cards

Dangling pointer

A pointer that references memory that has been deallocated.

28
New cards

Memory leak

Heap memory that is allocated but no longer accessible.

29
New cards

Mark-sweep

A garbage collection algorithm that marks reachable objects and frees the rest.

30
New cards

Reference counting

Garbage collection where each object tracks how many references point to it.

31
New cards

Static scope

Scope determined by program structure; the nearest lexical block defines the variable.

32
New cards

Dynamic scope

Scope determined by the call chain at runtime.

33
New cards

Pass-by-value (in mode)

The callee receives a copy of the argument; caller cannot be modified.

34
New cards

Pass-by-reference (inout mode)

The callee receives a reference; changes affect the caller.

35
New cards

Pass-by-result (out mode)

Value copied in, and the result copied back out after the call.

36
New cards

Pass-by-name

Arguments are substituted as an expression and re-evaluated each time used.

37
New cards

Static typing

Types determined at compile time; safer and faster.

38
New cards

Dynamic typing

Types determined at runtime; flexible but less safe.

39
New cards

Row-major order

Array elements stored row-by-row (C, Java).

40
New cards

Column-major order

Array elements stored column-by-column (Fortran).

41
New cards

Pointer

A variable storing a memory address; supports dereferencing and arithmetic.

42
New cards

Reference

A safe, restricted pointer used for objects; no arithmetic allowed.

43
New cards

Race condition

Incorrect behavior caused by unsynchronized concurrent access.

44
New cards

Deadlock

Processes wait indefinitely due to circular waiting and resource holding.

45
New cards

Deadlock conditions

Mutual exclusion, hold and wait, no preemption, circular wait.

46
New cards

Pure function

A function with no side effects and referential transparency.

47
New cards

Higher-order function

one that either takes functions as parameters or yields a function as its result, or both

48
New cards

Lazy evaluation

Expressions evaluated only when needed.

49
New cards

List comprehension

A concise syntax for generating lists from an expression and iterator.

50
New cards

Why separate lexical & syntax analysis?

Simplicity (regex-based), efficiency, and reduced grammar complexity.

51
New cards

Why ambiguous grammars are bad

Multiple parse trees cause unclear interpretation and inconsistent meaning.

52
New cards

When arrays are best

When data is homogeneous and indexed numerically.

53
New cards

When records are best

When data is heterogeneous and accessed by name.

54
New cards

Writeability

The ease with which a programmer can write correct, clear code.

55
New cards

What improves writeability?

Simplicity, orthogonality, and expressiveness.

56
New cards

Dangling pointer example

A pointer still pointing to freed heap storage.

57
New cards

Memory leak example

Heap memory lost because no pointer references it.

58
New cards

Closure example

A function returning another function that uses outer variables.

59
New cards

Static link purpose

Allows access to nonlocal variables in statically enclosing scopes.

60
New cards

Dynamic link purpose

Restores caller's activation record during subprogram return.

61
New cards

Critical section requirements

Mutual exclusion, progress, bounded waiting.

62
New cards

Semaphore wait

Sets process to block if semaphore value < 0.

63
New cards

Semaphore signal

Increments semaphore and wakes one waiting process.

64
New cards

Monitor advantage

Provides automatic mutual exclusion and condition variables.

65
New cards

Deadlock prevention

Prevent any one of the Coffman conditions from holding.

66
New cards

Referential transparency example

Replacing x+5 with its evaluated value produces no change in behavior.

67
New cards

Exception advantage

Separates normal code from error handling; avoids error-return clutter.

68
New cards

Prolog unification example

[l,a,n,g,u,a,g,e] = [_,_,_,_|[H|T]] → H = g, T = [u,a,g,e]

69
New cards

Scala closure example

A lambda that captures the variable "factor" from its environment.

70
New cards

Futures example

The program prints asynchronously; output order depends on completion time.

71
New cards

Array descriptor

A structure describing an array's bounds, element size, and addressing.

72
New cards

Slice implementation

A referencing mechanism selecting part of an array without copying.

73
New cards

Union safety issue

Free unions allow mismatched types and runtime errors.

74
New cards

Static vs dynamic binding of types

Static: compile-time binding. Dynamic: runtime binding.

75
New cards

Shallow vs deep binding

Shallow: use environment at call time. Deep: use environment at definition time.

76
New cards

Message passing

A concurrency model where processes communicate by sending messages.

77
New cards

Monitors vs semaphores

Monitors are high-level and safer; semaphores are low-level and error-prone.

78
New cards

Functional programming features

Emphasizes immutability and pure functions.

79
New cards

Tail-call optimization benefit

Prevents stack growth in recursive calls.

80
New cards

Future

A placeholder for a value produced by an asynchronous computation. Allows a program to start work in the background and continue executing until the result is needed.

81
New cards

union type

type whose variables are

allowed to store different type values at

different times during execution

82
New cards

optional type

A type that can hold either a normal value or a special “no value” marker (like Some/None), providing safe handling of missing or undefined values.

83
New cards

type checking

ensuring that the operands of

an operator are of compatible types

84
New cards

control structure

a control statement and the statements whose execution it controls

85
New cards

subprogram

describes an interface and the actions to be performed.

86
New cards

actual parameter

argument represents a value or address used in the subprogram call statement

87
New cards

formal parameter

a dummy variable listed in the subprogram header and used in the subprogram

88
New cards

procedures

collection of statements that define parameterized computations (do a task) typicallyl does not return a value

89
New cards

functions

structurally resemble procedures but are semantically modeled on mathematical functions, always return a value

90
New cards

two types of subprograms

functions and procedures

91
New cards

overloaded subprogram

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

92
New cards

generic subprogram

takes parameters of different types on different activations

93
New cards

coroutine

a subprogram that has multiple entries and controls them itself – supported directly in Lua

94
New cards

subprogram linkage

The subprogram call and return operations of a language are linked together

95
New cards

“simple” subprograms

subprograms can't be nested

all local variables are static

96
New cards

OOP three major features

ADTs

inheritance

polymorphism

97
New cards

dynamic binding

a runtime mechanism in which the method (or function) to be invoked is determined based on the dynamic type of the object.

allows polymorphism to work

98
New cards

concurrency

the ability of a computer to handle more than one task at the same time, but not necessarily doing them at the exact same instant.

99
New cards

physical concurrency

when multiple processors are used to execute concurrent units

100
New cards

logical concurrency

concurrent united are executed on a single processor

Explore top flashcards