CSCE 314 Lecture 1
Jump to navigation
Jump to search
« previous | Monday, August 29, 2011 | next »
Programming Languages
Languages for instructing computing devices
Different approaches to describe functions:
- Imperative
- declarative
- functional
Communicate Ideas between humans (human-readable), but unambiguous
Level of Languages
- Lowest level: machine code (0's and 1's)
- Assembly: Giving registers and values names
- C
- Scheme, Java
- Haskell, Prolog
- Natural Languages
- Ruby, Gerkin ;)
History Follows very closely:
- 1940: connect wires to represent 0s and 1s
- 1950: Assemblers, FORTRAN, COBOL, LISP
- 1960: ALGOL, BCPL (B and C followed), SIMULA
- 1970: Prolog, ML
- 1980: C++
- 1990: Haskell, Java
- 2000: D, C#, Spec#, F#, Cω, Scala, Ruby!
- 2020: Intentional Programming?
Defining a Language
Syntax and Semantics:
Syntax
Set of valid programs (usually represented by grammars
<if-statement> ::= if <cond-expression> then <statement> else <statement>
Semantics
The meaning behind the parts of a program:
if-statement ::= if condition then true-statement else false-statement
Language Implementation
Undo the abstraction from source language:
int i;
i = 2;
i = i + 7;
to assembly/byte-code:
0 iconst_2 // put integer 2 on stack 1 istore_1 // store top of stack to location 1 2 iload_1 // read value at location 1 on stack 3 bipush // put value 7 on stack 4 iadd // add 2 stack values and push to stack 5 istore_1 // store at location 1
to machine code:
01110101001000101010101100111010001001101011110100000010110100110000100101110101
Languages could be immediately interpreted at the AST phase, compiled to byte code and run on a virtual machine, or compiled all the way into machine code.