SOLUTION RATED A+
✔✔Ch3 What does BNF stand for and what is it - ✔✔Backus Naur Form
a general meta language to describe the grammar of a programming language
✔✔Ch3 Grammar in BNF, the tuple and what the variables mean. - ✔✔4-tuple:
(T,N,S,P) character set, tokens, lexicons
T - set of terminals
N - finite set of non terminals (metasymbols, syntactic categories)
S - Element of non-terminal; start symbol from grammar (usually called grammar)
P - finite set of rules/productions of form
A ::= beta
lhs -> rhs(rhs can be empty)
A is single non terminal, ::= seperates lhs & rhs like arrow, beta is string od (T u N)*
Greek letters represent string
✔✔Ch3 What is ":="? - ✔✔the assignment operator in agol
✔✔Ch3 What is "::="? - ✔✔BNF arrow symbol
✔✔Ch3 T/F? Empty programs are allowed in AGOL. - ✔✔True (A parse tree can be
made for 'begin end')
✔✔Ch3 A language for which all grammar that generates it are ambiguous is called
an... - ✔✔inherently ambiguous language
✔✔Ch5 Structural type equivalence vs name type equivalence. What are they and
which is better? - ✔✔One depends on being structurally the same (C) while the other
just checks if they have the same name (C++)
Name type equivalence is easier and quicker, being more restrictive and says no more
often then yes.
✔✔Ch5 What are anonymous types? Examples? - ✔✔They're structs that do not have a
name assigned to them, but exist in memory.
Ex:
struct { int a; double b} x,y; // compiler puts a name if you don't in c++
struct { int a; double b} x; //not equivalent type to above, address names are different in
c++
✔✔Ch5 Subrange types. Example? What will work? - ✔✔x = y; // x is a subrange of y or
vise versa
int = 1...10; // WILL work
, 1...10 = int // ok but runtime checked
✔✔Ch5 What do scope rules do? - ✔✔specify when a name can be used and which
address the name refers to (if name is associated w/ multiple addresses)
✔✔Ch5 When are scopes determined/checked? - ✔✔@ compile time
ALSO all programming languages use static scope
✔✔SG Qualities of a good programming language include... - ✔✔readable, writable,
reliable, syntactic consistency, regularity
✔✔SG What is syntactic consistency? - ✔✔
✔✔SG What is reliability? - ✔✔
✔✔SG Translation techniques: Compilers vs interpreters - ✔✔
✔✔SG Translation techniques: compiler phases - ✔✔program -> interpreter -> code ->
execution
✔✔SG Translation techniques: static time vs dynamic time - ✔✔
✔✔SG 5 Gen of Imperative Languages: definition of imperative language programming
- ✔✔
✔✔SG 5 Gen of Imperative Languages: Differences between generations - ✔✔
✔✔SG 5 Gen of Imperative Languages: Example languages - ✔✔
✔✔SG Formal Methods for syntax: BNF, grammars, sentences, languages - ✔✔
✔✔SG Variable attributes: 1. name, keywords, reserved words, predefined names - ✔✔
✔✔SG Variable attributes: 2. address, names w/ multiple addr, aliasing - ✔✔scope rules
eliminate ambiguity
✔✔SG Variable attributes: 3. type, type checking, strong vs weak typed PLs, loop holes,
type equivalence, name vs structural equivalence - ✔✔
✔✔Ch3 Coercison definition: - ✔✔automatic conversion of types in mixed type
expression
✔✔Ch3 Structural or name type equivalence?