4337
UNAMBIGUOUS RULES
* term -> term * factor () factor -> (expr) + expr -> expr + term
reasons for studying concepts of programming languages
- increased capacity to express ideas - improved background for choosing appropriate languages - increased ability to learn new languages - better understanding of the significance of implementation - better use of languages that are already known - overall advancement of computing
4 implementation methods
-compilation -interpretation -hybrid implementation systems -preprocessors
Sort this list of Functional Programming Languages by the order of the year of their appearance/release.
1. LISP 2. Scheme 3. ML 4. Miranda 5. Common LISP 6. Haskell 7. Scala 8. Clojure
What two programming language deficiencies were discovered as a result of the research in software development in the 1970s?
1. incompleteness of type checking 2. inadequacy of control statements
One of the greatest single advances in computing came with the introduction of the IBM [a] in 1954, in large measure because its capabilities prompted the development of [b].
704 Fortran
Write EBNF descriptions (i.e. rules) for the a Java class definition header statement. Begin with the start symbol <class_header>. Use the non-terminal <class_name> for the user-defined name of the class You do not have to include a LHS rule which defines valid naming conventions to expand the <class_name> non-terminal
<class_head> → {<modifier>} class <class_name> [extends class_name] [implements <interface_name> {, <interface_name>}] <modifier> → public | abstract | final
Hybrid Implementation Systems
A compromise between compilers and pure interpreters Use: Small and medium systems when efficiency is not the first concern +faster than interpretation
The very first program was written in 1843 by [a], which was designed to execute on the theoretical hardware platform called the Analytical Engine, designed in 1842 by [b].
Ada Lovelace and Charles Babbage
Convert this EBNF to BNF: <proc_call> -> ident [<expr_list>]
BNF: <term> -> <term> + const | <term> - <const> EBNF: <term> -> <term> (+|-) const <ident> -> letter {letter|digit} <ident_list> -> <identifier> {, <identifier>}
In what language is most of UNIX written?
C
The first successful high-level language for business was
COBOL
What is the primary use of attribute grammars
Enforcing type compatibility
Pairwise disjointness test S->aSb|bAAS->aSb|bAA A->b{aB}|aA->b{aB}|a B->aB|a
FIRST(aSb) U FIRST(bAA) {a,b} True FIRST(b{aB}) U FIRST (a) {a,b} True FIRST(aB) U FIRST(a) {a,a} False FINAL RULE: FIRST(ai) N FIRST(aj) = null(no repeats)
The first successful high-level language for scientific applications was
FORTRAN
Donald Knuth
Father of Analysis of Algorithms author of The Art of Computer Programming (TAOCP)
Between 1951 and 1953, a team led by _________________ at UNIVAC developed a series of "compiling" systems named A-0, A-1, and A-2 that expanded a pseudo-code into machine code subprograms in the same way as macros are expanded into assembly language.
Grace Hopper
What is the name of the category of programming languages whose structure is dictated by the von Neumann computer architecture?
Imperative Programming Languages
Match each language with its primary designer(s)
Java - James Gosling Objective C - Brad Cox and Tom Love C++ - Bjarne Stroustrup Smalltalk - Alan Kay Prolog - Alain Colmerauer, Philippe Roussel and Robert Kowalski C - Dennis Ritchie Perl - Larry Wall Python - Guido van Rossum Ruby - Yukihiro Matsumoto LISP - Steve Russell, Timothy P Hart and Mike Levin Go - Robert Griesemer, Rob Pike, and Ken Thompson Eiffel - Bertrand Meyer PHP - Rasmus Lerdorf Fortran - John Backus Scheme - Guy L Steele and Gerald Jay Sussman
PHP's array data structure is a combination of what two data structures from other languages?
Javascript and Perl hashes
The first widely-used functional programming language (called [a]) was invented to provide language features for list processing, the need for which grew out of the first applications in the area of [b].
LISP artificial intelligence
Although never implemented, and not even published until 1972, the first high-level language, [a], was developed in Germany between 1936 and 1945 by [b]
Plankalkul, Konrad Zuse
On what branch of mathematics is denotational semantics based?
Recursive Function Theory
What language was the first to fully support object-oriented programming?
Smalltalk
What data structure(s) does Python use in place of arrays?
Tuples, dictionaries, lists
EBNF -> BNF
X=A[E]B -> X=AB|AEB X=E|E' -> X=E, X=E' A=a[B] -> A=aB|a A=a{a}B -> A=aA|B
preprocessor
a program that processes a program immediately before the program is compiled example: #include
With respect to language evaluation criteria, select all language characteristics that affect WRITABILITY
a) orthogonality b) data types c) syntax design d) expressivity e) simplicity f) support for abstraction
With respect to language evaluation criteria, select all language characteristics that affect READABILITY
a) syntax design b) orthogonality c) simplicity d) data types
Select all that are constructed languages
a)loglan b)lojban c)esperanto d)na'vi e)klingon
With respect to language evaluation criteria, select all language characteristics that affect RELIABILITY
a)support for abstraction b)exception handling c)simplicity d)orthogonality e)type checking f)syntax design g)data types h)expressivity i)restricted aliasing
Initial implementations of java were all hybrid. It's intermediate form, called [b], provides portability to any machine that has an interpreter and an associated runtime system.
byte code
what are the three general methods of implementing a programming language?
compilation, pure interpretation, and hybrid implementation
What are the three general methods of implementing a programming language?
compiled hybrid (compiled-interpreted) interpreted
Which one of the following features was NOT a feature of Fortran 77?
dynamic arrays
The execution of a machine code program on a bon Neumann architecture computer occurs in a process called the [f] cycle
fetch-execute
On what branch of mathematics is axiomatic semantics based?
formal logic
inherited vs synthesized attributes
inherited=from parents or sibling synthesized=from child
remove direct left recursion form from: A->Aa|Abc|bc|d
left recursion occurs at Aa and Abc here alpha1=a alpha2=bc beta1=bc beta2=d so, removing left recursion is as follows: A->bcA'|dA' A'->aA'|bcA'|epsilon
A simple trade-off can be made between compilation cost and execution speed of the compiled code. _______________ is the name given to the collection of techniques that compilers may use to decrease the size and/or increase the execution speed of the code they produce.
optimization
With respect to compilation, the syntax analyzer takes the lexical units from the lexical analyzer and uses them to construct hierarchical structures called [p]
parse trees
A [p] is a program that processes a program immediately before the program is compiled
preprocessor
COMPILATIONS
produces a program written in assembly language +very fast program execution -slow translation PHASES: lexical analysis, syntax analysis, semantics analysis, code generation
INTERPRETATION
produces a result from a program +No translation +Easier implementation -slower execution -often requires more space
What characteristic does Ruby share with Smalltalk?
pure object oriented language
Shift reduce parse
stack I/p buffer action $ given input$ what is next step? (ex shift, reduce s->a, reduce L->s, reduce L->L,s) END GOAL: $ s $
The primary limiting factor in the speed of von Neumann architecture computers is called the [v]
von Neumann bottleneck
For what application area is JavaScript most widely used?
web programming
BNF RULES
| means or
5 programming domains
• Scientific Applications • Business Applications • Artificial Intelligence • Systems Programming • Web Software