organization of Programming Languages Exam I
Haskell
-Similar to ML except for three differences: 1. functions can be overloaded 2. nonstrict semantics are used 3. is a pure functional programming language
constructed languages
-Sociological/Political: Esperanto, Toki Pona, Interlingua, Gestuno (sign) -Fiction: Klingon, Quenya, Sindarin, Na'vi -Research: LOGLAN, Lojban, Lojban++ -ASL, LSF, DSL
Scripting Languages
-A list of commands to be executed -UNIX
What was not a feature of Fortran 77?
dynamic arrays
Data-oriented software development
-(Late 80's - present) -object-oriented design: data abstraction + inheritance + polymorphism
Hybrid Implementation Systems
-A compromise between compilers and pure interpreters -A high-level language program is translated to an intermediate language that allows easy interpretation -Faster than pure interpretation -Examples: 1. Perl programs are partially compiled to detect errors before interpretation 2.Initial implementations of Java were hybrid; the intermediate form, byte code, provides portability to any machine that has a byte code interpreter and a run-time system — together, these are called Java Virtual Machine (JVM). Use: Small and medium systems when efficiency is not the first concern
Language generators
-A device that generates sentences of a language -One can determine if the syntax of a particular sentence is syntactically correct by comparing it to the structure of the generator Example: Context-Free Grammar
Python
-An OO interpreted scripting language -Type checked but dynamically typed -Used for CGI programming and form processing -Supports lists, tuples, and hashes
Fortran 77
-Became the new standard in 1978 -Character string handling -Logical loop control statement -IF-THEN-ELSE statement
Imperative
-Central features are variables, assignment statements, and iteration -Include languages that support object-oriented programming (OOP) -Includes scripting languages -Includes the visual languages -Language examples: C, C++, C#, Objective-C, Java, Perl, Python, Ruby, JavaScript, Visual BASIC .NET
c++
-Combining Imperative and Object-Oriented Programming -Developed at Bell Labs by Stroustrup in 1980 -Evolved from C and SIMULA 67 -Facilities for object-oriented programming, taken partially from SIMULA 67 -A large and complex language, in part because it supports both procedural and OO programming -Rapidly grew in popularity, along with OOP -ANSI standard approved in November 1997 -Microsoft's version: MC++: Properties, delegates, interfaces, no multiple inheritance
SNOBOL
-Designed as a string manipulation language at Bell Labs by Farber, Griswold, and Polensky in 1964 -Powerful operators for string pattern matching -Slower than alternative languages (and thus no longer used for writing editors) -Still used for certain text processing tasks -Characterized by dynamic typing and dynamic storage allocation -Variables are untyped -A variable acquires a type when it is assigned a value -Storage is allocated to a variable when it is assigned a value
C
-Designed for systems programming (at Bell Labs by Dennis Richie) -Evolved primarily from BCLP and B, but also ALGOL 68 -Powerful set of operators, but poor type checking -Initially spread through UNIX -Though designed as a systems language, it has been used in many application areas
Plankalkul
-Designed in 1945, but not published until 1972 (Konrad Zuse) -Never implemented -Advanced data structures: floating point, arrays, records (aka structs) -Invariants: a function, quantity, or property which remains unchanged when a specified transformation is applied
Ruby
-Designed in Japan by Yukihiro Matsumoto (a.k.a, "Matz") -Began as a replacement for Perl and Python -A pure object-oriented scripting language: All data are objects -Most operators are implemented as methods, which can be redefined by user code -Purely interpreted
Scheme
-Developed at MIT in mid 1970s -Small -Extensive use of static scoping -Functions as first-class entities -Simple syntax (and small size) make it ideal for educational applications
Smalltalk
-Developed at Xerox PARC, initially by Alan Kay, later by Adele Goldberg -First full implementation of an object-oriented language (data abstraction, inheritance, and dynamic binding) • -Pioneered the graphical user interface design -Promoted OOP
Context-Free Grammars
-Developed by Noam Chomsky in the mid-1950s -Language generators, meant to describe the syntax of natural languages -Define a class of languages called context-free languages
Pascal
-Developed by Wirth (a former member of the ALGOL 68 committee) -Designed for teaching structured programming -Small, simple, nothing really new -Largest impact was on teaching programming: from mid-1970s until the late 1990s, it was the most widely used language for teaching programming
Prolog
-Developed, by Comerauer and Roussel (University of AixMarseille), with help from Kowalski ( University of Edinburgh) -Based on formal logic • Non-procedural -Can be summarized as being an intelligent database system that uses an inferencing process to infer the truth of given queries -Comparatively inefficient -Few application areas
Markup/programming hybrid
-Markup languages extended to support some other programming -Examples: JSTL, XML, XSLT, JSON, SQL, HTML -Many are more accurately labeled as Protocols, not full (i.e. Turing Complete) Languages
java
-Eliminated many unsafe features of C++ -Supports concurrency -Libraries for applets, GUIs, database access -Portable: Java Virtual Machine concept, JIT compilers -Widely used for Web programming -Use increased faster than any previous language
IBM 704 and Fortran
-Fortran 0: never implemented -Fortan I -Fortran II -Fortran IV -Fortran 77 -Fortran 90 -Highly optimizing compilers (all versions before 90): -Types and storage of all variables are fixed before run time -Dramatically changed forever the way computers are used
Ada
-Huge design effort, involving hundreds of people, much money, and about eight years -Contributions: a. Packages - support for data abstraction b. Exception handling - elaborate c. Generic program units d. Concurrency - through the tasking model -Competitive design -Included all that was then known about software engineering and language design -First compilers were very difficult; the first really usable compiler came nearly five years after the language design was completed
Education
-Languages Designed Just To Facilitate Teaching -Pascal, BASIC, Logo
Scientific Applications
-Large numbers of floating point computations; use of arrays -Fortran
structured programming
-Late 1960s: People efficiency became important; readability, better control structures -top-down design and step-wise refinement
Procedure-oriented programming
-Late 70's - early 80's -data abstraction
Functional
-Main means of making computations is by applying functions to given parameters -Functions are "first class citizens" -"Variables", functions, and names -Lambda calculus -Language examples: LISP, Haskell, Racket (PLT Scheme), Clojure, Scala, ML, F#
Systems programming
-Need efficiency because of continuous use -C
Parallel Programming
-Parallel And Distributed Systems -Ada
Business applications
-Produce reports, use decimal numbers and characters -COBOL
Pure Interpretation
-Programs are interpreted by another program known as an interpreter No translation -Easier implementation of programs (run-time errors can easily and immediately be displayed) -Slower execution (10 to 100 times slower than compiled programs) -Often requires more space (memory) -Now rare for traditional high-level languages -Significant comeback with some Web scripting languages (e.g., JavaScript, PHP) -Use: Small programs or when efficiency is not an issue
Logic
-Rule-based (rules are usually specified in no particular order) -Formal logic system: 1. First order logic 2. Second order logic 3. Description Logic -Language examples: Prolog, Answer Set Programming (ASP), Datalog
Other Domains
-Scripting Languages -Parallel Programming -Education
Perl
-Scripting language -Designed by Larry Wall—first released in 1987 -Variables are statically typed but implicitly declared -Three distinctive namespaces, denoted by the first character of a variable's name -Powerful, but somewhat dangerous -Gained widespread use for CGI programming on the Web -Also used for a replacement for UNIX system administration language
short code
-Short Code developed by Mauchly in 1949 for BINAC computers -Expressions were coded, left to right
Artificial intelligence
-Symbols rather than numbers manipulated; use of linked lists -LISP
Quantum
-Uses a single memory, not separate RAM (volatile) and Disk (non-volatile) -Memory in qubits that have both 1 and 0 values simultaneously -Instruction set is very different from von Neumann architecture: -Quil, OpenQASM -Language examples: 1. Imperative-like: QCL, Q#, Q Language, qGCL 2. Functional-like: QFC, QPL, QML
Speedcoding
-developed by Backus in 1954 for IBM 701 -Pseudo ops for arithmetic and math functions -Conditional and unconditional branching -Auto-increment registers for array access -Slow! -Only 700 words left for user program
What data structure(s) does Python use in place of arrays?
-tuples, lists, dictionaries
Implementation Methods
1. Compilation 2. Pure Interpretation 3. Hybrid Implementation Systems
Reasons for Studying Concepts of Programming Languages
1. Increased capacity to express ideas. 2. Improved background for choosing appropriate languages. 3. Increased ability to learn new languages. 4. Better understanding of the significance of implementation. 5. Better use of languages that are already known. 6. Overall advancement of computing.
Sort this list of Functional Programming Languages by the order of the year of their appearance/release.: LISP, Scala, Clojure, Haskell, ML, Common LISP, Scheme, Miranda
1. LISP 2. Scheme 3. ML 4. Miranda 5. Common LISP 6. Haskell 7. Scala 8. Clojure
PHP's array data structure is a combination of what two data structures from other languages?
1. Perl hashes 2. Javascript arrays
Language Design Trade-Offs
1. Reliability vs. cost of execution 2. Readability vs. writability 3. Writability (flexibility) vs. reliability
programming domains
1. Scientific Applications 2. Business Applications 3. Artificial Intelligence 4. Systems Programming 5. Web Software
meta-language
A language used to describe another language. EX: bnf
Language recognizers
A recognition device reads input strings over the alphabet of the language and decides whether the input strings belong to the language -Example: syntax analysis part of a compiler
In what language is most of UNIX written?
C
The first successful high-level language for business was
COBOL
COBOL
Computerizing Business Records -Based on FLOW-MATIC -FLOW-MATIC features: Names up to 12 characters, with embedded hyphens -English names for arithmetic operators (no arithmetic expressions) -Data and code were completely separate -The first word in every statement was a verb COBOL contributions: -First macro facility in a high-level language -Hierarchical data structures (records) -Nested selection statements -Long names (up to 30 characters), with hyphens -Separate data division First language required by DoD (department of defense)
Fortran I
Designed for the new IBM 704, which had index registers and floating point hardware: -This led to the idea of compiled programming languages, because there was no place to hide the cost of interpretation (no floating-point software) Environment of development: -Computers were small and unreliable -Applications were scientific -No programming methodology or tools -Machine efficiency was the most important concern Impact of environment on design of Fortran I: -No need for dynamic storage -Need good array handling and counting loops -No string handling, decimal arithmetic, or powerful input/output (for business software) -No separate compilation
Fortran II
Distributed in 1958 -Independent compilation -Fixed the bugs from Fortran I
Web Software
Eclectic collection of languages: markup (e.g., HTML), scripting (e.g., PHP), general-purpose (e.g., Java)
Fortran IV
Evolved during 1960-62 -Explicit type declarations -Logical selection statement -Subprogram names could be parameters -ANSI standard in 1966
Readability vs. writability
Example: APL provides many powerful operators (and a large number of new symbols), allowing complex computations to be written in a compact program but at the cost of poor readability
Writability (flexibility) vs. reliability
Example: C++ pointers are powerful and very flexible but are unreliable
Reliability vs. cost of execution
Example: Java demands all references to array elements be checked for proper indexing, which leads to increased execution costs
The first successful high-level language for scientific applications was
Fortran
pure functional language
Haskell
Between 1951 and 1953, a team led by [a] 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.
Hopper
What is the name of the category of programming languages whose structure is dictated by the von Neumann computer architecture?
Imperative Programming Languages
Johh Backus
Invented Backus-Naur Form to describe the syntax of Algol 58 -developed Speedcoding in 1954 for IBM 701 -Created Fortran
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].
a. 704 b. Fortran
Match each language with its primary designer(s)
a. Java: James Gosling b. Objective-C: Brad Cox and Tom Love c. c++: Bjarne Stroustrup d. Smalltalk: Alan Kay e. Prolog: Alain Colmerauer, Phillippe Roussel, and Robert Kowalski f. C: Dennis Ritchie g. Perl: Larry Wall h. Python: Guido van Rossum i. Ruby: Yukihiro Matsumoto j. LISP: Steve Russell, Timothy P. Hart, and Mike Levin k. Go: Robert Griesemer, Rob Pike, and Ken Thompson l. Eiffel: Bertrand Meyer m. PHP: Rasmus Lerdorf n. Fortran: John Backus o. Scheme: Guy L. Steele and Gerald Jay Sussman
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].
a. LISP b. artificial intelligence
Although never implemented, and not even published until 1972, the first high-level language, [a], was developed in Germnay between 1936 and 1945 by [b]
a. Plankalkül b. Konrad Zuse
Initial implementations of Java were all hybrid. Its intermediate form, called [b], provides portability to any machine that has an interpreter and an associated runtime system.
byte code
token
category of lexemes (e.g., "identifier")
language
characterized by the set of all valid statements (i.e. strings) in that language. The cardinality of this set is potentially infinite
John vonNeuman
created von Neumann architecture
Charles Babbage
designed a theoretical hardware platform called the Analytical Engine in 1842 -general purpose computer
The execution of a machine code program on a von Neumann architecture computer occurs in a process called the [f] cycle.
fetch-execute
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 tree
A [p] is a program that processes a program immediately before the program is compiled.
preprocessor
What characteristic does Ruby share with Smalltalk?
pure object oriented language
portability
the ease with which programs can be moved from one implementation to another
lexeme
the lowest level syntactic unit of a language (e.g., *, sum, begin)
The primary limiting factor in the speed of von Neumann architecture computers is called the [v]
von Neumann bottleneck
Ada Lovelace
wrote the very first program was written in 1843. designed to execute on the Analytical Engine
Donald Knuth
Involved with LR parser -father of algorithms
Language Categories
- Imperative - Functional - Logic - Quantum - Markup/programming Hybrid
What two programming language deficiencies were discovered as a result of the research in software development in the 1970s?
(a) incompleteness of type checking (b) inadequacy of control statements (requiring the extensive use of gotos).
LISP
LISt Processing language: Designed at MIT by McCarthy -AI research needed a language to: a. Process data in linked lists (rather than arrays) b. Symbolic computation (rather than numeric) -Only two data types: atoms and lists -Syntax is based on lambda calculus Pioneered functional programming: a. No need for variables or assignment b. Control via recursion and conditional expressions -Still the dominant language for AI -COMMON LISP and Scheme are contemporary dialects of LISP -ML, Haskell, and F# are also functional programming languages, but use very different syntax
von Neumann architecture
Most of the popular languages of the past 50 years have been designed around the prevalent computer architecture, called the von Neumann architecture, after one of its originators, John von Neumann. These languages are called imperative languages. -fetch-execute cycle
Fortran 90
Most significant changes from Fortran 77: -Modules -Dynamic arrays -Pointers -Recursion -CASE statement -Parameter type checking
What 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
Pure OOP langauges
Python, Ruby, Scala, Smalltalk, Eiffel
What language was the first to fully support object-oriented programming? (pure oop)
Smalltalk
Related Systems
The UNIVAC Compiling System: -Developed by a team led by Grace Hopper -Pseudocode expanded into machine code David J. Wheeler (Cambridge University): -developed a method of using blocks of re-locatable addresses to solve the problem of absolute addressing
Generality
The applicability to a wide range of applications
Well-definedness
The completeness and precision of the language's official definition
Compilation
Translate high-level program (source language) into machine code (machine language); includes JIT systems -Slow translation, fast execution -Compilation process has several phases: 1. Lexical analysis: converts characters in the source program into lexical units 2. syntax analysis: transforms lexical units into parse trees which represent the syntactic structure of program 3. Semantics analysis: generate intermediate code 4. Code generation: machine code is generated -Use: Large commercial applications
"Pseudocode"
Types: 1. short code 2. Speedcoding 3. Related Systems
For what application area is JavaScript most widely used?
Web Programming
Grammar
a formal description of a Language. It must a have a finite set of rules. grammars can be formally utilized in two distinct ways: for recognition and for generation
Syntax
a formal method to describe how to determine a statement's set membership in a Language