LECTURE 1. Overview and History

Similar documents
COP4020 Programming Languages. Introduction Prof. Robert van Engelen

The Shift to Multicore Architectures

8/27/17. CS-3304 Introduction. What will you learn? Semester Outline. Websites INTRODUCTION TO PROGRAMMING LANGUAGES

Programming Languages

Why are there so many programming languages? Why do we have programming languages? What is a language for? What makes a language successful?

Early computers (1940s) cost millions of dollars and were programmed in machine language. less error-prone method needed

Programming Languages, Summary CSC419; Odelia Schwartz

Mechanization. A little bit of history. Mechanization. The old dream of mechanical computing. Jordi Cortadella Department of Computer Science

A little bit of history. Jordi Cortadella Department of Computer Science

General Concepts. Abstraction Computational Paradigms Implementation Application Domains Influence on Success Influences on Design

Principles of Programming Languages. Lecture Outline

Concepts in Programming Languages

Outline. Programming Languages 1/16/18 PROGRAMMING LANGUAGE FOUNDATIONS AND HISTORY. Current

Why are there so many programming languages?

CSCI 3136 Principles of Programming Languages

Organization of Programming Languages (CSE452) Why are there so many programming languages? What makes a language successful?

Topic I. Introduction and motivation References: Chapter 1 of Concepts in programming languages by J. C. Mitchell. CUP, 2003.

Introduction to Programming Languages. CSE 307 Principles of Programming Languages Stony Brook University

Concepts of Programming Languages

LECTURE 18. Control Flow

Continuations provide a novel way to suspend and reexecute

Comp 333: Concepts of Programming Languages Fall 2016

Introduction. A. Bellaachia Page: 1

CS 330 Lecture 18. Symbol table. C scope rules. Declarations. Chapter 5 Louden Outline

Low-Level Languages. Computer Programs and Programming Languages

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou

Compilation I. Hwansoo Han

Lecturer: William W.Y. Hsu. Programming Languages

9/5/17. The Design and Implementation of Programming Languages. Compilation. Interpretation. Compilation vs. Interpretation. Hybrid Implementation

Introduction to Scientific Computing Languages

Introduction to Scientific Computing Languages

1/14/2014. Introduction to CSE 1325 Object Oriented Programming (Using Java) Introduction (Cont.) Introduction

Chapter 1. Preliminaries

Programming (ERIM) Lecture 1: Introduction to programming paradigms and typing systems. Tommi Tervonen

CSC 326H1F, Fall Programming Languages. What languages do you know? Instructor: Ali Juma. A survey of counted loops: FORTRAN

! Broaden your language horizons! Different programming languages! Different language features and tradeoffs. ! Study how languages are implemented

Lecture 1: Course Introduction

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End

G Programming Languages - Fall 2012

Programmiersprachen (Programming Languages)

Com S 541. Programming Languages I

Informal Semantics of Data. semantic specification names (identifiers) attributes binding declarations scope rules visibility

Programming Languages 2nd edition Tucker and Noonan"

MIPS Functions and Instruction Formats

CS508-Modern Programming Solved MCQ(S) From Midterm Papers (1 TO 22 Lectures) BY Arslan

Compiling and Interpreting Programming. Overview of Compilers and Interpreters

COMP 201: Principles of Programming

Question No: 1 ( Marks: 1 ) - Please choose one One difference LISP and PROLOG is. AI Puzzle Game All f the given

CS 314 Principles of Programming Languages

CS 110 Computer Architecture MIPS Instruction Formats

COP4020 Programming Languages. Compilers and Interpreters Robert van Engelen & Chris Lacher

CSC 533: Organization of Programming Languages. Spring 2005

Lecture 09. Ada to Software Engineering. Mr. Mubashir Ali Lecturer (Dept. of Computer Science)

Chapter 5. Names, Bindings, and Scopes

Chapter 1. Preliminaries

A Tour of Language Implementation

Principles of Programming Languages

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

Lecture 1: Course Introduction

CSc 372 Comparative Programming Languages

COMPILER DESIGN LECTURE NOTES

COE608: Computer Organization and Architecture

Evolution of Fortran. Presented by: Tauqeer Ahmad. Seminar on Languages for Scientific Computing

Language Translation, History. CS152. Chris Pollett. Sep. 3, 2008.

What Is Computer Science? The Scientific Study of Computation. Expressing or Describing

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012

CS61C : Machine Structures

Compilers. Prerequisites

CS 415 Midterm Exam Spring 2002

PLAGIARISM. Administrivia. Course home page: Introduction to Programming Languages and Compilers

Introduction to Programming Languages and Compilers. CS164 11:00-12:00 MWF 306 Soda

CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro

MIDTERM EXAMINATION - CS130 - Spring 2005

PROGRAMMAZIONE I A.A. 2017/2018

CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro

COS 140: Foundations of Computer Science

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.

Describe the layers of a computer system

CS A331 Programming Language Concepts

CMPT 379 Compilers. Anoop Sarkar.

Chapter 2 Preview. Preview. History of Programming Languages. History of Programming Languages. History of Programming Languages

Design & Implementation Overview

The role of semantic analysis in a compiler

Winter 2003 MID-SESSION TEST Monday, March 10 6:30 to 8:00pm

Chapter 1 Preliminaries

Programs are: CMPSCI 105/119/120: Programming, Flowchar<ng, and Running Program Flowcharts

Lecture 15: Iteration and Recursion

Ordering Within Expressions. Control Flow. Side-effects. Side-effects. Order of Evaluation. Misbehaving Floating-Point Numbers.

Control Flow COMS W4115. Prof. Stephen A. Edwards Fall 2006 Columbia University Department of Computer Science

CS 3304 Comparative Languages. Lecture 1: Introduction

ECE 30 Introduction to Computer Engineering

CS383 PROGRAMMING LANGUAGES. Kenny Q. Zhu Dept. of Computer Science Shanghai Jiao Tong University

CS558 Programming Languages

INFS 214: Introduction to Computing

9/7/17. Outline. Name, Scope and Binding. Names. Introduction. Names (continued) Names (continued) In Text: Chapter 5

Chapter 3:: Names, Scopes, and Bindings (cont.)

CST-402(T): Language Processors

CSc 520 Principles of Programming Languages. 26 : Control Structures Introduction

Memory Usage 0x7fffffff. stack. dynamic data. static data 0x Code Reserved 0x x A software convention

Transcription:

LECTURE 1 Overview and History

COURSE OBJECTIVE Our ultimate objective in this course is to provide you with the knowledge and skills necessary to create a new programming language (at least theoretically). Let s say I asked you to do that right now. You might ask yourself: How can I express the rules of my language? Should it be object-oriented, procedural, or are there better options? How do I create a compiler for the language? Should it even be a compiled language? Semicolons or not?

COURSE TOPICS Language concepts Classification of programming languages. Common language constructs: sequencing, loops, conditions, etc. Names, Scopes, and Bindings: How and when bindings for local names are defined in languages with scoping rules. Control Flow: How programming constructs define control flow and how the choice of constructs can affect programming style. Subroutines and Parameter Passing: How the subroutine calling mechanism is implemented and how and when parameters are passed and evaluated. Exception Handling: How to improve the robustness of programs.

COURSE TOPICS Language implementations Common techniques used in compilers and interpreters. Lexical analysis: Identifying correct words in a program. Syntax analysis: Identifying syntactically correct program structures. Semantics analysis: Identifying meaningful programs. Alternative programming Functional Programming: Programming with Scheme Logic Programming: Programming with Prolog

HISTORY OF PROGRAMMING LANGUAGES 1940s: The first electronic computers were monstrous contraptions Programmed in binary machine code by hand via switches and later by card readers and paper tape readers. Code is not reusable or relocatable. Computation and machine maintenance were difficult: machines had short mean-time to failure (MTTF) because vacuum tubes regularly burned out. The term bug originated from a bug that reportedly roamed around in a machine causing short circuits.

MACHINE LANGUAGE PROGRAMS Many early machines required programs to be expressed in machine language. 55 89 e5 53 83 ec 04 83 Could you tell me what s going on here? Programs written for the ENIAC (1946) were written in the language of the machine itself. A program for adding two numbers essentially outlined instructions for configuring the ENIAC s many large plugboards and switchboards. This is tedious and difficult to create and maintain.

ASSEMBLY LANGUAGE PROGRAMS Assembly Language Programs were developed so that machine operations could be expressed in mnemonic abbreviations. Enables larger, reusable, and relocatable programs. Machine code is produced by assembler, not by programmer. Translation from assembly to machine is pretty much one-to-one. Here is an example punched card for the IBM 709x Assembly Language.

ASSEMBLY LANGUAGE EXAMPLE You ve all seen MIPS before. Here s an example MIPS assembly program to compute GCD. Easier to understand, but it might take you quite a bit of time to tell me what s going on here. addiu sp,sp,-32 sw ra,20(sp) jal getint nop jal getint sw v0,28(sp) lw a0,28(sp) move v1,v0 beq a0,v0,d slt at,v1,a0 A: beq at,zero,b nop b C subu a0,a0,v1 B: subu v1,v1,a0 C: bne a0,v1,a slt at,v1,a0 D: jal putint nop lw ra,20(sp) addiu sp,sp,32 jr ra move v0,zero

ASSEMBLY LANGUAGE EXAMPLE Example MIPS R4000 machine code of the assembly program: 27bdffd0 afbf0014 0c1002a8 00000000 0c1002a8 afa2001c 8fa4001c 00401825 10820008 0064082a 10200003 00000000 10000002 00832023 00641823 1483fffa 0064082a 0c1002b2 00000000 8fbf0014 27bd0020 03e00008 00001025

HIGH-LEVEL PROGRAMMING LANGUAGES Mid 1950 s: Development of FORTRAN (FORmula TRANslator), the first higher-level programming language. Mainly developed for solving numerical problems. Other high-level languages soon followed. Algol-58, COBOL, Lisp, BASIC, C Important result: programming is now a machine-independent task. High-level Source Code Intermediate Representation Machine Code

FORTRAN 77 FORTRAN is still widely used for scientific, engineering, and numerical problems. FORTRAN 77 includes: Subroutines, if-then-else, do-loops. Types (primitive and arrays). Variable names are upper case and limited to 6 chars. No recursion. No structs/classes, unions. No dynamic allocation. No case-statements and no while-loops. PROGRAM GCD C variable names that start with C I,J,K,L,N,M are integers C read the parameters READ (*, *) I, J C loop while I!=J 10 IF I.NE. J THEN IF I.GT. J THEN I = I - J ELSE J = J - I ENDIF GOTO 10 ENDIF C write result WRITE (*, *) GCD =, I END

GENEALOGY OF PROGRAMMING LANGUAGES

PROGRAMMING LANGUAGES Until now, you ve likely only seen C++, C, and perhaps Java. Some of you may have experience with Python, PHP, JavaScript, etc. There are A LOT of languages out there some of them are undoubtedly completely different than anything you ve seen before.

WHY ARE THERE SO MANY PROGRAMMING LANGUAGES? Evolution Design considerations: What is a good or bad programming construct? Early 70s: structured programming, in which goto-based control flow was replaced by highlevel constructs (e.g. while loops and case statements). Late 80s: nested block structure gave way to object-oriented structures.

WHY ARE THERE SO MANY PROGRAMMING LANGUAGES? Special Purposes Many languages were designed for a specific problem domain, e.g: Scientific applications Business applications Artificial intelligence Systems programming Internet programming Personal Preference The strength and variety of personal preference makes it unlikely that anyone will ever develop a universally accepted programming language.

WHAT MAKES A PROGRAMMING LANGUAGE SUCCESSFUL? Expressive Power Theoretically, all languages are equally powerful (Turing complete). Language features have a huge impact on the programmer's ability to read, write, maintain, and analyze programs. Ease of Use for Novice Low learning curve and often interpreted, e.g. Basic and Logo. Ease of Implementation Runs on virtually everything, e.g. Basic, Pascal, and Java.

WHAT MAKES A PROGRAMMING LANGUAGE SUCCESSFUL? Open Source Freely available, e.g. Java. Excellent Compilers and Tools Supporting tools to help the programmer manage very large projects. Economics, Patronage, and Inertia Powerful sponsor: Cobol, PL/I, Ada. Some languages remain widely used long after "better" alternatives.

CLASSIFICATION OF PROGRAMMING LANGUAGES

CLASSIFICATION OF PROGRAMMING LANGUAGES Declarative: Implicit solution. What should the computer do? Functional Lisp, Scheme, ML, Haskell Logic Prolog Dataflow Simulink, Scala Imperative: Explicit solution. How should the computer do it? Procedural Fortran, C Object-Oriented Smalltalk, C++, Java Note that these classifications aren t entirely rigid. Languages can have multiple classifications.

CONTRASTING EXAMPLES Procedural (C): int gcd(int a, int b) { while (a!= b) if (a > b) a = a-b; else b = b-a; return a; } Functional (Haskell): gcd a b a == b = a a > b = gcd (a-b) b a < b = gcd a (b-a) Logical (Prolog): gcd(a, A, A). gcd(a, B, G) :- A > B, N is A-B, gcd(n, B, G). gcd(a, B, G) :- A < B, N is B-A, gcd(a, N, G).

NEXT LECTURE We will start our course by discussing compilation and interpretation. Compilation and interpretation. Virtual machines. Static linking and dynamic linking. Compiler in action (g++). Integrated development environments.