1 CSC 533: Organization of Programming Languages Spring 2008 See online syllabus at: Course goals:  understand issues in designing,

Slides:



Advertisements
Similar presentations
Computational Models The exam. Models of computation. –The Turing machine. –The Von Neumann machine. –The calculus. –The predicate calculus. Turing.
Advertisements

Adapted from Scott, Chapter 6:: Control Flow Programming Language Pragmatics Michael L. Scott.
Copyright © 1998 by Addison Wesley Longman, Inc. 1 Chapter One Preliminaries, including –Why study PL concepts? –Programming domains –PL evaluation criteria.
CSI 3125, Preliminaries, page 1 Programming languages and the process of programming –Programming means more than coding. –Why study programming languages?
Chapter 1: Preliminaries
PLLab, NTHU Cs2403 Programming Languages Implementation Issues Cs2403 Programming Language Spring 2005 Kun-Yuan Hsieh.
CS 354 Overview. Addison-Wesley –2 Course Topics What is a programming language? What features do programming languages have? How are these features.
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.
ISBN Chapter 1 Preliminaries. Copyright © 2007 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
CS 354 Overview. Copyright © 2007 Addison-Wesley. All rights reserved. 1–2 Course Topics What is a programming language? What features do programming.
CS 330 Programming Languages 09 / 06 / 2007 Instructor: Michael Eckmann.
Programming Languages Structure
ISBN Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.
Summer 02-03Programming Language Concepts1 Programming Language Concepts (CS 360) Lecture 1: Overview, Grammars, and Little Languages Jeremy R. Johnson.
CSE305 Programming Languages Notes are based primarily on Sebesta text. Quotes are from Sebesta text, unless otherwise noted. Sources other than Sebesta.
ISBN Chapter 1 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language.
CSE305 Programming Languages Notes are based primarily on Sebesta text. Quotes are from Sebesta text (7 th edition), unless otherwise noted. Sources other.
Copyright © 1998 by Addison Wesley Longman, Inc. 1 Concepts of Programming Languages Chapter 1.
Programming Language Concepts
1 Programming Languages Marjan Sirjani 2 1- The Study of Programming Languages The purpose of language is simply that it must convey meaning. (Confucius)
Language Evaluation Criteria
C H A P T E R O N E Overview.
Overview. Copyright © 2006 The McGraw-Hill Companies, Inc. Chapter 1 Overview A good programming language is a conceptual universe for thinking about.
CSE 425: Intro to Programming Languages and their Design A Few Key Ideas No particular language is a prerequisite for this course –However you should be.
PZ01A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ01A -- Introduction Programming Language Design and.
MT311 Java Programming and Programming Languages Li Tak Sing ( 李德成 )
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
CS 363 Comparative Programming Languages
CSC3315 (Spring 2009)1 CSC 3315 Programming Languages Hamid Harroud School of Science and Engineering, Akhawayn University
CS 330 Programming Languages 09 / 04 / 2008 Instructor: Michael Eckmann.
Programming Languages Summer
By Neng-Fa Zhou1 Evolution of programming languages –Machine language –Assembly language –Sub-routines and loop (Fortran) –Procedures and recursion (Algol,
1 CSC 533: Organization of Programming Languages Spring 2010 See online syllabus at: Course goals:  understand issues in designing,
1 Programming Languages Marjan Sirjani Course web site:
1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections
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
1 CSC 533: Organization of Programming Languages Spring 2005 See online syllabus at: Course goals:  understand.
ISBN CS 354 Preliminaries. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Course Topics What is a programming language? What features.
ISBN Chapter 1 Preliminaries. Copyright © 2009 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
Programming Domains 1.Scientific Applications Typically, scientific applications have simple data structures but require large numbers of floating-point.
Engr. Isabelo Jun D. Paat, ME-CoE Lecturer 1 Programming Languages.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is.
1-1 1 Introduction  Programming linguistics: concepts and paradigms syntax, semantics, and pragmatics language processors.  Historical development of.
Programming Language Design Issues Programming Languages – Principles and Practice by Kenneth C Louden.
Chapter 1: Preliminaries Lecture # 2. Chapter 1: Preliminaries Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation.
CSCE 343 – Programming Language Concepts Welcome!.
Programming Language Paradigms ITSK2314 Lecture 3.
Programming Languages 2nd edition Tucker and Noonan
Functional Programming
CSC 533: Programming Languages Spring 2016
CSC 533: Programming Languages Spring 2015
Functional Programming Languages
Concepts of Programming Languages
Why study programming languages?
PROGRAMMING LANGUAGES
Chapter 1 Reasons to study concepts of PLs Programming Domains
1.1 Reasons to study concepts of PLs
Chapter 1 Preliminaries.
CS 3304 Comparative Languages Fall 2011
Chapter 1 Preliminary. Chapter 1 Preliminary 1.1 Reasons for Studying Concepts of Programming Languages Increased capacity to express ideas Improved.
Programming Languages 2nd edition Tucker and Noonan
강의 내용 및 방법 접근방법 리포트 시험 Lambda Calculus, Proof of Correctness
Programming Languages, Preliminaries, History & Evolution
Reasons To Study Programming Languages
Presentation transcript:

1 CSC 533: Organization of Programming Languages Spring 2008 See online syllabus at: Course goals:  understand issues in designing, implementing, and evaluating programming languages  appreciate strengths and tradeoffs of different programming paradigms  working knowledge of Java, C/C++ & Scheme

2 in theory, all programming languages are equivalent  compiled/interpreted into basic machine operations  Church-Turing thesis applies Why are there different programming languages? in practice, different languages provide distinct voices  different cultures (application domains)  different primitive concepts (operations)  different ways of thinking about the world (perspectives) Why are there different natural languages?

3 Family tree of high-level languages

4 Programming paradigms similarly, different problem-solving approaches (paradigms) exist and are better suited to different types of tasks imperative approaches: programs specify sequences of state changes block-structured : subroutines & nested scopes (Pascal, C) object-based : interacting objects (Ada, Modula) object-oriented : objects + inheritance (C++, Java, Smalltalk) distributed : concurrency (Occam, Linda) declarative approaches: programs specify what is to be computed functional : functions in lambda calculus (LISP/Scheme, ML) logic : relations in predicate calculus (Prolog) database : info records and relations (SQL)

5 Example: HW1 you are to write a Java program that reads in a maze structure from a file, stores it, and repeatedly prompts the user for a room & path  should then report the room where the player would end up by following the path  file structure? internal structure? I/O? consider a maze of rooms, with each room connected to others by 2 doors  note: doors are not necessarily bidirectional can navigate the maze by making a series of left or right door choices e.g., starting in entry, left-left path: entry  room1  room3 e.g.,starting in room2, left-right path: room2  room4  room2 entry room1 room3 room2 room4exit left right left right leftright left right left right

6 Example: HW1 in LISP/Scheme (define ROOMS '((entry room1 room2) (room1 room3 entry) (room2 room4 entry) (room3 room1 exit) (room4 entry room2) (exit exit exit))) (define (navigate loc path room-map) (cond ((null? path) loc) ((equal? (car path) 'L) (navigate (cadr (assoc loc room-map)) (cdr path) room-map)) ((equal? (car path) 'R) (navigate (caddr (assoc loc room-map)) (cdr path) room-map)) (else 'ILLEGAL-PATH))) for comparison purposes, HW1 is ideal for Scheme  Scheme is a functional programming language  it is symbolic, can represent words and text as easily as numbers  it has primitives for manipulating lists and structures  recursion is natural and efficient can compactly represent the maze as a list can write the basic code in 7 lines (ignoring file I/O)

7 Why study programming languages? increased capacity to express ideas  broader perspective on programming and problem solving, new paradigms improved background for choosing appropriate languages  know tradeoffs between different languages  simplify programming task by choosing best-suited language increased ability to learn new languages  as with natural languages, 2 nd languages is hardest to learn  languages come and go, must be able to adapt/adjust better understanding of the significance of implementation  can use language more intelligently if understand implementation  also aids in identifying bugs increased ability to design/implement new languages

8 How do we judge a programming language? readability in software engineering, maintenance cost/time far exceeds development cost/time  want code to be easy to understand, modify, and maintain  simplicity: language should be as small as possible, avoid redundant features  C++ is pretty complex, e.g., x++; ++x; x +=1; x = x + 1;  Java slightly better (some features removed); Scheme is very simple  orthogonality: small set of primitive constructs, can be combined independently and uniformly (i.e., very few special cases)  C++ is OK but many exceptions, e.g., functions can return structs, not arrays  Java slightly better; Scheme is highly orthogonal  natural control and data structures: provide useful, high-level abstractions  C++ is good but does include some tricky ones, e.g., :?, goto  Java comparable (but no goto ); Scheme is limited (e.g., recursion for looping)  simple and unambiguous syntax: intended form of code is clear to reader  C++ not so good, e.g., overall complexity, dangling else, overused static  Java slightly better; Scheme syntax is simple and clear

9 How do we judge a programming language (cont.)? writability want to make programming as simple as possible for the programmer  simplicity + orthogonality + natural control & data structures + simple & unambiguous syntax  support for abstraction: need to be able to define and utilize abstractions  C++ is good, e.g., support for functions, libraries, classes  Java is comparable; Scheme is OK, but more tedious  expressivity: language provides convenient ways of specifying computations  C++ is good, e.g., if & switch, while & do-while & for, bitwise operators, …  Java is slightly less (removes low-level); Scheme is not very expressive (few control structures) note: readability & writability are often at odds e.g., more control structures can simplify programmer's task, but make code harder to read and maintain (more to know, more redundancy) Common LISP vs. Scheme

10 How do we judge a programming language (cont.)? reliability want to ensure that a program performs to its specifications under all conditions  want to build in strong error checking and recovery capabilities  also want to help the programmer to avoid errors  readability + writability  type checking: identify errors either at compile-time or during execution  C++ is pretty good, e.g., most types checked at compile time, some loopholes  Java is slightly better; Scheme is dynamic, must do checking during execution  exception handling: ability to intercept and recover from errors in code  C++ is OK (try/catch, but not always used)  Java is slightly better (libraries require exception handling), Scheme is more awkward  memory management: control memory accessing, allocation/deallocation, aliasing  C++ is dangerous, e.g., can access specific addresses, must deallocate memory  Java is better (memory mgmt is automatic); Scheme handles all transparently