12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt1 Topic 2b High-Level languages and System Software (Languages) Introduction to Computer Systems Engineering.

Slides:



Advertisements
Similar presentations
Chapt.2 Machine Architecture Impact of languages –Support – faster, more secure Primitive Operations –e.g. nested subroutine calls »Subroutines implemented.
Advertisements

Overview of programming in C C is a fast, efficient, flexible programming language Paradigm: C is procedural (like Fortran, Pascal), not object oriented.
Introduction to Programming G51PRG University of Nottingham Revision 1
Senem Kumova Metin Introduction to Programming CS 115 Introduction to Computing PART I : Computer Basics PART II: Introduction to Computing/Programming.
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
MIPS Assembly Language Programming
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
Chapter 5: Elementary Data Types Properties of types and objects –Data objects, variables and constants –Data types –Declarations –Type checking –Assignment.
Introduction to C Programming CE Lecture 1 Introduction to C.
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
The Analytical Engine Module 6 Program Translation.
Principles of Object-Oriented Software Development The language Java.
Unix Continuum of Tools Do something once: use the command line Do something many times: –Use an alias –Use a shell script Do something that is complex.
Programming Languages Structure
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
Computer Science 210 Computer Organization Introduction to C.
“C” Programming Language CIS 218. Description C is a procedural languages designed to provide lowlevel access to computer system resources, provide language.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
ITEC 352 Lecture 11 ISA - CPU. ISA (2) Review Questions? HW 2 due on Friday ISA –Machine language –Buses –Memory.
CS 355 – Programming Languages
Introduction to Programming Languages. Problem Solving in Programming.
Chapter 1. Introduction.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Introduction of C++ language. C++ Predecessors Early high level languages or programming languages were written to address a particular kind of computing.
Chapter 11 Programming in C Compilation vs. Interpretation Different ways of translating high-level language Compilation translates code into machine.
INTRODUCTION TO JAVA CHAPTER 1 1. WHAT IS JAVA ? Java is a programming language and computing platform first released by Sun Microsystems in The.
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
Software Overview. Why review software? Software is the set of instructions that tells hardware what to do The reason for hardware is to execute a program.
Programming With C.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
Computer Architecture Instruction Set Architecture Lynn Choi Korea University.
Chapter 11 Introduction to Programming in C. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display Compilation.
CSE 2541 – Advanced C Programming. Course info Prereq – CSE 2221 or CSE 222 Co-req – CSE 2231 Website
Chapter 6 Programming Languages © 2007 Pearson Addison-Wesley. All rights reserved.
Applied Computing Technology Laboratory QuickStart C# Learning to Program in C# Amy Roberge & John Linehan November 7, 2005.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
Topic 2d High-Level languages and Systems Software
Group 4 Java Compiler Group Members: Atul Singh(Y6127) Manish Agrawal(Y6241) Mayank Sachan(Y6253) Sudeept Sinha(Y6483)
An Introduction to Java – Part 1 Dylan Boltz. What is Java?  An object-oriented programming language  Developed and released by Sun in 1995  Designed.
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Slides created by: Professor Ian G. Harris Hello World #include main() { printf(“Hello, world.\n”); }  #include is a compiler directive to include (concatenate)
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
Programming Language Concepts (CIS 635) Elsa L Gunter 4303 GITC NJIT,
C is a high level language (HLL)
COP4020 Programming Languages Introduction Prof. Robert van Engelen (modified by Prof. Em. Chris Lacher)
Chapter 7 Process Environment Chien-Chung Shen CIS/UD
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Chapter 1 Introduction Samuel College of Computer Science & Technology Harbin Engineering University.
Chapter 1. Introduction.
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Computer Science 210 Computer Organization
Computer Architecture Instruction Set Architecture
Computer Architecture Instruction Set Architecture
CS 61C: Great Ideas in Computer Architecture Introduction to C
课程名 编译原理 Compiling Techniques
C Basics.
Topic 2e High-Level languages and Systems Software
Computer Science 210 Computer Organization
The University of Adelaide, School of Computer Science
Chap 1 Chap 2 Chap 3 Chap 5 Surprise Me
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
The C Language: Intro.
Chapter 11 Programming in C
Presentation transcript:

12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt1 Topic 2b High-Level languages and System Software (Languages) Introduction to Computer Systems Engineering (CPEG 323)

12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt2 Reading List Slides: Topic2b K & R : C Programming Language JAVA in a Nutshell

Processors Programs  Written in High Level Languages How Processors see the high level languages? The role of toolchains Connections between ISA and high-level languages Connections between ISA and Operating Systems 12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt3

High Programming Languages Portability Abstraction Penalty Languages Categories Imperative (C) Functional (LISP) Logic (PROLOG) Object Oriented (Java) Scripting (Python) 12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt4

Timeline of Programming Languages 12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt5 Courtesy of Wikipedia. Original Author: Maximilian Dörrbecker

C versus Java C K&R  Initial implementation of C  1978  Weakly type checking for arguments and implicit integer return type. ANSI C / ISO C (C89 and C90)  De facto standard  Function prototypes, void pointers, international character sets, preprocessor enhancements (e.g. ## concatenation), prototypes, etc 12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt6

C versus Java C C99  Extension to several compilers  Inline functions, new data types, variable length arrays (included in the GCC compiler), variadic macros, etc Java “Get the power and flexibility of C++, but in a smaller, simpler and safer language”  Not implicit pointers  Implicit Garbage Collection  Control statements  Only controlled by primitive booleans  Encapsulation is strictly enforced  Concurrency Control  Widening Cohercion only  Applet versus standalone versus servlet versus Javaserver page versus swing applications 12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt7

C versus Java C Imperative Functions Libraries are low level Manual Memory Management Pointers Low Memory Overhead Relatively Fast Variables initialize to garbage Java Object Oriented Methods Class libraries of data structures Automatic Memory Management High Memory Overhead Relatively Slow Variables initialized to zero 12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt8

C versus Java Hello, World in CHello, World in Java 12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt9 #include int main(int argc, char **argv) { /* This is a comment!!! */ printf("Hello, world!\n"); return 0; } public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, world!"); }

C versus Java 12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt10 C Code Lexical Analyzer Syntax Analyzer IR CG and Semantic Analyzer CG Optimizer Symbol Table Computer Machine Code Lexical Analyzer Syntax Analyzer IR CG and Semantic Analyzer Java Code Java Byte Code (e.g. Java Source code.class files) Java Virtual Machine API Class files Java Platform

C Syntax Very similar to Java but with a few differences Variable Declarations must go at the beginning of the block (before they are used) A variable may be initialized in its declaration 12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt11

Memory Storage for HLPL Linear Storage of multi dimensional array Row Major order (C, C++, JAVA) 12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt12 int A[4][5] | int[][] A = new int[4][5]; A(1,1) A(1,2) A(1,3) A(1,4) A(1,5) A(2,1) A(2,2) A(2,3) A(2,4) A(2,5) A(3,1) A(3,2) A(3,3) A(3,4) A(3,5) A(4,1) A(4,2) A(4,3) A(4,4) A(4,5) A(1,1) A(1,2) A(1,3) A(1,4) A(1,5) A(2,1) A(2,2) A(2,3) A(2,4) A(2,5) A(3,1) A(3,2) A(3,3) A(3,4) A(3,5) A(4,1) A(4,2) A(4,3) A(4,4) A(4,5) Memory

Memory Storage for HLPL Column Major order (Fortran, MATLAB) 12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt13 Memory REAL A(4,5) A(1,1) A(1,2) A(1,3) A(1,4) A(1,5) A(2,1) A(2,2) A(2,3) A(2,4) A(2,5) A(3,1) A(3,2) A(3,3) A(3,4) A(3,5) A(4,1) A(4,2) A(4,3) A(4,4) A(4,5) A(1,1) A(2,1) A(3,1) A(4,1) A(1,2) A(2,2) A(3,2) A(4,2) A(1,3) A(2,3) A(3,3) A(4,3) A(1,4) A(2,4) A(3,4) A(4,4) A(1,5) A(2,5) A(3,5) A(4,5)

Assembly Language Compiler  Generates Assembly code Assembly language Pseudo Instructions  li RX, Imm  Load Immediate to register Translates to a pair of instructions (addiu / lui or addiu / shori) if the immediate is greater than 16 bits  la RX, VAR  Load address of “VAR” into register Translates according to the area in which VAR resides Global Area: one instruction  addi RX, GP, OFFSET Another Area: Two Instructions  lui RX, HI16(VAR); addiu RX, RX, LOW16(VAR) 12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt14

Load 32-bit Immediate 12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt15 LUI R9, 0xAAAA op16-bit Imm AAAA BBBB op 16-bit Imm R9 ADDIU R9, R9, 0xBBBB

Load 32-bit Immediate 12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt16 ADDI R9, R0, 0xAAAA op16-bit Imm AAAA op 16-bit Imm R9 SHORI R9,R9, 0xBBBB BBBB AAAA Shift 16 bits or

Assembly Language Assembly language(cont.) Assembler directives .file – source file name .text – start a text section .align – alignment requirement .data – data section .rdata – read-only data section .globl – an external name .ent – entry of a function .frame – information about the function frame .mask – integer registers used in this function .fmask – floating point registers used in this function .ascii – define a string of characters 12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt17