COMP313A Programming Languages More Overview. Language Implementation Language definition –syntax, semantics Language translation.

Slides:



Advertisements
Similar presentations
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Advertisements

Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Introduction to Programming Languages Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University.
CSI 3125, Preliminaries, page 1 Programming languages and the process of programming –Programming means more than coding. –Why study programming languages?
Louden, Chapter 21 Chapter 2 - History Programming Languages: Principles and Practice, 2nd Ed.
Louden, Chapter 2/Scott, Chapter 11 Chapter 2 - History.
Chapter Chapter Goals Describe the layers of a computer system Describe the concept of abstraction and its relationship to computing Describe.
Louden, Chapter 21 Chapter 2 - History Programming Languages: Principles and Practice, 2nd Ed.
1 ) Definition 2) Note on structured and modular programming, and information hiding 3) Example imperative languages 4) Features of imperative languages.
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.
Programming Languages Structure
ISBN Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.
ISBN Chapter 1 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language.
COBOL COmmon Business Oriented Language  Work began in 1959 and has never stopped.
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)
CS 415: Programming Languages Chapter 1 Aaron Bloomfield Fall 2005.
Introduction to High-Level Language Programming
Language Evaluation Criteria
PROGRAMMING LANGUAGES The Study of Programming Languages.
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.
High-Level Programming Languages: C++
1Object-Oriented Program Development Using C++ Computer Science and Programming Languages Computers are ubiquitous Computer literacy is essential Computer.
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
CS 363 Comparative Programming Languages
Gary MarsdenSlide 1University of Cape Town Principles of programming language design Gary Marsden Semester 2 – 2001.
Introduction of C++ language. C++ Predecessors Early high level languages or programming languages were written to address a particular kind of computing.
CS 403 Programming Language Theory Class 2 - August 29, 2000.
1 Programming Languages Marjan Sirjani Course web site:
1 Programming Language History and Evolution In Text: Chapter 2.
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.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Chapter 1 Introduction.
Chapter 6 Programming Languages (1) Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Programming Language 1. Programming language A programming language is a machine-readable artificial language designed to express computations that can.
Programming Domains 1.Scientific Applications Typically, scientific applications have simple data structures but require large numbers of floating-point.
The Evolution of Programming Languages Day 2 Lecturer: Xiao Jia The Evolution of PLs1.
Structured Programming
Theory of Programming Languages Introduction. What is a Programming Language? John von Neumann (1940’s) –Stored program concept –CPU actions determined.
Chapter 3 - Language Design Principles
Logical and Functional Programming
Engr. Isabelo Jun D. Paat, ME-CoE Lecturer 1 Programming Languages.
IBM-Mainframes COBOL Class-1. Background and History  COBOL is an acronym for: Common Business Oriented Language  COBOL was developed in 1959 by the.
Agenda Computer Languages How to Write a Simple C Program
FORTRAN History. FORTRAN - Interesting Facts n FORTRAN is the oldest Language actively in use today. n FORTRAN is still used for new software development.
Programming Languages
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is.
The Hashemite University Computer Engineering Department
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.
Programming Language Paradigms ITSK2314 Lecture 3.
History. Development Driven by Function Functions of a Programming Language –To describe computation for use by computers –To describe computation and.
Programming Language History and Evolution
Programming Languages 2nd edition Tucker and Noonan
Zuse’s Plankalkül – 1945 Never implemented Problems Zuse Solved
CSCI-235 Micro-Computer Applications
Structured Programming
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
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
Introduction to Computer Programming
Von Neumann Architecture
강의 내용 및 방법 접근방법 리포트 시험 Lambda Calculus, Proof of Correctness
Programming Languages, Preliminaries, History & Evolution
Presentation transcript:

COMP313A Programming Languages More Overview

Language Implementation Language definition –syntax, semantics Language translation

Programming Language Design Issues

Programming Language Generations First Generation: Assembly language Second Generation: Unstructured high-level Languages e.g. Fortran Third Generation: Structured high-level languages e.g. Pascal, C, C++, Ada Fourth Generation: Application-specific languages for building database-oriented systems Fifth Generation: Very high-level languages, especially logic programming languages and other declarative languages. e.g. Prolog

Imperative versus Declarative Languages Imperative programming –Comprises a sequence of commands imperatives Declarative programming –Declare what results we want and leave the programming language to figure out how to produce them Declarative = “What” Imperative = “How”

Computational Paradigms Imperative/procedural Object-oriented Functional Logic

What Makes a Good language? Page 57 Louden Human criteria –Learnability: Is language easy to learn and remember –Writable: Easy to write correct programs –Readable: Easy to understand programs –Maintainable: Easy to change programs

What Makes a Good Language… Computer Criteria –Implementable: Can language be implemented –Efficient: Are programs translated and executed fast enough –Portable: Is language available on most computers?

Learnability Simplicity. –Simple syntax and semantics. Familiarity. –Should use standard notations whenever possible. Uniformity. –Language constructs that are similar should look and behave similarly. –Constructs that are different should look different. Design goals for making languages easier to learn and remember:

Learnability… Orthogonality –Language constructs can be combined in any meaningful way and should not interact in unexpected ways. Generality –Have one general construct rather than several specific ones. Avoid restricting the ways constructs can be used. Preciseness –Is the language precisely defined? –ANSI/ISO. –Does it have a formal semantics? Validation suites?

Writability Expressiveness –Allows programs to be written in the most natural way. E.g. Build up high-level abstractions Error prevention –Language makes some kinds of errors impossible Error Detection –Language allows errors to be found and reported. E.g. array bounds checking, arithmetic overflow Language design goals for writability include:

Readability/Understandability Expressiveness –Can also improve readability if the programmer has used it wisely Document support –Essential for understanding large programs Language Environment –e.g. browsers, cross-reference tools, pretty printers, debuggers Most of the learnability design goals help readabilty:

Maintainability Machine Independence –Ban or isolate machine-specific features Modularity –Good modularity constructs allow one part of a program to be changed without impacting other parts In addition to the readability and writability design goals, design goals that improve readability include:

History of Programming Languages

Jacquard Loom (Early 1800’s) Machines for weaving cloth Weaving pattern was programmed by cards / paper tape

Babbage’s Analytical Engine Mechanical digital computer (cogs, levers…) Programmed by a sequence of data and operation cards Never fully built, but some programs were written by Ada Lovelace (first programmer)

1940’s: Languages without Machines Lambda Calculus by Alonzo Church (1941) –The basis for functional programming languages Konrad Zuse, a German engineer working alone while hiding out in the Bavarian Alps, develops Plankalkul (1945) War Computers/Calculators: Colossus, ENIAC

1950’s: first Implemented HLLs Early 1950’s: First few stored program computers working. –Mark 1, EDSAC, ACE, EDVAC, UNIVAC 1 Small memory machines Programmed in machine code The good old days!!

Grace Mary Hopper Programmer on Mark I, Mark II, and Mark III computers and UNIVAC I, the first large-scale electronic digital computer 1949 began work on first compiler A-0 –Translated symbolic mathematical code into machine code Then came B-0, later called FLOW-MATIC. –automatic billing and payroll calculation Technical advisor to CODASYL responsible for COBOL (1959)

Grace Hopper… It's easier to ask forgiveness than it is to get permission A ship in port is safe, but that is not what ships are for. Sail out to sea and do new things the most damaging phrase in the language is ‘We've always done it this way’

FORTRAN ( ) IBM “FORmula TRANslating system” for IBM 704 computer Major emphasis on compiler producing efficient code Became the major scientific/engineering programming language Much evolution: FORTRAN II, FORTRAN IV, FORTRAN 66, FORTRAN77, FORTRAN90

Overview of FORTRAN IV Column 1 used to indicate comment lines Column 2-5 used for line numbers (optional) Data: integer, real, arrays (no chars, records or pointers!) Variable declararions are optional (variables starting with I..N are integer, others are real)

Overview of FORTRAN IV… Has a three-way if test, goto statements and computed gotos, but no recursion EQUIVALENCE declaration causes variables to be aliased (dangerous!)

COBOL ( ) Common Business-Oriented Language Developed in 1959 by a group of computer professionals called the Conference on Data Systems Languages (CODASYL). COBOL was the first programming language whose use was mandated by the US Department of Defense

COBOL… English – like verbose syntax (Goal: Human readability) Largely ignored by the academic community And if you thought COBOL was dead… Think again.. Object-oriented COBOL is a subset of COBOL 97, which is the fourth edition in the continuing evolution of ANSI/ISO standard COBOL

IDENTIFICATION DIVISION PROGRAM-ID. HELLOWORLD * ENVIRONMENT DIVISION CONFIGURATION SECTION SOURCE-COMPUTER. RM-COBOL OBJECT-COMPUTER. RM-COBOL DATA DIVISION FILE SECTION PROCEDURE DIVISION MAIN-LOGIC SECTION BEGIN DISPLAY " " LINE 1 POSITION 1 ERASE EOS DISPLAY "Hello world!" LINE 15 POSITION STOP RUN MAIN-LOGIC-EXIT EXIT.

ALGOL 60 ( ) ALGOrithmic Language: general expressive language for describing algorithms Used widely in Europe and academia in USA Modern syntax: defined using BNF, free format, structure statements, with begin/end pairs Type declarations required for all variables

ALGOL60… Introduced recursion, call-by-name and call-by-value Required stack-based runtime environment Huge influence on later languages: Pascal, C, Module-2, Ada etc

Call-by-name Page 321 Louden The argument is not evaluated until its actual use (as a parameter) in the called procedure The name of the argument replaces the name of the parameter it corresponds to

Call-by-name void inc(int x) {x++} inc(a[5]); inc(a[i]);

Call-by-name int i; int a[10]; void inc(int x) { i++; x++; } main() { i = 1; a[1] = 1 a[2] = 2; p(a[i]); return(0); }

LISP ( ) The first functional language The first language to include garbage collection Intended for list processing and symbolic manipulation Syntax was radically different – lots of parentheses Efficiency not a huge concern. Ideas more important Still heavily used today for AI research and applications IDE

Reverse a list (Defun reverse (x) (cond ((null x) NIL) (T (append (reverse (rest start)) (list (first start))))))