159.331Prog Lang & Alg1 159.331 Programming Languages & Algorithms Lecture 02 - Aspects of Programming Languages - Part 1 (Figures from Bal & Grune)

Slides:



Advertisements
Similar presentations
Dr. Ken Hoganson, © August 2014 Programming in R COURSE NOTES 2 Hoganson Language Translation.
Advertisements

Chapter 2 Data Manipulation Dr. Farzana Rahman Assistant Professor Department of Computer Science James Madison University 1 Some sldes are adapted from.
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Programming Languages Language Design Issues Why study programming languages Language development Software architectures Design goals Attributes of a good.
Chapter 5: Computer Systems Organization Invitation to Computer Science, Java Version, Third Edition.
Chapter 1 Introduction to Object- Oriented Programming and Problem Solving.
Reasons to study concepts of PL
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Computing Components 01/26/11. Announcements & Reminders Programs 1 due Friday, 9/2/11 What is my late policy? Proxy Codes for Labs  You should be able.
Programming Languages Structure
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
CS 300 – Lecture 2 Intro to Computer Architecture / Assembly Language History.
CS 104 Introduction to Computer Science and Graphics Problems Software and Programming Language (2) Programming Languages 09/26/2008 Yang Song (Prepared.
Programming. Software is made by programmers Computers need all kinds of software, from operating systems to applications People learn how to tell the.
1 CHAPTER 4 LANGUAGE/SOFTWARE Hardware Hardware is the machine itself and its various individual equipment. It includes all mechanical, electronic.
CS 415: Programming Languages Chapter 1 Aaron Bloomfield Fall 2005.
1 Chapter-01 Introduction to Computers and C++ Programming.
CCSA 221 Programming in C CHAPTER 2 SOME FUNDAMENTALS 1 ALHANOUF ALAMR.
Introduction to High-Level Language Programming
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Programming Languages CPS120: Introduction to Computer Science Lecture 5.
1.1 1 Introduction Foundations of Computer Science  Cengage Learning.
Computer Hardware and Software Chapter 1. Overview Brief History of Computers Hardware of a Computer Binary and Hexadecimal Numbers Compiling vs. Interpreting.
High-level Languages.
CS 1308 Computer Literacy and the Internet Computer Systems Organization.
Levels of Architecture & Language CHAPTER 1 © copyright Bobby Hoggard / material may not be redistributed without permission.
Chapter 5: Computer Systems Organization Invitation to Computer Science, Java Version, Third Edition.
Programming Languages –14 David Watt (Glasgow) Steven Wong (Singapore) Moodle : Computing Science → Level 3 → Programming Languages 3 © 2012 David.
Computer Systems Organization CS 1428 Foundations of Computer Science.
C++ Programming Language Lecture 1 Introduction By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
What have mr aldred’s dirty clothes got to do with the cpu
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Robert Crawford, MBA West Middle School.  Explain how the binary system is used by computers.  Describe how software is written and translated  Summarize.
Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm.
Stored Programs In today’s lesson, we will look at: what we mean by a stored program computer how computers store and run programs what we mean by the.
Programming in C++ Dale/Weems/Headington Chapter 1 Overview of Programming and Problem Solving.
CS-303 Introduction to Programming
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
Chapter 1 An Overview of Computers and Programming Languages.
Representation of Data - Instructions Start of the lesson: Open this PowerPoint from the A451 page – Representation of Data/ Instructions How confident.
1 Chapter 1 Background Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Programming 2 Intro to Java Machine code Assembly languages Fortran Basic Pascal Scheme CC++ Java LISP Smalltalk Smalltalk-80.
Software Engineering Algorithms, Compilers, & Lifecycle.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 0: Historical Overview.
Computer Basics.
CSC235 Computer Organization & Assembly Language
Component 1.6.
CSCI 161: Introduction to Programming
Concepts of Programming Languages
Machine and Assembly Language
Why study programming languages?
Lecture 1 Introduction Richard Gesick.
CSCI-235 Micro-Computer Applications
课程名 编译原理 Compiling Techniques
Application Development Theory
CSCI/CMPE 3334 Systems Programming
Developing Applications
Compiler Construction
Chapter 5: Computer Systems Organization
Programming.
Low Level Programming Languages
Introduction to Computer Programming
Von Neumann Architecture
Principles of Programming Languages
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Chapter 4 The Von Neumann Model
Presentation transcript:

Prog Lang & Alg Programming Languages & Algorithms Lecture 02 - Aspects of Programming Languages - Part 1 (Figures from Bal & Grune)

Prog Lang & Alg2 What is a Programming Language? A vehicle for the user to tell the computer what to do to solve the user’s problem Enables the user to bridge the gap between problem domain and machine domain –Problem domain is all about the application –Machine domain is about memory and cpu, peripherals and the computer’s capabilities

Prog Lang & Alg3 Which Programming Language? There are lots of programming languages (estimates vary but probably over 4000 in existence!) Not all languages equally important Are grouped in families based around key ideas So we don’t need to know them all (luckily!) Some support some ideas and algorithms better than others (“better” might mean in terms of speed or cost) Its important to know which is best for a particular sort of problem

Prog Lang & Alg4 Who is the Language For? The human - needs to be readable and in language that is memorable and understandable to the human who wrote it and the (possibly different) humans who have to read it The computer - just needs a compiler that understands the particular language –Sometimes it does not even need a compiler!

Prog Lang & Alg5 Machine Code Machine code is about as low a level language as we can get - maybe not even a “language” at all - just a list of numbers Specifies hardware machine instructions like: –Move the number in register X to memory location Y –Add two registers together leaving answer in another –Branch two instructions forward if register X is zero Often in hexadecimal - base 16 - translates into values that control the hardware - the voltages on the wires! (hex ABCDEF) Rare that we need to work at this level - tools to help us

Prog Lang & Alg6 A Reminder - What is a Computer? Generally (although not necessarily) a von Neumann machine (after John von Neumann) Machine has a state (of the registers etc) An instruction pointer (IP) telling it which to do next Flow of control is to march through its program code Program acts on memory (and devices which might be memory-mapped) Can modify its program data and maybe even its program code too

Prog Lang & Alg7 Assembly Language A set of textual macros and mnemonics for the numbers used in machine codes Often manufacturer supplies quite elaborate tools for developing in assembler for their CPU Still hard for humans to work with Often only needed at lowest bootstrap level when developing a new computer Maybe needed to optimise speed of some very important code eg for a device driver

Prog Lang & Alg8 Example is for Motorola Processor

Prog Lang & Alg9 Assembly language A step forward from machine code Macros can do some of the tedious address calculations Still machine (CPU product) specific Only very primitive concepts supported: –Arithmetic and Logic –Conditionals –Loops –Branches –Memory addressing

Prog Lang & Alg10 Higher-Level Languages All programming languages are attempts to map a problem to the machine To link the user’s problem specific language to the nuts and bolts of the machine. But we can do better than assembler! Some early “High” level languages - Fortran and Cobol and C use ideas (and syntax) that still exist in modern languages such as Ada and build on assembler ideas

Prog Lang & Alg11 More readable for Humans than Assembler - and the Compiler can do the loop address calculations for us! Modern Fortran allows us to Use END DO instead of the Numbered continue statement

Prog Lang & Alg12 Loop that does nothing except change the loop counter There might be a NOP no operation (a “do-nothing” instruction code)

Prog Lang & Alg13 Reminder - What is a Compiler? Compiler is the tool (program) that we run to convert our high level language into machine code Turns our text (that we understand) into numbers (that the computer can use) So who is our programming language text for? Compilers ignore comments - they are for us!

Prog Lang & Alg14 Some History Remember Computer Science is still quite a young discipline The oldest material we are discussing is only late 1940s Only around 60 years and much in the last 40 We can look at the decades as an approximate guide:

Prog Lang & Alg s- Pre-lingual Stage Programming early computers in machine code - toggle switches and punch cards Programs were necessarily very small Still useful to make machine do very tedious tasks Before this your “computer” was a human

Prog Lang & Alg s - Exploiting Machine Power Assembler Language used Lots of numerical analysis and number crunching applications Scientific (weather and bomb simulations) IBM Mathematical FORmula TRANslating System - function library for maths

Prog Lang & Alg s - Increasing Expressive Power FORTRAN developed further - Fortran 66 FORTRAN became a non-vendor specific as other companies started competing with IBM COBOL, Lisp, algol 60, BASIC, PL/I… “Serious” programming still done in assembler - machine cycles still (much) more expensive than programmer time!

Prog Lang & Alg s Portability & Correctness Beginnings of the “software crisis” “Structured Programming” and other tools/approaches Pascal, Algol 68, C, Fortran 77 Still lots of assembler Continuation of the night hacker culture - use the machine at unfriendly times when cycles are cheaper

Prog Lang & Alg s Reducing Complexity Start of a continuing problem Large complex codes Ada, Modula-2 Smalltalk (Object oriented) Miranda (Functional) Lots of tools (Make) and Environments NASA and other still use assembler

Prog Lang & Alg s - Parallel and Distributed Massive Parallelism - Special purpose languages for expensive new computers Data-Parallel (High Performance Fortran) Message-Passing Support in languages: Hermes, Linda, Orca, SR, Ada 9X Support in special libraries for eg C++ Reduced Instruction Set Chip architectures (RISC) - too hard for humans to write good assembler

Prog Lang & Alg ’s - Virtual Machines Already happening in late 1990s Java Virtual Machine and Verification technologies Copied elsewhere Problem Solving - Very High level languages like Matlab, Mathematica are effectively virtual machines

Prog Lang & Alg22 Maybe the 2000’s were the era of “the virtual machine” eg Java, Matlab, Mathematica,…

Prog Lang & Alg23 Reminder - What is a VM? A compiler makes code from program text - eg C or C++ - and stores it in a file (of code) An interpreter reads the program text line by line and executes as it goes (usually very slow) - eg Perl or Python interpreters A Virtual Machine is a software machine that executes instructions in some language eg Java Bytecode, or Matlab Language –Combines compiling and interpreter ideas

Prog Lang & Alg24 Summary Aspects of Programming Languages - Part 1 –What is a Programming language? –What/Who is it For? –Machines, Code, Assembler –Higher Level languages –A Brief history Bal & Grune Chapter 1; Sebesta Chapters 1&2 See Mashey’s article in ACM Queue (Jan 05) Next - Programming Paradigms