CS 415: Programming Languages Chapter 1 Aaron Bloomfield Fall 2005.

Slides:



Advertisements
Similar presentations
Programming Domains Scientific Applications
Advertisements

1 Scheme and Functional Programming Aaron Bloomfield CS 415 Fall 2005.
Gerardo Schneider Department of Informatics University of Oslo December 2008.
Reasons to study concepts of PL
Programming Languages Structure
ISBN Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.
Introduction and Syntax. Course objectives Discuss features of programming languages. Discuss how the features are implemented in a simple computer architecture.
Summer 02-03Programming Language Concepts1 Programming Language Concepts (CS 360) Lecture 1: Overview, Grammars, and Little Languages Jeremy R. Johnson.
CS 104 Introduction to Computer Science and Graphics Problems Software and Programming Language (2) Programming Languages 09/26/2008 Yang Song (Prepared.
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)
History of Programming Languages
BIT Presentation 6. Contents GENERATIONS OF LANGUAGES COMPILERS AND INTERPRETERS VIRTUAL MACHINES OBJECT-ORIENTED PROGRAMMING SCRIPTING LANGUAGES.
Overview. Copyright © 2006 The McGraw-Hill Companies, Inc. Chapter 1 Overview A good programming language is a conceptual universe for thinking about.
1 Programming Language Concepts Ethics Why study concepts of programming languages (PLs)? PL categories Influences on PL design Problem areas & needs that.
ITEC 380 Organization of programming languages Dr. Andrew Ray.
Chapter 8 High-Level Programming Languages (modified by Erin Chambers)
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
Programming Languages and Design Lecture 1 Introduction to Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern University,
INTRODUCTION TO COMPUTING CHAPTER NO. 06. Compilers and Language Translation Introduction The Compilation Process Phase 1 – Lexical Analysis Phase 2 –
Chapter 1. Introduction.
CS 363 Comparative Programming Languages
COMPUTER PROGRAMS AND LANGUAGES Chapter 4. Developing a computer program Programs are a set (series) of instructions Programmers determine The instructions.
CS101 Introduction to Computing Lecture Programming Languages.
Programming Languages –14 David Watt (Glasgow) Steven Wong (Singapore) Moodle : Computing Science → Level 3 → Programming Languages 3 © 2012 David.
February 25, ICE 1341 – Programming Languages (Lecture #1) In-Young Ko Programming Languages (ICE 1341) Lecture #1 Programming Languages (ICE 1341)
1 Programming Languages Marjan Sirjani Course web site:
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 2.
1 Programming Language History and Evolution In Text: Chapter 2.
1 COMP 3438 – Part II-Lecture 1: Overview of Compiler Design Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
National Diploma Unit 4 Introduction to Software Development Introduction to Programming Languages.
Programming Languages Meeting 14 December 9/10, 2014.
Programming Domains 1.Scientific Applications Typically, scientific applications have simple data structures but require large numbers of floating-point.
Programming Languages
Engr. Isabelo Jun D. Paat, ME-CoE Lecturer 1 Programming Languages.
Programming Languages
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is.
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.
Programming Language Theory 2014, 1 Chapter 1 :: Introduction Origin : Michael L. Scott School of Computer & Information Engineering,
Software Engineering Algorithms, Compilers, & Lifecycle.
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.
Programming Language History and Evolution
Chapter 1. Introduction.
Programming Languages 2nd edition Tucker and Noonan
The language focusses on ease of use
Concepts of Programming Languages
Introduction to programming languages, Algorithms & flowcharts
Why study programming languages?
Basic 1964 PC general purpose Imperative Small Easy to use.
Introduction to programming languages, Algorithms & flowcharts
PROGRAMMING LANGUAGES
CSCI-235 Micro-Computer Applications
Problem Solving Using C: Orientation & Lecture 1
课程名 编译原理 Compiling Techniques
Programming Language History and Evolution
Developing Applications
Introduction to programming languages, Algorithms & flowcharts
Problem Solving.
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Problem Solving Using C: Orientation & Lecture 1
Programming Language Design
Programming Languages 2nd edition Tucker and Noonan
and Program Development
Principles of Programming Languages
Overview of Programming Paradigms
School of Computer & Information Engineering,
Presentation transcript:

CS 415: Programming Languages Chapter 1 Aaron Bloomfield Fall 2005

The first computers Scales – computed relative weight of two items Computed if the first item’s weight was less than, equal to, or greater than the second item’s weight Computed if the first item’s weight was less than, equal to, or greater than the second item’s weight Abacus – performed mathematical computations Primarily thought of as Chinese, but also Japanese, Mayan, Russian, and Roman versions Primarily thought of as Chinese, but also Japanese, Mayan, Russian, and Roman versions Can do square roots and cube roots Can do square roots and cube roots

Stonehenge

Computer Size ENIAC then… ENIAC today… With computers (small) size does matter!

Why study programming languages? Become a better software engineer Understand how to use language features Understand how to use language features Appreciate implementation issues Appreciate implementation issues Better background for language selection Familiar with range of languages Familiar with range of languages Understand issues / advantages / disadvantages Understand issues / advantages / disadvantages Better able to learn languages You might need to know a lot You might need to know a lot

Why study programming languages? Better understanding of implementation issues How is “this feature” implemented? How is “this feature” implemented? Why does “this part” run so slowly? Why does “this part” run so slowly? Better able to design languages Those who ignore history are bound to repeat it… Those who ignore history are bound to repeat it…

Why are there so many programming languages? There are thousands! Evolution Structured languages -> OO programming Structured languages -> OO programming Special purposes Lisp for symbols; Snobol for strings; C for systems; Prolog for relationships Lisp for symbols; Snobol for strings; C for systems; Prolog for relationships Personal preference Programmers have their own personal tastes Programmers have their own personal tastes Expressive power Some features allow you to express your ideas better Some features allow you to express your ideas better

Why are there so many programming languages? Easy to use Especially for teaching / learning tasks Especially for teaching / learning tasks Ease of implementation Easy to write a compiler / interpreter for Easy to write a compiler / interpreter for Good compilers Fortran in the 50’s and 60’s Fortran in the 50’s and 60’s Economics, patronage Cobol and Ada, for example Cobol and Ada, for example

End of lecture on 24 Aug 2005

Programming domains Scientific applications Using the computer as a large calculator Using the computer as a large calculator Fortran and friends, some Algol, APL Fortran and friends, some Algol, APL Using the computer for symbol manipulation Using the computer for symbol manipulation Mathematica Mathematica Business applications Data processing and business procedures Data processing and business procedures Cobol, some PL/1, RPG, spreadsheets Cobol, some PL/1, RPG, spreadsheets Systems programming Building operating systems and utilities Building operating systems and utilities C, PL/S, ESPOL, Bliss, some Algol and derivitaves C, PL/S, ESPOL, Bliss, some Algol and derivitaves

Programming domains Parallel programming Parallel and distributed systems Parallel and distributed systems Ada, CSP, Modula, DP, Mentat/Legion Ada, CSP, Modula, DP, Mentat/Legion Artificial intelligence Uses symbolic rather than numeric computations Uses symbolic rather than numeric computations Lists as main data structure Lists as main data structure Flexibility (code = data) Flexibility (code = data) Lisp in 1959, Prolog in the 1970s Lisp in 1959, Prolog in the 1970s Scripting languages A list of commands to be executed A list of commands to be executed UNIX shell programming, awk, tcl, Perl UNIX shell programming, awk, tcl, Perl

Programming domains Education Languages designed to facilitate teaching Languages designed to facilitate teaching Pascal, BASIC, Logo Pascal, BASIC, Logo Special purpose Other than the above… Other than the above… Simulation Simulation Specialized equipment control Specialized equipment control String processing String processing Visual languages Visual languages

Programming paradigms You have already seen assembly language We will study five language paradigms: Top-down (Algol 60 and Fortran) Top-down (Algol 60 and Fortran) Functional (Scheme and/or OCaml) Functional (Scheme and/or OCaml) Logic (Prolog) Logic (Prolog) Object oriented (Smalltalk) Object oriented (Smalltalk) Aspect oriented (AspectJ) Aspect oriented (AspectJ)

Programming language history Pseudocodes (195X) – Many Fortran (195X) – IBM, Backus Lisp (196x) – McCarthy Algol (1958) – Committee (led to Pascal, Ada) Cobol (196X) – Hopper Functional programming – FP, Scheme, Haskell, ML Logic programming – Prolog Object oriented programming – Smalltalk, C++, Python, Java Aspect oriented programming – AspectJ, AspectC++ Parallel / non-deterministic programming

Compilation vs. Translation Translation: does a ‘mechanical’ translation of the source code No deep analysis of the syntax/semantics of the code No deep analysis of the syntax/semantics of the code Compilation: does a thorough understanding and translation of the code A compiler/translator changes a program from one language into another C compiler: from C into assembly C compiler: from C into assembly An assembler then translates it into machine language Java compiler: from Java code to Java bytecode Java compiler: from Java code to Java bytecode The Java interpreter then runs the bytecode

Compilation stages ScannerParser Semantic analysis Intermediate code generation Machine-independent code improvement (optional) Target code generation Machine-specific code improvement (optional) For many compilers, the result is assembly Which then has to be run through an assembler Which then has to be run through an assembler These stages are machine-independent! The generate “intermediate code” The generate “intermediate code”

Compilation: Scanner Recognizes the ‘tokens’ of a program Example tokens: ( 75 main int { return ; foo Example tokens: ( 75 main int { return ; foo Lexical errors are detected here More on this in a future lecture More on this in a future lecture

Compilation: Parser Puts the tokens together into a pattern void main ( int argc, char ** argv ) { void main ( int argc, char ** argv ) { This line has 11 tokens This line has 11 tokens It is the beginning of a method It is the beginning of a method Syntatic errors are detected here When the tokens are not in the correct order: When the tokens are not in the correct order: int int foo ; int int foo ; This line has 4 tokens This line has 4 tokens After the type (int), the parser expects a variable name After the type (int), the parser expects a variable name Not another type

Compilation: Semantic analysis Checks for semantic correctness A semantic error: foo = 5; int foo; In C (and most languages), a variable has to be declared before it is used Note that this is syntactically correct Note that this is syntactically correct As both lines are valid lines as far as the parser is concerned

Compilation: Intermediate code generation (and improvement) Almost all compilers generate intermediate code This allows part of the compiler to be machine- independent This allows part of the compiler to be machine- independent That code can then be optimized Optimize for speed, memory usage, or program footprint Optimize for speed, memory usage, or program footprint

Compilation: Target code generation (and improvement) The intermediate code is then translated into the target code For most compilers, the target code is assembly For most compilers, the target code is assembly For Java, the target code is Java bytecode For Java, the target code is Java bytecode That code can then be further optimized Optimize for speed, memory usage, or program footprint Optimize for speed, memory usage, or program footprint