1/120
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Why do we study programming languages
More ways to express idea, more information when choosing a language for a problem, easier to learn the next language, better idea of how languages work under the hood.
What are the programming domains?
Scientific computing, business computing, AI, Systems programming, web programming, entertainment.
What are the 4 language criteria and how are they related?
Readability, writability, reliability, cost
What are the influences on language design?
System Architecture and programming needs.
What are the language design trade-offs?
•Reliability vs. cost of execution
•Readability vs. writability
•Writability (flexibility) vs. reliability
What are the main implementation methods for programming languages?
Compiled
Interpreted
Hybrid
What are the major paradigms of programming?
Procedural
Functional
Logical/declarative
Object Oriented
What is the general timeline for programming languages?
fortran -> algol -> C -> java/python
What languages broadly influence what other language
1) C influences Python, as python is just scripted C
What are some early pre-cursors of programming languages?
Plankalkul
Pseudocodes
FORTRAN
LISP
ALGOL
What was the first compiling system?
UNIVAC
Fortran...what were it's major additions to programming languages?
First compiled language
Accessibility
Portability
Functional programming...why was it created and what language came first?
Created to handle list processing and AI. Lisp was first
Algol...why is it such an important language?
It was the first attempt at a universal programming langauge
First use of BNF
Cobol...what is it's purpose and what did it add to programming languages?
Used for business computing, has executable operations and data definition
Why is Basic an important language?
First widely adopted programming language for home computers, and it was easy to learn.
What did PL/I get wrong?
Many new features were poorly designed
Too large and too complex
Why was ADA successful?
Because it was used in the defense industry for a long time due to gov requirements.
What was the first OO language?
Simula, smalltalk was also early
What is syntax?
The arrangement of words and phrases to create well-formed sentences in a language.
What is semantics?
Meaning of words and sentences
How do we describe sentences?
A finite set of symbols
What are lexemes?
lowest level syntactic unit of a language
What are tokens
A category of lexemes
What is the test for language ambiguity?
If you can create more than one unique parse tree for a sentence, then the language is ambiguous
When analyzing a program for syntactical correctness, what are the two major steps? Why are these two steps usually separated?
Lexical analysis, then parsing. Separating them makes designing the compiler simple.
What are the two major approaches to syntax analysis?
Top down parsing and bottom up parsing.
What is the most common top-down parsing method? What is the shortcoming of this method?
Recursive descent parser. It is bad at handling ambiguity.
What is the most common bottom-up parsing algorithm?
shift reduce parsing
What are the design issues related to names?
Are names case sensitive?
Are special words reserved words or keywords?
What is the sextuple of attributes for a variable?
1) Name
2) address
3) value
4) type
5) lifetime
6) scope
When considering the address of a variable, what is an alias?
When multiple variable names or expressions can be used to access the same location in memory.
What is a data type?
indicates the type of data a memory location (variable or named constant) can store
What are the two broad categories of binding?
Static, dynamic
What is scope?
Where a variable is legal to reference in code
What is lifetime?
How long a variable stays in memory
How is static scope used to determine the value of a variable?
Value of a variable is determined at definition
How is dynamic scope used to determine the value of a variable?
Value of a variable is determined at execution
What is a referencing environment and how is it used to determine the value of a variable?
the collection of all variables that are "visible" and accessible at a specific point in a program
What is a variables descriptor?
the collection of the attributes of a variable
What is a primitive data type?
A data type not made up of any other data types
What are some examples of primitive data types?
Int, boolean, char, float
How are primitive data types stored or represented?
Binary encodings
For character/string data types, what are the major design issues?
Static vs dynamic length
Character array vs primitive type
What is an array?
A data structure with one, or more, elements of the same type
What are the design issues associated with arrays?
fixed size, inflexible memory management, inefficient manipulation of elements
What is a rectangular array?
An array where all rows are the same length
What is a jagged array?
An array where all rows are different lengths
What is a slice?
a subset of an array or other data structure
What is an associative array?
An array that stores data in key value pairs
What is a record type?
a composite data structure that groups related data fields into a single, named unit
how does C implement a record?
As a struct
What is a tuple?
An immutable, ordered set of values of any type.
What is a list?
An ordered collection of elements of a single data type
What is a pointer?
A variable that stores the memory address of another variable.
What are the major design issues when dealing with pointers?
Dangling pointers, null pointers, memory leakage
What is a dangling pointer?
A pointer initially holding a valid address, but later the held address is released.
What is a lost pointer?
a pointer that no longer reliably leads to intended data
What is a solution to the issues with pointers
Tombstones, locks and keys
What is type checking?
process in programming languages to verify and enforce constraints on the data types of variables, expressions, and function arguments
What languages enforce type checking?
C, C++, Java, C#, Rust, Haskell, Go, Pascal, Swift, Kotlin
What languages don't enforce type checking?
Python, Assembly, JavaScript
What is strong typing?
a language's strict enforcement of data type rules, which prevents or discourages the mixing of incompatible types and limits implicit type conversions
What is type equivalence?
rules for determining if two types are the same
What is an expression?
An expression is a combination of literals, operators, variables, and parentheses used to calculate a value.
What is an operator?
a symbol or keyword that performs a specific operation on one or more operands
What are the three types of operators
arithmetic, relational, logical
How is order of operation determined?
precedence and associativity
What can be used to change the default order of operation?
Parenthesis
What is a conditional expression?
An expression that evaluates to true or false.
What is a side-effect?
when a function changes a parameter or a global variable
How can side-effects complicate expression evaluation
If the changed parameter is merged with the function return
What is an overloaded operator?
Using the same symbol to mean two different things
What is type conversion?
the process of converting data of one type into another
When does type conversion typically take place?
implicitly and explicitly
What is a relational expression?
a statement that compares two or more values or operands using a relational operator
What is a Boolean expression?
True or false
What is short-circuit evaluation
Only evaluate as much as needed to determine truth of statement
How can short-circuit evaluation be used to protect an expression?
To prevent errors and unnecessary work
What is an assignment statement?
Central concept of imperative languages
How is assignment handled in various languages?
with a special symbol(s) such as = :=
What is a control statement
Statements that alter the normal sequential flow of a program
What is a control structure?
a conditional or loop.
What is a two-way selection statement?
allows a program to choose between two distinct paths based on a conditional
What are the design issues related to two-way selection statements?
The dangling else statement
How are nested selection statements handled in various languages?
braces, brackets, switch statements
What is a multiple selection branch?
classic switch statement
What are the design issues related to multiple selection branches?
readability and writeability
What are two different implementations of multiple selection branches?
cond, switch
What is an iterative structure?
a repeating selection statement
What are the 3 main types of iterative structures?
for, while, do
What are the design decisions for these main types of iterative structures?
control flow, the timing of condition checks, and the intended use case
What is an unconditional branch command?
a jump
Why is an unconditional branch command so dangerous?
control hazards
are subprograms process abstraction or data abstraction?
process abstraction
What are the general characteristics of subprograms?
Single entry point.
Caller is suspended until subprogram finishes
Control always returns to caller when finished
What are parameters?
Special variables used to pass values into a sub programme
What are formal parameters?
the parameters listed with the function definition
What are actual parameters?
the variables used when calling the function
What are positional parameters?
Value is determined by how they are listed