Levels of Programming Languages. Gerald Penn CSC 324



Similar documents
Chapter 1. Dr. Chris Irwin Davis Phone: (972) Office: ECSS CS-4337 Organization of Programming Languages

MACHINE ARCHITECTURE & LANGUAGE

1/20/2016 INTRODUCTION

Management Challenge. Managing Hardware Assets. Central Processing Unit. What is a Computer System?

Language Evaluation Criteria. Evaluation Criteria: Readability. Evaluation Criteria: Writability. ICOM 4036 Programming Languages

High level code and machine code

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)

CHAPTER 4 MARIE: An Introduction to a Simple Computer

Chapter 2 Logic Gates and Introduction to Computer Architecture

Introducción. Diseño de sistemas digitales.1

3 SOFTWARE AND PROGRAMMING LANGUAGES

Computer Organization. and Instruction Execution. August 22

An Overview of Stack Architecture and the PSC 1000 Microprocessor

Chapter 13: Program Development and Programming Languages

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

Notes on Assembly Language

CHAPTER 7: The CPU and Memory

CSCI 3136 Principles of Programming Languages

CPU Organisation and Operation

TYPES OF COMPUTERS AND THEIR PARTS MULTIPLE CHOICE QUESTIONS

Jonathan Worthington Scarborough Linux User Group

İSTANBUL AYDIN UNIVERSITY

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Chapter 14. Programming and Languages. McGraw-Hill/Irwin. Copyright 2008 by The McGraw-Hill Companies, Inc. All rights reserved.

What is a programming language?

Summary of the MARIE Assembly Language

Test Driven Development of Embedded Systems Using Existing Software Test Infrastructure

AC : A PROCESSOR DESIGN PROJECT FOR A FIRST COURSE IN COMPUTER ORGANIZATION

MICROPROCESSOR AND MICROCOMPUTER BASICS

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

Operating System Overview. Otto J. Anshus

Python Programming: An Introduction to Computer Science

Central Processing Unit (CPU)

Image credits:

Learning Outcomes. Simple CPU Operation and Buses. Composition of a CPU. A simple CPU design

Computer System: User s View. Computer System Components: High Level View. Input. Output. Computer. Computer System: Motherboard Level

Computer Programming. Course Details An Introduction to Computational Tools. Prof. Mauro Gaspari:

Figure 1: Graphical example of a mergesort 1.

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

Chapter 6: Programming Languages

An Introduction to Computer Science and Computer Organization Comp 150 Fall 2008

Instruction Set Architecture (ISA)

CS 40 Computing for the Web

McGraw-Hill The McGraw-Hill Companies, Inc.,

language 1 (source) compiler language 2 (target) Figure 1: Compiling a program

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

Chapter 12 Programming Concepts and Languages

Microprocessor & Assembly Language

CSE 141L Computer Architecture Lab Fall Lecture 2

CS 51 Intro to CS. Art Lee. September 2, 2014

CHAPTER 1 ENGINEERING PROBLEM SOLVING. Copyright 2013 Pearson Education, Inc.

Programming Logic controllers

Python Programming: An Introduction to Computer Science

picojava TM : A Hardware Implementation of the Java Virtual Machine

Lecture 1: Introduction

Logical Operations. Control Unit. Contents. Arithmetic Operations. Objectives. The Central Processing Unit: Arithmetic / Logic Unit.

Engineering Problem Solving

Software: Systems and. Application Software. Software and Hardware. Types of Software. Software can represent 75% or more of the total cost of an IS.

Administrative Issues

ATSBA: Advanced Technologies Supporting Business Areas. Programming with Java. 1 Overview and Introduction

(Refer Slide Time: 00:01:16 min)

Compilers. Introduction to Compilers. Lecture 1. Spring term. Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam.

Unit A451: Computer systems and programming. Section 2: Computing Hardware 1/5: Central Processing Unit

CSC Software II: Principles of Programming Languages

VLIW Processors. VLIW Processors

CSE 130 Programming Language Principles & Paradigms

OAMulator. Online One Address Machine emulator and OAMPL compiler.

Structure of Presentation. The Role of Programming in Informatics Curricula. Concepts of Informatics 2. Concepts of Informatics 1

Semester Review. CSC 301, Fall 2015

Ch. 10 Software Development. (Computer Programming)

Systems I: Computer Organization and Architecture

Instructor Özgür ZEYDAN BEU Dept. of Enve. Eng. CIV 112 Computer Programming Lecture Notes (1)

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

Instruction Set Design

Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

IEC The Fast Guide to Open Control Software

1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

Cambridge International AS and A Level Computer Science

CPU Organization and Assembly Language

CSC 2405: Computer Systems II

Computer Layers. Hardware BOOT. Operating System. Applications

Processor Architectures

Programming Languages

Language Processing Systems

The Fastest Way to Parallel Programming for Multicore, Clusters, Supercomputers and the Cloud.

Architectures and Platforms

A s we saw in Chapter 4, a CPU contains three main sections: the register section,

Fundamentals of Programming and Software Development Lesson Objectives

Computer Organization

Chapter 6. Inside the System Unit. What You Will Learn... Computers Are Your Future. What You Will Learn... Describing Hardware Performance

Chapter 13: Program Development and Programming Languages

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

Programming Languages & Tools

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-12: ARM

Fall 2012 Q530. Programming for Cognitive Science

CIS570 Modern Programming Language Implementation. Office hours: TDB 605 Levine

Building Applications Using Micro Focus COBOL

Transcription:

Levels of Programming Languages Gerald Penn CSC 324

Levels of Programming Language Microcode Machine code Assembly Language Low-level Programming Language High-level Programming Language

Levels of Programming Language Microcode Machine-specific code that directs the individual components of a CPU s data-path to perform small-scale operations. CPU: central processing unit of a computer, typically consisting of: Control unit Arithmetic/logical unit (ALU) Registers high-speed memory locations to store temporary results and control information. Foremost among these is the program counter, which points to the next instruction to be executed. The CPU is connected to I/O devices and main memory by parallel channels called buses.

Levels of Programming Language Microcode Machine-specific code that directs the individual components of a CPU s data-path to perform small-scale operations. Data-path: the ALU, its inputs and outputs. People who build computers program in micro-code. The programs that you write are converted (as explained later) into machine code. Every machine code instruction tells the CPU to execute a certain microprogram, written in micro-code. Often these programs are implemented in hardware. On the other hand, some microprocessors are: programmable, e.g., many digital signal processing chips that mobile telephones use, FPGAs, or reconfigurable they can actually rewire themselves.

Levels of Programming Language Machine code / Assembly Language Machine code instructions still depend on the computer s architecture, but the variation isn t as great; many CPUs manufactured around the same time or by the same company will use the same machine code sets, in fact. Assembly language is a symbolic presentation of machine code so that people (very dedicated people with lots of free time) can read programs written in it. Most assemblers (programs that convert assembly code to machine code) support labelling and macros to make assembly language programming easier. Some recent assemblers support looping control structures, simple data structures and even types!

Address Label Instruction Object Code.begin.org 2048 a_start.equ 3000 2048 ld length,% 2064 be done 00000010 100 2068 addcc %r1, -4,%r1 10000010 100 2072 addcc %41,%r2,%r4 10001000 100 2076 ld %r4,%r5 11001010 000 2080 ba loop 00010000 101 2084 addcc %r3,%r5,%r3 10000110 100 2088 done: jmpl %r15+4,%r0 10000001 110 2092 length: 20 00000000 000 2096 address: a_start 3000 a:.org a_start

Levels of Programming Language Low-level Programming Language Formerly known as high-level programming languages. e.g.: FORTRAN, COBOL, BASIC, arguably C These languages have looping constructs, procedures, functions, some typing the trappings of modern programming languages. Big improvement over assembly language.

Levels of Programming Language High-level Programming Language e.g.: Java, Python, ML, Prolog, MATLAB, etc. These are very convenient, but also very far removed from the computer they are running on. Type checking Easier to debug You may never even see a memory address. As a result, they typically aren t as efficient. They still may not be portable: implementation dependence. Java has had some problems with this.

Compilation A compiler is a program that converts a program written at one of the higher levels into an equivalent program at some lower level. Some people have even tried to use C as a target language for Java, ML or Prolog compilers. Not always the next level down, though. Native code compilers compile the code all the way down into the machine code level.

Compilation Advantages: Compile once, run target many times Compiler can optimize the speed of the target, even if the optimization itself takes a long time. Actually, most compilers define their own intermediate code levels, and perform optimizations at the source level, the intermediate level, and at the target level. Which level is best depends on the optimization. Disadvantage: debugging requires much more software support typically through annotated object code and IDE extensions.

Interpreted Code Code that isn t compiled before execution is interpreted. Some programming languages have both compilers and interpreters. Not a black-and-white distinction either it s very rare for an interpreter to perform no compilation whatsoever a byte compiler translates source code into a more compact form by coding keywords and hashing variables names and other strings.

Interpreted Code Advantages: Creates the impression that your computer actually runs on a high-level language Easier to provide feedback for debugging because execution proceeds from (something close to) source code Easier to rapidly prototype Often easier to add code while running code. Disadvantages: Slower Independent executions repeat much of the same work.

Inside your Interpreter The fetch-execute cycle initialize the program counter loop fetch instruction pointed to by PC increment the PC decode the instruction fetch data from memory, as necessary execute the instruction store the result end loop

Inside your Interpreter The idea that an imperative program is sitting around executing your precious ML code is anathema to functional programmers. But we can think of it functionally: then it s called the read-eval-print loop, a recursive program that repeatedly: initializes the evaluation environment reads an expression evaluates the expression, and then prints the expression.