By Neng-Fa Zhou1 Evolution of programming languages –Machine language –Assembly language –Sub-routines and loop (Fortran) –Procedures and recursion (Algol,

Slides:



Advertisements
Similar presentations
1 Scheme and Functional Programming Aaron Bloomfield CS 415 Fall 2005.
Advertisements

Adapted from Scott, Chapter 6:: Control Flow Programming Language Pragmatics Michael L. Scott.
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Introduction to Programming Languages Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University.
By Neng-Fa Zhou Functional Programming 4 Theoretical foundation –Church’s -calculus expressions and evaluation rules 4 Characteristics –Single assignment.
Chapter 1: Preliminaries
you admittance to the “show”.
PLLab, NTHU Cs2403 Programming Languages Implementation Issues Cs2403 Programming Language Spring 2005 Kun-Yuan Hsieh.
Reasons to study concepts of PL
ISBN Chapter 1 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Motivation Programming Domains.
Introduction to Object-Oriented Programming (OOP)
Programming Languages Structure
ISBN Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.
Presented by Neng-Fa Zhou1 Evolution of programming languages –Machine language –Assembly language –Sub-routines and loop (Fortran) –Procedures and recursion.
Summer 02-03Programming Language Concepts1 Programming Language Concepts (CS 360) Lecture 1: Overview, Grammars, and Little Languages Jeremy R. Johnson.
ISBN Chapter 1 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language.
Copyright © 1998 by Addison Wesley Longman, Inc. 1 Concepts of Programming Languages Chapter 1.
CS 331, Principles of Programming Languages Introduction.
C H A P T E R O N E Overview.
1 Programming Language Concepts Ethics Why study concepts of programming languages (PLs)? PL categories Influences on PL design Problem areas & needs that.
CS 355 – Programming Languages
Chapter 8 High-Level Programming Languages (modified by Erin Chambers)
Programming languages1 Programming paradigms Families of programming languages.
Chapter 1. Introduction.
CS 363 Comparative Programming Languages
ISBN Chapter 2 Evolution of the Major Programming Languages.
Programming Languages –14 David Watt (Glasgow) Steven Wong (Singapore) Moodle : Computing Science → Level 3 → Programming Languages 3 © 2012 David.
1 CSC 533: Organization of Programming Languages Spring 2010 See online syllabus at: Course goals:  understand issues in designing,
1 Programming Language History and Evolution In Text: Chapter 2.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
ICS 313 Fundamentals of Programming Languages Instructor: Abdul Wahid Wali Lecturer, CSSE, UoH
ISBN Chapter 1 Preliminaries. Copyright © 2009 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
CS 345: Programming Language Paradigms Chris Brooks HR 510 MWF 11:00-12:05.
Comparative Programming Languages Language Comparison: Scheme, Smalltalk, Python, Ruby, Perl, Prolog, ML, C++/STL, Java, Haskell.
Programming Languages
CS 331, Principles of Programming Languages Chapter 1.
ISBN Structure of Programming Languages Prof. Dr. Mostafa Abdel Aziem Mostafa Senior Lecturer
Programming Languages
int k = Integer.MAX_VALUE; k++; int k = Integer.MAX_VALUE; k++; What happens when the following code executes? byte b = someFile.readByte(); b = (byte)(b.
1-1 1 Introduction  Programming linguistics: concepts and paradigms syntax, semantics, and pragmatics language processors.  Historical development of.
A Short History of PL's (MacLennan 1999) “Zeroth Generation” (1940's-50's): machine language / assembly: if/then, read/write, store, goto
Programming Language Theory 2014, 1 Chapter 1 :: Introduction Origin : Michael L. Scott School of Computer & Information Engineering,
a medium allowing humans and computers to communicate an abstraction of the real world a notation for expressing algorithms the set of all syntactically.
History. Development Driven by Function Functions of a Programming Language –To describe computation for use by computers –To describe computation and.
Language Paradigms CS655.
CPS120 Introduction to Computer Science High Level Language: Paradigms.
The College of Saint Rose CIS 433 – Programming Languages David Goldschmidt, Ph.D. from Concepts of Programming Languages, 9th edition by Robert W. Sebesta,
Programming Language History and Evolution
Chapter 1. Introduction.
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Programming Languages 2nd edition Tucker and Noonan
Functional Programming
CSC 533: Programming Languages Spring 2016
CSC 533: Programming Languages Spring 2015
Concepts of Programming Languages
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
Why study programming languages?
Basic 1964 PC general purpose Imperative Small Easy to use.
PROGRAMMING LANGUAGES
Programming Language Design Concepts
Programming Language History and Evolution
Evolution of programming languages
Welcome to Programming Languages!
Programming Language Design
FP Foundations, Scheme In Text: Chapter 14.
Overview of Programming Paradigms
Programming Languages and Paradigms
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
School of Computer & Information Engineering,
Presentation transcript:

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)

by Neng-Fa Zhou2 Why are there so many languages 4 Evolution –Procedural  structural  object-oriented 4 New paradigms and applications –Logic languages (Prolog, CLP) for complex data and knowledge processing –Functional languages (Lisp, ML, Haskell) for symbolic computation –Scripting languages (JavaScript, Pearl, Tcl, Python, Ruby, XSLT) for Web-based data processing 4 Personal preferences

by Neng-Fa Zhou3 What makes a language successful 4 Expressiveness 4 Availability of implementations 4 Efficiency 4 Productivity 4 Industrial sponsorships

by Neng-Fa Zhou4 Why study programming languages 4 Understand language features and concepts at a higher level 4 Improve the ability to choose appropriate languages 4 Increase the ability to learn new languages 4 Simulate useful features

by Neng-Fa Zhou5 Why study language implementation 4 Understand how languages are specified and implemented 4 Understand obscure phenomena 4 Write better-style and efficient programs 4 Design and implement domain-specific languages

by Neng-Fa Zhou6 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#)

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

by Neng-Fa Zhou8 Stack in C typedef struct NodeStruct { int val; struct NodeStruct *next; } Node, *NodePtr, *List; typedef struct StackStruct { int size; List elms; } Stack, *StackPtr;

by Neng-Fa Zhou9 Stack in C (Cont.) void stack_push(StackPtr s, int x){ s->size++; lst_add(&s->elms,x); } int stack_pop(StackPtr s){ if (s->size==0){ error("empty stack"); } else { s->size--; return lst_remove(&s->elms); }

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

by Neng-Fa Zhou11 Stack in Java import java.util.LinkedList; class MyStack { private LinkedList elms; public MyStack() { elms = new LinkedList (); } public void push(int x) { elms.addFirst(x); } public int pop() { if (elms.size()==0){ throw new RuntimeException("Empty stack"); } else return elms.removeFirst(); }

Stack in C# by Neng-Fa Zhou12 using System; using System.Collections.Generic; class MyStack { private LinkedList elms; public MyStack() { elms = new LinkedList (); } public void push(int x) { elms.AddFirst(x); } public int pop() { if (elms.Count==0){ throw new System.Exception("stack underflow"); } else { int tmp = elms.First.Value; elms.RemoveFirst(); return tmp; }

by Neng-Fa Zhou13 Stack in C++ class Stack { public: Stack(); void push(int); int pop(); private: list elms; }; Stack::Stack(){ } void Stack::push(int x){ elms.push_front(x); } int Stack::pop(){ assert(!elms.empty()); int x = elms.front(); elms.pop_front(); return x; }

by Neng-Fa Zhou14 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)

by Neng-Fa Zhou15 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))))

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

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

by Neng-Fa Zhou18 F# let stack_push s x = x :: s let stack_peek s = match s with | x :: _ -> x let stack_pop s = match s with | _ ::s1 -> s1

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

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

by Neng-Fa Zhou21 Implementation methods 4 Compilation – Translate high-level program to machine code Slow translation Fast execution 4 Pure interpretation –No translation Slow execution Becoming rare 4 Hybrid implementation systems –Small translation cost –Medium execution speed

by Neng-Fa Zhou22 Review questions 4 Why are there so many programming languages? 4 What makes a programming language successful? 4 Why is it important to study programming languages? 4 Name two languages in each of the following paradigms: procedural, OOP, logic, and functional. 4 What are the features of OOP languages? 4 What are the features of functional languages? 4 What are the features of logic languages?