Presentation is loading. Please wait.

Presentation is loading. Please wait.

Presented by Neng-Fa Zhou1 Evolution of programming languages –Machine language –Assembly language –Sub-routines and loop (Fortran) –Procedures and recursion.

Similar presentations


Presentation on theme: "Presented by Neng-Fa Zhou1 Evolution of programming languages –Machine language –Assembly language –Sub-routines and loop (Fortran) –Procedures and recursion."— Presentation transcript:

1 presented by Neng-Fa Zhou1 Evolution of programming languages –Machine language –Assembly language –Sub-routines and loop (Fortran) –Procedures and recursion (Algol, Pascal, C) –Modules (Modula-2, Ada) –Objects (Simula, Smalltalk, C++,Java) –Declarative programming languages (Prolog, CLP, Lisp, ML, Haskall)

2 presented by Neng-Fa Zhou2 Programming language spectrum 4 Declarative –Logic and constraint-based (Prolog, CLP(FD)) –Functional (Lisp/Scheme, ML, Haskell) –Dataflow (Id, Val) –Template-based (XSLT) –Database (SQL) 4 Imperative –von Neumann (C, Ada, Fortran, Pascal,…) –Scripting (Perl, Python, PHP,…) –Object-oriented (Smalltalk, Effel, C++, Java, C#)

3 presented by Neng-Fa Zhou3 Imperative 4 Features –Variables are mnemonics of memory locations –Assignment statements –goto –Iterative constructs

4 presented by Neng-Fa Zhou4 Object-oriented 4 Features –Abstract data types –Inheritance and overriding –Polymorphism –Dynamic binding

5 presented by Neng-Fa Zhou5 Functional 4 Features –Single assignment variables (no side effects) –Recursion –Rule-based and pattern matching (ML, Haskell) –High-order functions –Lazy evaluation (Haskell) –Meta-programming (Scheme)

6 presented by Neng-Fa Zhou6 Stack in Scheme (define stack_push (lambda (s x) (cons x s))) (define stack_peek (lambda (s) (if (eq? s ()) (raise "empty stack") (car s)))) (define stack_pop (lambda (s) (if (eq? s ()) (raise "empty stack") (cdr s))))

7 presented by Neng-Fa Zhou7 Stack in Haskell stack_push s x = (x:s) stack_peek (x:_) = x stack_pop (_:s) = s

8 presented by Neng-Fa Zhou8 Append in Haskell append :: [a] -> [a] -> [a] append [] ys = ys append (x:xs) ys = x : append xs ys

9 presented by Neng-Fa Zhou9 Stack in SML/NJ fun stack_push s x = (x::s) fun stack_peek (x::s) = x fun stack_pop (_::s) = s

10 presented by Neng-Fa Zhou10 F# let stack_push s x = x :: s let stack_peek s = match s with | x :: _ -> x let stack_pop s = match s with | _ ::s -> s

11 presented by Neng-Fa Zhou11 Logic & constraint-based 4 Features –Logic variables –Recursion –Unification –Backtracking –Meta-programming

12 presented by Neng-Fa Zhou12 Stack in Prolog stack_push(S,X,[X|S]). stack_pop([X|S],X,S).

13 presented by Neng-Fa Zhou13 Append in Prolog append([],Ys,Ys). append([X|Xs],Ys,[X|Zs]):- append(Xs,Ys,Zs).


Download ppt "Presented by Neng-Fa Zhou1 Evolution of programming languages –Machine language –Assembly language –Sub-routines and loop (Fortran) –Procedures and recursion."

Similar presentations


Ads by Google