![]() |
![]() |
|
home—lectures—recipe—exams—hws—D2L—breeze (snow day; distance)
Three things to consider, in a language:
Families of languages:
What are various languages you've used?
These categories are (a) very blurry; (b) not informative -- not the fundamental building blocks of language-features.
low-level -- understading the language's semantics requires knowledge of the hardware it runs on.
C ("high-level assembly"),
assembly
Procedural: organize code in procedures (like functions/methods, but may have side-effects and not return values)
Ada - lots of safety features (and, requirements)
scripting: easy to work with files, OS calls, manipulate strings and I/O; glue together parts of other large projects
perl, python, javascript, php
ruby -- everything is an object, e.g. 3.plus(4)
javascript -- uses instance-based inheritance, not class-based inheritance
object-oriented: objects; inheritance (allows code re-use and code specialization)
you don't "call a function", you do "message passing" -- give an object a method (that is, request it to do something)
Smalltalk -- first O.O. lang;
Java, C++, C#, Alice -- has some primitive types that are not objects (e.g. int, double, boolean, char)
functional: organize code into pure functions (no side-effects, always *return* value)
(If you give the same function the same inputs later, you MUST get the same answer.)
No mutation -- don't change variables or fields.
higher-order functions: can pass a function as an input, to be (used by) other functions! ...Can create new functions that didn't exist at compile-time.
Tends to have lots of small functions (only a few lines long).
Lisp (1965 -- 2nd oldest language in use, after Fortran);
evolved to Scheme (a streamlined lisp),
scheme evolved into racket (an industrial-strength scheme)
racket, F#
Haskell -- *pure* functional; lazy (and, very very abstract).
Declarative language -- your program gives the defining properties of the solution, but NOT how to find it.
(don't talk about loops, or variables, or updates; talk about *specifying* the result.)
Prolog
SQL, Excel
high-level domain-specific langauge:
Mathematica, MatLab
html, markup:
They are data -- not languages.
Side-effect: making a change that can be seen elsehwere.
Examples: setting global variables; e.g. current-time-of-day; and I/O.
name yr family feature(s)/notables (descendents/related) example
TM, lambda calculus
machine / hardware switches (incl. Babbage's Analytic Engine)
assembly
Lisp; Scheme, ML, Haskel, F#
Fortran; PL/I; Algol;
SmallTalk; C++, java, C#
Ada;
sh, csh, Tcl/Tk, perl, python, ruby
rpn; postscript (printer is the interpreter; req'd M68000, not 8088,6502); pdf
prolog (Japanese "4th wave")
Basic (Apple II ROM; line#s; goto;'gosub' but no params (only globals) (recursion?!)),
http://www.jenutech.com/images/HomeSweetGoto10.gif
http://theinfosphere.org/File:Gotohell.jpg
Pascal (teaching; nested procedures)
language popularity index
poster: programming languages history
The hello world collection
- examples: enscript -o foo.ps (wimpout.ps)
Example: enscript -o foo.ps ; cat foo.ps ; open foo.ps
Example: cat wimpoutBoard.ps ; open wimpoutBoard.ps
also, sh: Example: cd ~/Unix
find . -name \*.ps -print
find . -name \*.ps -print | grep -i wimpout
- other notables:
* postscript
- C, Ada, Fortran, Pascal, Rexx, ...
- Smalltalk, Java, C++, C#, ...
- APL; Mathematica; Matlab
- javascript, perl, etc; html ? -- no; data. But, .css.
- sh/csh, .bat, applescript; scriptable photoshop?
Example: cd ~/Unix
find \*.ps
find \*.ps | grep -i wimpout
Note that we are calling functions. (How are arguments passed?)
- a *programmable* calculator.
* MS Word "macros" and mailing-list scripts
- abacus-instructions ?
Link:
"A new language for phone networks" (declarative; based on F#)
www.technologyreview.com/communications/23330/?a=f
home—lectures—recipe—exams—hws—D2L—breeze (snow day; distance)
| ©2015, Ian Barland, Radford University Last modified 2016.May.16 (Mon) |
Please mail any suggestions (incl. typos, broken links) to ibarland |
![]() |