programming languages (csc 4101) midterm
what is allowed for A{B[C]}Z? - ABC - ABCZ - ABBCBBZ - ABBBZ - ABCBCZ
ABBBZ ABCZ ABCBCZ ABBCBBZ
what is allowed for A{BA}Z? - AZ - ABZ - ABABBZ - ABAZ - BZ
AZ ABAZ
who invented Smalltalk?
Alan Key & Adele Goldberg
who invented C#?
Andes Hejlsburg
who was Ada named after?
Augusta Ada Byron
does this grammar pass the pairwise disjointness test? A -> aB | BAb B -> aB | b
B does, but A doesn't
who invented C++?
Bjarne Stroustrup
who invented JavaScript?
Brendan Eich
who invented Ada?
DOD
who invented C?
Dennis Ritchie
who invented attribute grammars?
Donald Knuth
generate a production rule for the following procedure from a RDP program (use spaces. the arrow is ->. don't account for errors). void E() { if (nextToken == 'id') { lex(); T(); } }
E -> id T
what are the alpha and beta sets for the grammar? E -> E%T | T T -> T+F | T&F | F
E: alpha = {%T}, beta = {T} T: alpha = {+F &F}, beta = {F}
who invented UNIVAC?
Grace Hooper
who invented Python?
Guido van Rossum
who invented Java?
James Gosling
who invented FORTRAN?
John Backus
who invented speedcoding?
John Backus
who invented BNF?
John Backus & Peter Naur
who invented BASIC?
John Kemeny & Thomas Kurtz
who invented Shortcode?
John Mauchly
who invented LISP?
John McCarthy
what does LR parsing mean?
L: processes input from left to right R: uses rightmost derivation, but in reversed order
who invented COBOL?
Mary K. Hawes
who invented Pascal?
Niklaus Wirth
what does PHP stand for?
PHP: hypertext processor
who invented PHP?
Rasmus Lerdorf
first high-level language invented
Zuse's Plankalkul
which is true about a shift reduce parser? a. column id starts with 0 b. the left column always ends in a number c. the accept sign is a # d. there is only one table for all grammars
a and b
syntax and semantics
a language's definition
what does BASIC stand for?
beginners all purpose symbolic instruction code
shift-reduce uses what type of parsing?
bottom-up
what does COBOL stand for?
common business oriented language
von Neumann architecture
computer architecture where a single control unit manages program control flow following a linear sequence of fetch-decode-execute
empty string
epsilon
what does FORTRAN stand for?
formula translation
program that generates sentences of a language
generator
a language based on giving the computer commands or procedures to follow
imperative language
sequence of characters that match some pattern
lexeme
analysis that converts characters in the source program into a sequence of tokens
lexical analysis
what does LISP stand for?
list processing language
is this grammar ambiguous? <expr> -> <expr> + <expr> | <const> <const> -> A | B | C
no
can you generate C = (A * C) + (B + C) from the grammar? <assign> -> <id> = <expr> <id> -> A | B | C <expr> -> <id> | <expr> | <id> + <expr> | <id> * <expr> | (<expr>)
no, can't have 2 separate parenthesis
used to represent classes of syntactic structures
nonterminals
imperative, markup, logical, functional
programming language categories
what does PL/I stand for?
programming language one
ease of understanding syntax
readability
a program can read a string of symbols and decide whether the string is a member of a particular language
recognizer
parser that consists of a collection of recursive subprograms
recursive decent parser
a string of nonterminals and/or terminals with a LHS and RHS
rule or procedure
meaning of the expressions, statements, and program units
semantics
expression in a programming language
sentence
parts of the shift reduce parsing algorithm
shift, reduce, error, accept
form or structure of the expressions, statements, and program units
syntax
lexemes and tokens
terminals
why does recursive decent parsing use EBNF?
to reduce the amount of nonterminals
set of strings defining an atomic element with a defined meaning
token
what does UNIVAC stand for?
universal automatic computer
Simplicity, Efficiency, Portability
universal separation
Insufficient bus speed impedes performance
von Neumann bottleneck
ease of writing syntax
writability
is this grammar ambiguous? <assign> -> <id> = <expr> <id> -> A | B | C <expr> -> <id> | <expr> | <id> + <expr> | <id> * <expr> | (<expr>)
yes
first sets from A A -> aA | bAa | Bb B -> cB | d
{a} {b} {c} {d}