The Binary Machine Modern high-level programming languages are designed to make programming easier. On the other end, the low level, all modern digital.

Slides:



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

CS105 INTRODUCTION TO COMPUTER CONCEPTS INTRO TO PROGRAMMING Instructor: Cuong (Charlie) Pham.
The Analytical Engine Module 6 Program Translation.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
1 Programming & Programming Languages Overview l Machine operations and machine language. l Example of machine language. l Different types of processor.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
Program Translation Module 6. Mid-Term Results.
Implementation of a Stored Program Computer
Introduction to Computers and Programming. Some definitions Algorithm: Algorithm: A procedure for solving a problem A procedure for solving a problem.
The CPU The Central Presentation Unit Language Levels Fetch execute cycle Processor speed.
1 CHAPTER 4 LANGUAGE/SOFTWARE Hardware Hardware is the machine itself and its various individual equipment. It includes all mechanical, electronic.
Assembly & Machine Languages
1 Chapter-01 Introduction to Computers and C++ Programming.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter 17 Programming Tools The Architecture of Computer Hardware and Systems Software: An Information Technology Approach 3rd Edition, Irv Englander.
Introduction to Programming Language CS105 Programming Language First-generation: Machine language Second-generation: Assembly language Third-generation:
1 CSC 1401 S1 Computer Programming I Hamid Harroud School of Science and Engineering, Akhawayn University
CMPT 120 How computers run programs Summer 2012 Instructor: Hassan Khosravi.
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
Chapter 1. Introduction.
Introduction CS 104: Applied C++ What is Programming? For some given problem: __________ a solution for it -- identify, organize & store the problem's.
AS Computing Introduction to Programming. What is a Computer Program? A list of instructions that a computer must work through, in a logical sequence,
Tranlators. Machine Language The lowest-level programming languageprogramming language Machine languages are the only languages understood by computers.languagescomputers.
COMPUTER PROGRAMS AND LANGUAGES Chapter 4. Developing a computer program Programs are a set (series) of instructions Programmers determine The instructions.
An Introduction to Computers August 12, 2008 Mrs. C. Furman.
Computer Programming I. Today’s Lecture  Components of a computer  Program  Programming language  Binary representation.
Implementation of a Stored Program Computer ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides2.ppt Modification date: Oct 16,
Introduction to Computer Systems and the Java Programming Language.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
CSC425 - Introduction To Computer Programming 1. 2 Generation Of Programming Languages A set of rules that telling a computer what to do. There are over.
INTRODUCTION TO COMPUTING CHAPTER NO. 04. Programming Languages Program Algorithms and Pseudo Code Properties and Advantages of Algorithms Flowchart (Symbols.
School of Computer Science & Information Technology G6DICP Introduction to Computer Programming Milena Radenkovic.
What is Programming? A program is a list of instructions that is executed by a computer to accomplish a particular task. Creating those instructions is.
Introduction to Programming Instructor: Yong Tang Brookhaven National Laboratory Working on accelerator control (BNL Phone #)
PROGRAMMING LANGUAGES
Computer Science Binary. Binary Code Remember the power supply that is inside your computer and how it sends electricity to all of the components? That.
1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization.
Introduction to Compilers. Related Area Programming languages Machine architecture Language theory Algorithms Data structures Operating systems Software.
6. Program Translation CS100: The World of Computing John Dougherty Haverford College.
Introduction 1 (Read Chap. 1) What is Programming? For some given problem: design a solution for it -- identify, organize & store the problem's data --
Chapter 1 Introduction. Chapter 1 -- Introduction2  Def: Compiler --  a program that translates a program written in a language like Pascal, C, PL/I,
Computer Programming Languages HOW COMPUTERS WORK èCIRCUITS èBINARY DIGIT èBIT (0 OR 1) èBYTE - 8 BITS èASCII.
 Computer Languages Computer Languages  Machine Language Machine Language  Assembly Language Assembly Language  High Level Language High Level Language.
Computer Systems. Bits Computers represent information as patterns of bits A bit (binary digit) is either 0 or 1 –binary  “two states” true and false,
Programming Languages
The Functions and Purposes of Translators Translators, Interpreters and Compilers - High Level Languages.
Skill Area 311 Part B. Lecture Overview Assembly Code Assembler Format of Assembly Code Advantages Assembly Code Disadvantages Assembly Code High-Level.
The Functions and Purposes of Translators Translators, Interpreters and Compilers - High Level Languages.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.
1 Chapter 1 Background Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Software Engineering Algorithms, Compilers, & Lifecycle.
Objective of the course Understanding the fundamentals of the compilation technique Assist you in writing you own compiler (or any part of compiler)
Machine and Assembly Language
Chapter 1: An Overview of Computers and Programming Languages
Operating System Interface between a user and the computer hardware
CSCI-235 Micro-Computer Applications
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
CSCE Fall 2013 Prof. Jennifer L. Welch.
CS105 Introduction to Computer Concepts Intro to programming
CSCE Fall 2012 Prof. Jennifer L. Welch.
Introduction to Computer Programming
ICT Programming Lesson 1:
Chapter 1 Introduction.
1.3.7 High- and low-level languages and their translators
CS105 Introduction to Computer Concepts Intro to programming
Presentation transcript:

The Binary Machine Modern high-level programming languages are designed to make programming easier. On the other end, the low level, all modern digital computers understand only machine language. This means that a program written in a high-level language must be translated into machine language. Translation is performed by an assembler, an interpreter, or a compiler. A computer has a hard-wired instruction set unique to that computer.

The Binary Machine The instruction set is etched into the computer’s microprocessor chip. High-level -----> Translator -----> Low-level Source code > Object code Source code is what goes into a program translator. Object code is what comes out. At the low-level, all modern digital computers store programs and information in binary form.

Binary Representations Modern digital computer hardware circuitry is based on on-off switching. Thus, a computer can distinguish between only the two values “on” (1) and “off” (0). This means information must be represented in binary form. Some terminology: bit - binary digit. byte - 8 bits. word - 2 bytes or 16 bits.

Binary Representations Example: Computer memory is measured in bytes. 64 MB means 64 megabytes or 64 million bytes or 8 x 64 = 512 million bits. Numbers are represented in binary (base 2) notation. Example: 235 in decimal notation is in binary notation. 235 = 2 x x x = 1 x x x x x x x x 2 0

Binary Representations There’s a decimal-to-binary and binary-to- decimal calculator in Module 6 of The Analytical Engine Website. Characters are represented by coding them as integers. A commonly used character code is ASCII (American Standard Code for Information Interchange). Example: The letter A is represented by 65 or A right parenthesis ) is represented by 41 or

Encoding Instructions Instructions are also encoded in binary. accumulator - a location where intermediate results are stored. Sample coded instructions: Code Info Action X Load accumulator with contents of memory location X X Store accumulator value in memory location X X Halt execution X Add contents of memory location X to accumulator

Encoding Instructions With this coding, a simple machine- language program might look like this: Here’s what it says: Load accumulator with contents of 128. Add contents of 129 to accumulator. Store accumulator contents in 128. Halt.

Encoding Instructions As you might guess, programming in machine language is hard. Early programmers developed mnemonics for remembering instructions. The above machine-language program might be remembered as follows: (x = cell 128, y = cell 129) Load x Add y Store x Halt

Encoding Instructions The next step was to write a program which would translate these mnemonics to machine language, thereby sparing a programmer the grief of programming directly in machine language. This led to the first program translator. assembler - a program that takes an assembly language as its input source code and produces machine language as its output object code. The PIPPIN assembler.

Beyond the Assembler Assembly-language code is fast and efficient, but hard to write. Using a higher-level language closer to our native language would make programming easier. The idea is to move away from dealing with the computer at its level and work more at our level. When programming at a high level, we don’t want to think about the details of the computer our program will run on.

Types of Languages Modern high-level programming languages come in two flavors depending on the type of translator used to take source code and produce object code. interpreter - a translator which translates one line of source code and instructs the computer to perform the resulting object code before translating another line of source code. compiler - a translator which translates all the source code and produces a complete machine-language program.

Interpreted Languages Examples include BASIC, LISP, JavaScript. Advantages: - Interpreters are easy to write. - Errors are more easily localized. Disadvantages: - Interpreters are slow. - A source-code line will be translated as often as it is encountered. For example, a line of code in a loop that is repeated 1000 times will be translated 1000 times.

Compiled Languages Examples include FORTRAN, C, Java. Advantage: - After compilation, execution is fast. Disadvantage: - Localizing errors is more difficult.

Language Groups 1.Imperative - the fundamental unit is a procedure called by the main program. Examples are FORTRAN, Pascal, Ada. 2.Functional - processes are defined as functions with no main program. An example is LISP. 3.Declarative - the emphasis is on I/O as opposed to processing algorithms. Examples are COBOL, Prolog. 4.Object-oriented - hybrids organized around programming “objects”. Examples are C++, Java.

Language Translation Translation of a high-level language into machine language involves three steps: 1.Scanning - breaking the source code into its smallest meaningful pieces or tokens. This is what we do when we read a sentence and note the words it contains. 2.Parsing - arranging the tokens into a sensible logical structure. This is what we do when we recognize nouns, verbs, adjectives, etc. in a sentence. 3.Code generation - generating the machine language object code. This is what we do when we paraphrase a sentence for a kid.

Language Generations Languages are characterized by how far they are from what computers do and how close they are to what people do. 1.First generation - machine languages. 2.Second generation - assembly languages and assemblers. 3.Third generation - interpreted and compiled languages. 4.Fourth generation - languages that give “computational power to non- programmers.”