COMP 524: Programming Language Concepts - A Brief History of Modern Computing, Study notes of Programming Languages

COMP 524: Programming Language Concepts. 02: Programming Languages. A Brief History of Modern Computing. Early computers required rewiring.

Typology: Study notes

2022/2023

Uploaded on 05/11/2023

michaelporter
michaelporter 🇺🇸

4.4

(27)

286 documents

1 / 28

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
COMP 524: Programming Language Concepts
Björn B. Brandenburg
The University of North Carolina at Chapel Hill
Based in part on slides and notes by S. Olivier, A. Block, N. Fisher, F. Hernandez-Campos, and D. Stotts.
Programming Languages
An Overview —
Tuesday, January 12, 2010
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c

Partial preview of the text

Download COMP 524: Programming Language Concepts - A Brief History of Modern Computing and more Study notes Programming Languages in PDF only on Docsity!

COMP 524: Programming Language Concepts Björn B. Brandenburg The University of North Carolina at Chapel Hill Based in part on slides and notes by S. Olivier, A. Block, N. Fisher, F. Hernandez-Campos, and D. Stotts.

Programming Languages

— An Overview —

UNC Chapel HillUNC Chapel Hill Brandenburg — Spring 2010

A Brief History of Modern Computing

Early computers required rewiring. ➡ (^) For example, ENIAC (Electronic Numerical Integrator and Computer, 1946) programed with patch cords. ➡ (^) Reprogramming took weeks. ➡ (^) Used to compute artillery tables. 2 Magnetic core memory. Each core is one bit. Source: Wikimedia Commons Credit: H.J. Sommer III, Professor of Mechanical Engineering, Penn State University Von Neumann: stored program computers. ➡ (^) Innovation: program is data. ➡ (^) Program stored in core memory. ➡ (^) Allowed for “rapid” reprogramming. Early programming. ➡ (^) Programmers wrote bare machine code. ➡ (^) Essentially, strings of zeros and ones. ➡ (^) Created with punchcards.

UNC Chapel HillUNC Chapel Hill Brandenburg — Spring 2010 Assembly Code 4 Idea: use the computer to simplify programming! ➡ (^) Possible since programs are data. ➡ (^) Computer transforms human- readable input into machine code. First step: direct mapping. ➡ (^) Use mnemonic abbreviations for instructions. ‣ (^) One abbreviations for each instruction. ‣ (^) Also encode operands. ➡ (^) Computer assembles real program by mapping each line to its machine code equivalent , thus creating a new program. ➡ (^) Assemblers are still in use today.

UNC Chapel HillUNC Chapel Hill Brandenburg — Spring 2010 Assembly Code 5 Idea: use the computer to simplify programming! ➡ (^) Possible since programs are data. ➡ (^) Computer transforms human- readable input into machine code. First step: direct mapping. ➡ (^) Use mnemonic abbreviations for instructions. ‣ (^) One abbreviations for each instruction. ‣ (^) Also encode operands. ➡ (^) Computer assembles real program by mapping each line to its machine code equivalent , thus creating a new program. ➡ (^) Assemblers are still in use today. Machine Code Instructions Operands Example : Intel x86-32 machine code and assembly language of javac program.

UNC Chapel HillUNC Chapel Hill Brandenburg — Spring 2010 High-Level Language

Key properties.
➡ Provides facilities for data and control flow abstraction.
➡ Machine-independent specification.
➡ One high-level statement typically corresponds to many machine
instructions.
➡ Human-friendly syntax.
➡ Programming model / semantics not defined in terms of machine
capabilities.
Translation to machine code.
➡ Checked and translated by compiler.
‣ Alternatively, interpreted (next lecture).
➡ Initially, slower than handwritten assembly code.
➡ Today, compiler-generated code outperforms most human-written
assembly code.

7

UNC Chapel HillUNC Chapel Hill Brandenburg — Spring 2010 Early High-Level Languages FORTRAN ➡ (^) John Backus (IBM), 1954. ➡ (^) Formula Translating System ➡ (^) For numerical computing. ➡ (^) Focus: efficiency. LISP ➡ (^) John McCarthy (MIT), 1958. ➡ (^) List Processor. ➡ (^) For symbolic computing. ➡ (^) Focus: abstraction. 8 ALGOL ➡ (^) John Backus (IBM), Friedrich Bauer (TU Munich), etal. , 1958. ➡ (^) Algorithmic Language ➡ (^) For specification of algorithms. ➡ (^) Focus: clear and elegant design. COBOL ➡ (^) Grace Hopper (US Navy), 1959. ➡ (^) Common Business-Oriented Language. ➡ (^) For data processing in businesses. ➡ (^) Focus: english-like syntax.

UNC Chapel HillUNC Chapel Hill Brandenburg — Spring 2010 Definition What is a Programming Language? ➡ (^) Java? ➡ (^) HTML? ➡ (^) Javascript? ➡ (^) LaTeX? 10 Yes. No. Yes. Yes. A programming language is a formal language that is both ➡ (^) universal (any computable function can be defined) ➡ (^) implementable (on existing hardware platforms). Illustration source: Wikimedia Commons Turing-complete : can simulate any Turing machine. (of course, real hardware has space constraints)

UNC Chapel HillUNC Chapel Hill Brandenburg — Spring 2010 Practical Languages 11 To be of practical interest, a language should also: “Naturally” express algorithms. ➡ (^) With respect to its intended problem domain. ➡ (^) This is often achieved by mimicking existing notation or adopting core concepts (e.g., function definitions, predicates). ➡ (^) In essence, a language must appeal to its intended users to be successful. Be efficiently implementable. ➡ (^) Acceptable definitions of “efficient” vary by problem domain. ➡ (^) For example, in high-performance computing, there is typically noefficient enough .” ➡ (^) In contrast, in work on artificial intelligence, efficiency was often only a secondary concern in the past. Design Tradeoff “do what I mean” “do exactly what I say”

UNC Chapel HillUNC Chapel Hill Brandenburg — Spring 2010 Programming Language Spectrum 13 “do what I mean” “do exactly what I say” Declarative Languages Imperative Languages focus on what the computer should do focus on how the computer should do it Procedural / Von Neumann (Ex: Fortran, Pascal, C) Object-Oriented (Ex: Smalltalk, Eiffel, C++, Java) Functional (Ex: LISP/Scheme, ML, Haskell) Logic and constraint-based (Ex: Prolog) Dataflow (Ex: Id, Val) Scripting (Ex: Shell, TCL, Perl, Python)

Procedural Languagess :

Direct evolution from assembly (and thus how computers work internally): a program is a sequential computation that directly manipulates simple typed data (memory locations); abstraction is achieved by calling subroutines as service providers.

UNC Chapel HillUNC Chapel Hill Brandenburg — Spring 2010 Programming Language Spectrum 14 “do what I mean” “do exactly what I say” Declarative Languages Imperative Languages focus on what the computer should do focus on how the computer should do it Procedural / Von Neumann (Ex: Fortran, Pascal, C) Object-Oriented (Ex: Smalltalk, Eiffel, C++, Java) Functional (Ex: LISP/Scheme, ML, Haskell) Logic and constraint-based (Ex: Prolog) Dataflow (Ex: Id, Val) Scripting (Ex: Shell, TCL, Perl, Python)

Object-Oriented Languages :

Human-inspired model: problems are solved by a team of objects that collaborate by sending messages to each other. Objects represent “ subcontractors ” that do one job (possibly with the help of other “experts”) and encapsulate all related state. The benefit of object-orientation is twofold: that large, complex problems can be decomposed in a “ natural ” way; and message passing can be compiled into efficient procedural code.

UNC Chapel HillUNC Chapel Hill Brandenburg — Spring 2010 Programming Language Spectrum 16 “do what I mean” “do exactly what I say” Declarative Languages Imperative Languages focus on what the computer should do focus on how the computer should do it Procedural / Von Neumann (Ex: Fortran, Pascal, C) Object-Oriented (Ex: Smalltalk, Eiffel, C++, Java) Functional (Ex: LISP/Scheme, ML, Haskell) Logic and constraint-based (Ex: Prolog) Dataflow (Ex: Id, Val) Scripting (Ex: Shell, TCL, Perl, Python)

Logic Languages :

Inspired by propositional logic. Program is defined in terms of facts (the “knowledge base”), rules (implications, “if X then also Y”), and a goal (query, “is Y true?”, “what makes Y true?”). The computer’s job is to construct a proof based on the given axioms (facts + rules).

UNC Chapel HillUNC Chapel Hill Brandenburg — Spring 2010 Programming Language Spectrum 17 “do what I mean” “do exactly what I say” Declarative Languages Imperative Languages focus on what the computer should do focus on how the computer should do it Procedural / Von Neumann (Ex: Fortran, Pascal, C) Object-Oriented (Ex: Smalltalk, Eiffel, C++, Java) Functional (Ex: LISP/Scheme, ML, Haskell) Logic and constraint-based (Ex: Prolog) Dataflow (Ex: Id, Val) Scripting (Ex: Shell, TCL, Perl, Python)

Dataflow Languages :

Similar to gate networks (hardware). Tokens (units of data) are streamed through a network of primitive functional units. “Unix pipes + loops + multiple inputs / outputs.”

UNC Chapel HillUNC Chapel Hill Brandenburg — Spring 2010 Programming Language Spectrum 19 Declarative Languages Imperative Languages focus on what the computer should do focus on how the computer should do it Procedural / Von Neumann (Ex: Fortran, Pascal, C) Object-Oriented (Ex: Smalltalk, Eiffel, C++, Java) Functional (Ex: LISP/Scheme, ML, Haskell) Logic and constraint-based (Ex: Prolog) Dataflow (Ex: Id, Val) Scripting (Ex: Shell, TCL, Perl, Python)

Note: this is a very coarse-grained view.
➡ most real-world languages are not pure (i.e., they mix categories).
➡ there exist many sub-categories (e.g., synchronous reactive FP).

UNC Chapel HillUNC Chapel Hill Brandenburg — Spring 2010 Design Considerations Communicate ideas. ➡ (^) Programs are read more often than written. ➡ (^) Maintenance costs. Exactly specify algorithms. ➡ (^) Succinct and precise. ➡ (^) No ambiguity. Create useful programs. ➡ (^) Development must be economically viable. 20 What are the primary use cases? Readability Writability Expressivity Reliability