High-Level Language. Building a Modern Computer From First Principles.
|
|
- Lindsay Watts
- 8 years ago
- Views:
Transcription
1 High-Level Language Building a Modern Computer From First Principles Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 1
2 Where we are at: Human Thought Abstract design Chapters 9, 12 abstract interface H.L. Language & Operating Sys. Compiler Chapters abstract interface Virtual Machine Software hierarchy VM Translator Chapters 7-8 abstract interface Assembly Language Assembler Chapter 6 abstract interface Machine Language Computer Architecture Chapters 4-5 Hardware hierarchy abstract interface Hardware Platform Gate Logic Chapters 1-3 abstract interface Chips & Logic Gates Electrical Engineering Physics Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 2
3 A brief evolution of object-oriented languages Machine language (binary code) Assembly language (low-level symbolic programming) Simple procedural languages, e.g. Fortran, Basic, Pascal, C Simple object-based languages (without inheritance), e.g. early versions of Visual Basic, JavaScript Jack Fancy object-oriented languages (with inheritance): C++, Java, C# Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 3
4 The Jack programming language Jack: a simple, object-based, high-level language with a Java-like syntax Some sample applications written in Jack: procedural programming Pong game Space Invaders Tetris Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 4
5 Disclaimer Although Jack is a real programming language, we don t view it as an end Rather, we use Jack as a means for teaching: How to build a compiler How the compiler and the language interface with the operating system How the topmost piece in the software hierarchy fits into the big picture Jack can be learned (and un-learned) in one hour. Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 5
6 Hello world /** /** Hello Hello World World program. program. */ */ class class Main Main { void void main main () (){ // // Prints Prints some some text text using using the the standard standard library library do do Output.printString("Hello World"); World"); do do Output.println(); // // New New line line return; return; Some observations: Java-like syntax Typical comments format Standard library Language-specific peculiarities. Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 6
7 Typical programming tasks in Jack Jack can be used to develop any app that comes to my mind, for example: Procedural programming: a program that computes n Object-oriented programming: a class representing bank accounts Abstract data type representation: a class representing fractions (like 2/5) Data structure representation: a class representing linked lists Etc. We will now discuss the above app examples As we do so, we ll begin to unravel how the magic of a high-level object-based language is delivered by the compiler and by the VM These insights will serve us in the next lectures, when we build the Jack compiler. Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 7
8 Procedural programming example class class Main Main { /** /** Sums Sums up up n */ */ int int sum sum (int (int n) n) { var var int int sum, sum, i; i; let let sum sum = 0; 0; let let i = 1; 1; while while (~(i (~(i > n)) n)) { let let sum sum = sum sum + i; i; let let i = i + 1; 1; return return sum; sum; void void main main () (){ var var int int n; n; let let n = Keyboard.readInt("Enter n: n: "); "); do do Output.printString("The result result is: is: "); "); do do Output.printInt(sum(n)); return; return; Jack program = a collection of one or more classes Jack class = a collection of one or more subroutines Execution order: when we execute a Jack program, Main.main() starts running. Jack subroutine: method constructor (static method) (the example on the left has s only, as it is object-less ) Standard library: a set of OS services (methods and s) organized in 8 supplied classes: Math, String. Array, Output, Keyboard, Screen, Memory, Sys (OS API in the book). Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 8
9 Object-oriented programming example The BankAccount class API (method sigantures) /** /** Represents Represents a bank bank account. account. A bank bank account account has has an an owner, owner, an an id, id, and and a balance. balance. The The id id values values start start at at 0 and and increment increment by by 1 each each time time a new new account account is is created. created. */ */ class class BankAccount { /** /** Constructs Constructs a new new bank bank account account with with a 0 balance. balance. */ */ constructor BankAccount new(string new(string owner) owner) /** /** Deposits Deposits the the given given amount amount in in this this account. account. */ */ method method void void deposit(int amount) amount) /** /** Withdraws Withdraws the the given given amount amount from from this this account. account. */ */ method method void void withdraw(int amount) amount) /** /** Prints Prints the the data data of of this this account. account. */ */ method method void void printinfo() /** /** Disposes Disposes this this account. account. */ */ method method void void dispose() dispose() Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 9
10 Object-oriented programming example (continues) /** /** Represents Represents a bank bank account. account. */ */ class class BankAccount { // // class-level variable variable static static int int newacctid; newacctid; // // Private Private variables variables (aka (aka fields fields / / properties) properties) field field int int id; id; field field String String owner; owner; field field int int balance; balance; /** /** Constructs Constructs a new new bank bank account account */ */ constructor BankAccount new new (String (String owner) owner) { let let id id = newacctid; newacctid; let let newacctid newacctid = newacctid newacctid + 1; 1; let let this.owner this.owner = owner; owner; let let balance balance = 0; 0; return return this; this; 2 // // More More BankAccount methods. methods. 3 // // Code Code in in any any other other class: class: var var int int x; x; var var BankAccount b; 1 b; let let b = BankAccount.new("joe"); Explain: return this The constructor returns the RAM base address of the memory block that stores the data of the newly created BankAccount object Explain: b = BankAccount.new("joe") Calls the constructor (which creates a new BankAccount object), then stores a pointer to the object s base memory address in variable b Behind the scene (following compilation): // b = BankAccount.new("joe") push "joe" call BankAccount.new pop b Explanation: the VM code calls the constructor; the constructor creates a new object, pushes its base address onto the stack, and returns; The calling code then pops the base address into a variable that will now point to the new object. Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 10
11 Object-oriented programming example (continues) class class BankAccount { static static int int naccounts; naccounts; field field int int id; id; field field String String owner; owner; field field int int balance; balance; // // Constructor......(omitted) /** /** Handles Handles deposits deposits */ */ method method void void deposit deposit (int (int amount) amount) { let let balance balance = balance balance + amount; amount; return; return; /** /** Handles Handles withdrawls withdrawls */ */ method method void void withdraw withdraw (int (int amount){ amount){ if if (~(amount (~(amount > balance)) balance)) { let let balance balance = balance balance - amount; amount; return; return; // // More More BankAccount methods. methods var var BankAccount b1, b1, b2; b2; let let b1 b1 = BankAccount.new("joe"); let let b2 b2 = BankAccount.new("jane"); do do b1.deposit(5000); do do b1.withdraw(1000); Explain: do b1.deposit(5000) In Jack, void methods are invoked using the keyword do (a compilation artifact) The object-oriented method invocation style b1.deposit(5000) is a fabcy way to expres the procedural semantics deposit(b1,5000) Behind the scene (following compilation): // do b1.deposit(5000) push b1 push 5000 call BanAccount.deposit Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 11
12 Object-oriented programming example (continues) class class BankAccount { static static int int naccounts; naccounts; field field int int id; id; field field String String owner; owner; field field int int balance; balance; // // Constructor......(omitted) /** /** Prints Prints information about about this this account. account. */ */ method method void void printinfo printinfo () (){ do do Output.printInt(id); do do Output.printString(owner); do do Output.printInt(balance); return; return; /** /** Disposes Disposes this this account. account. */ */ method method void void dispose dispose () (){ do do Memory.deAlloc(this); return; return; // // Code Code in in any any other other class: class: var var int int x; x; var var BankAccount b; b; let let b = BankAccount.new("joe"); // // Manipulates b... b... do do b.printinfo(); do do b.dispose(); Explain do b.dispose() Jack has no garbage collection; The programmer is responsible for explicitly recycling memory resources of objects that are no longer needed. // // More More BankAccount methods. methods. Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 12
13 Abstract data type example The Fraction class API (method sigantures) /** /** Represents Represents a fraction fraction data data type. type. A fraction fraction consists consists of of a numerator numerator and and a denominator, both both int int values values */ */ class class Fraction Fraction { /** /** Constructs Constructs a fraction fraction from from the the given given data data */ */ constructor Fraction Fraction new(int new(intnumerator, numerator, int int denominator) /** /** Reduces Reduces this this fraction, fraction, e.g. e.g. changes changes 20/100 20/100 to to 1/5. 1/5. */ */ method method void void reduce() reduce() /** /** Accessors Accessors method method int int getnumerator() method method int int getdenominator() /** /** Returns Returns the the sum sum of of this this fraction fraction and and the the other other one one */ */ method method Fraction Fraction plus(fraction other) other) /** /** Returns Returns the the product product of of this this fraction fraction and and the the other other one one */ */ method method Fraction Fraction product(fraction other) other) /** /** Prints Prints this this fraction fraction */ */ method method void void print() print() /** /** Disposes Disposes this this fraction fraction */ */ method method void void dispose() dispose() Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 13
14 Abstract data type example (continues) /** /** Represents Represents a fraction fraction data data type. type. A fraction fraction consists consists of of a numerator numerator and and a denominator, both both int int values values */ */ class class Fraction Fraction { field field int int numerator, numerator, denominator; constructor Fraction Fraction new new (int (int numerator, numerator, int int denominator) { let let this.numerator = numerator; numerator; let let this.denominator = denominator; do do reduce() reduce() // // Reduces Reduces the the new new fraction fraction return return this this /** /** Reduces Reduces this this fraction fraction */ */ method method void void reduce reduce () (){ // // Code Code omitted omitted // // A static static method method that that computes computes the the greatest greatest common common denominator of of a and and b. b. int int gcd gcd (int (int a, a, int int b) b) { // // Code Codeomitted omitted // // Code Code in in any any other other class: class: method method int int getnumerator () (){ var var Fraction Fraction a, a, b; b; return return numerator; numerator; let let a = Fraction.new(2,5); let let b = Fraction.new(70,210); method method int int getdenominator () (){ do do b.print() b.print() // // prints prints "1/3" "1/3" return return denominator; // //(print method method in in next next slide) slide) // // More More Fraction Fraction methods methods follow. follow. Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 14
15 Abstract data type example (continues) /** /** Represents Represents a fraction fraction data data type. type. A fraction fraction consists consists of of a numerator numerator and and a denominator, both both int int values values */ */ class class Fraction Fraction { field field int int numerator, numerator, denominator; // // Constructor and and previously previously defined defined methods methods omitted omitted /** /** Returns Returns the the sum sum of of this this fraction fraction the the other other one one */ */ method method Fraction Fraction plus plus (Fraction (Fraction other) other) { var var int int sum; sum; let let sum sum = (numerator (numerator* other.getdenominator()) + (other.getnumerator() * denominator()); return return Fraction.new(sum, denominator * other.getdenominator()); // // Similar Similar fraction fraction arithmetic arithmetic methods methods follow, follow, code code omitted. omitted. /** /** Prints Prints this this fraction fraction */ */ method method void void print print () (){ do do Output.printInt(numerator); do do Output.printString("/"); do do Output.printInt(denominator); return return // // Code Code in in any any other other class: class: var var Fraction Fraction a, a, b, b, c; c; let let a = Fraction.new(2,3); let let b = Fraction.new(1,5); // // computes computes c = a + b let let c = a.plus(b); a.plus(b); do do c.print(); c.print(); // // prints prints "13/15" "13/15" Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 15
16 Data structure example /** /** Represents Represents a sequence sequence of of int int values, values, implemented as as a linked linkedlist. list. The The list list consists consists of of an an atom, atom, which which is is an an int int value, value, and and a tail, tail, which which is is either either a list list or or a null null value. value. */ */ class class List List { field field int int data; data; field field List List next; next; /* /* Creates Creates a new new list list */ */ constructor List List new new (int (int car, car, List List cdr) cdr) { let let data data = car; car; let let next next = cdr; cdr; return return this; this; v 2 v /* /* Disposes Disposes this this list list by by recursively disposing disposing its its tail. tail. */ */ method method void void dispose() dispose() { if if (~(next (~(next = null)) null)) { // do do next.dispose(); // Code Code in in any any other other class: class: do do Memory.deAlloc(this); // // Creates Creates a list list holding holding the the numbers numbers 2,3, 2,3, and and 5: 5: return; return; var var List List v; v; let let v = List.new(5 List.new(5, null); null); let let v = List.new(2 List.new(2, List.new(3,v)); // // class class List. List Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 16
17 Jack language specification Syntax Data types Variable kinds Expressions Statements Subroutine calling Program structure Standard library (for complete language specification, see the book). Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 17
18 Jack syntax Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 18
19 Jack syntax (continues) Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 19
20 Jack data types Primitive types (Part of the language; Realized by the compiler): int 16-bit 2 s complement (from to 32767) boolean 0 and 1, standing for true and false char unicode character ( a, x, +, %,...) Abstract data types (Standard language extensions; Realized by the OS / standard library): String Array... (extensible) Application-specific types (User-defined; Realized by user applications): BankAccount Fraction List Bat / Ball... (as needed) Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 20
21 Jack variable kinds and scope Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 21
22 Jack expressions A Jack expression is any one of the following: A constant A variable name in scope (the variable may be static, field, local, or a parameter) The keyword this, denoting the current object An array element using the syntax arrayname[expression], where arraynname is a variable name of type Array in scope A subroutine call that returns a non-void type An expression prefixed by one of the unary operators or ~ : -expression ~expression (arithmetic negation) (logical negation) An expression of the form expression op expression where op is one of the following: + - * / (integer arithmetic operators) & < > = (boolean and and or operators, bit-wise) (comparison operators) ( expression ) (an expression within parentheses) Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 22
23 Jack Statements let let varname = expression; expression; or or let let varname[expression] = expression; expression; if if (expression) { statements else else { statements while while (expression) { statements do do -or-method-call; return return expression; expression; or or return; return; Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 23
24 Jack subroutine calls General syntax: subroutinename(arg0, arg1, ) where each argument is a valid Jack expression Parameter passing is by-value (primitive types) or by-reference (object types) Example 1: Consider the (static method): int sqrt(int n) This can be invoked as follows: sqrt(17) sqrt(x) sqrt((b * b) (4 * a * c)) sqrt(a * sqrt(c - 17) + 3) Etc. In all these examples the argument value is computed and passed by-value Example 2: Consider the method: method Matrix plus (Matrix other); If u and v were variables of type Matrix, this method can be invoked using: u.plus(v) The v variable is passed by-reference, since it refers to an object. Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 24
25 Noteworthy features of the Jack language The (cumbersome) let keyword, as in let x = 0; The (cumbersome) do keyword, as in do reduce(); No operator priority: * 3 yields 9, since expressions are evaluated left-to-right; To effect the commonly expected result, use 1 + (2 * 3) Only three primitive data types: int, boolean, char; In fact, each one of them is treated as a 16-bit value No casting; a value of any type can be assigned to a variable of any type Array declaration: Array x; followed by x = Array.new(); Static methods are called Constructor methods are called constructor; Invoking a constructor is done using the syntax ClassName.new(argsList) Q: Why did we introduce these features into the Jack language? A: To make the writing of the Jack compiler easy! Any one of these language features can be modified, with a reasonable amount of work, to make them conform to a more typical Java-like syntax. Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 25
26 Jack program structure class class ClassName { field fieldvariable declarations; static staticvariable declarations; constructor type type { parameterlist ) { local local variable declarations; statements method method type type { parameterlist ) { local local variable declarations; statements type type { parameterlist ) { local local variable declarations; statements About this spec: Every part in this spec can apper 0 or more times The order of the field / static declarations is arbitrary The order of the subroutine declarations is arbitrary Each type is either int, boolean, char, or a class name. A Jack program: Each class is written in a separate file (compilation unit) Jack program = collection of one or more classes, one of which must be named Main The Main class must contain at least one method, named main() Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 26
27 Jack standard library aka language extensions aka Jack OS class class Math Math { void void init() init() Class Class String String int int abs(int { abs(int x) x) constructor int int multiply(int String String new(int new(int x, x, int maxlength) int y) y) method Class method Class Array int void Array { int void divide(int dispose() dispose() x, x, int int y) y) method method int int int int min(int length() min(int Array Array length() x, x, new(int new(int y) y) size) method class size) method class int char Output int char max(int Output charat(int { max(int x, x, int y) j) y) j) method method method method int void int void void sqrt(int void setcharat(int dispose() void sqrt(int dispose() void movecursor(int x) j, x) j, char char c) i, c) i, int int j) j) method method String Class String Class Screen appendchar(char Screen void void printchar(char { c) c) c) c) method method void void eraselastchar() void void void void printstring(string clearscreen() s) s) method method int class int class Memory intvalue() void Memory void void void printint(int setcolor(boolean { i) b) i) b) method method void void setint(int void void void void println() drawpixel(int println() j) x, x, int int y) peek(int peek(int address) y) j) Class address) char char backspace() void Class void Keyboard void void backspace() Keyboard drawline(int { x1, x1, int int y1, y1, void void poke(int poke(int x2, address, x2, address, int int y2) y2) int int value) value) char char doublequote() char void void drawrectangle(int char keypressed() Class x1, x1, int int y1, y1, char char newline() Class Sys int newline() Array Sys { Array alloc(int alloc(int size) int size) x2, x2, int int y2) char char readchar() y2) void void drawcircle(int x, x, int int y, y, int int r) void r) void void dealloc(array void halt(): halt(): o) o) String String readline(string message) message) void void error(int error(int errorcode) int int readint(string message) message) void void wait(int wait(int duration) duration) Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 27
28 Perspective Jack is an object-based language: no inheritance Primitive type system Standard library Our hidden agenda: gearing up to learn how to develop the... Compiler (projects 10 and 11) OS (project 12). Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 28
Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.
Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java
More informationCompiler I: Syntax Analysis Human Thought
Course map Compiler I: Syntax Analysis Human Thought Abstract design Chapters 9, 12 H.L. Language & Operating Sys. Compiler Chapters 10-11 Virtual Machine Software hierarchy Translator Chapters 7-8 Assembly
More informationMoving from CS 61A Scheme to CS 61B Java
Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you
More informationThe C Programming Language course syllabus associate level
TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming
More informationCSCI 3136 Principles of Programming Languages
CSCI 3136 Principles of Programming Languages Faculty of Computer Science Dalhousie University Winter 2013 CSCI 3136 Principles of Programming Languages Faculty of Computer Science Dalhousie University
More informationCS 106 Introduction to Computer Science I
CS 106 Introduction to Computer Science I 01 / 21 / 2014 Instructor: Michael Eckmann Today s Topics Introduction Homework assignment Review the syllabus Review the policies on academic dishonesty and improper
More informationFundamentals of Programming and Software Development Lesson Objectives
Lesson Unit 1: INTRODUCTION TO COMPUTERS Computer History Create a timeline illustrating the most significant contributions to computing technology Describe the history and evolution of the computer Identify
More informationChapter 7D The Java Virtual Machine
This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly
More informationThe programming language C. sws1 1
The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan
More informationSources: On the Web: Slides will be available on:
C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,
More informationEmbedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C
Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection
More informationGlossary of Object Oriented Terms
Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction
More information7. Virtual Machine I: Stack Arithmetic 1
Chapter 7: Virtual Machine I 99 7. Virtual Machine I: Stack Arithmetic 1 Programmers are creators of universes for which they alone are responsible. Universes of virtually unlimited complexity can be created
More informationCourse Title: Software Development
Course Title: Software Development Unit: Customer Service Content Standard(s) and Depth of 1. Analyze customer software needs and system requirements to design an information technology-based project plan.
More informationFundamentals of Java Programming
Fundamentals of Java Programming This document is exclusive property of Cisco Systems, Inc. Permission is granted to print and copy this document for non-commercial distribution and exclusive use by instructors
More informationChapter 2: Elements of Java
Chapter 2: Elements of Java Basic components of a Java program Primitive data types Arithmetic expressions Type casting. The String type (introduction) Basic I/O statements Importing packages. 1 Introduction
More informationMcGraw-Hill The McGraw-Hill Companies, Inc., 20 1. 01 0
1.1 McGraw-Hill The McGraw-Hill Companies, Inc., 2000 Objectives: To describe the evolution of programming languages from machine language to high-level languages. To understand how a program in a high-level
More informationHigh-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)
High-Level Programming Languages Nell Dale & John Lewis (adaptation by Michael Goldwasser) Low-Level Languages What are disadvantages of low-level languages? (e.g., machine code or assembly code) Programming
More informationComputer Programming I
Computer Programming I COP 2210 Syllabus Spring Semester 2012 Instructor: Greg Shaw Office: ECS 313 (Engineering and Computer Science Bldg) Office Hours: Tuesday: 2:50 4:50, 7:45 8:30 Thursday: 2:50 4:50,
More informationKITES TECHNOLOGY COURSE MODULE (C, C++, DS)
KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php info@kitestechnology.com technologykites@gmail.com Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL
More informationChapter 6: Programming Languages
Chapter 6: Programming Languages Computer Science: An Overview Eleventh Edition by J. Glenn Brookshear Copyright 2012 Pearson Education, Inc. Chapter 6: Programming Languages 6.1 Historical Perspective
More informationThomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation
Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science updated 03/08/2012 Unit 1: JKarel 8 weeks http://www.fcps.edu/is/pos/documents/hs/compsci.htm
More informationHabanero Extreme Scale Software Research Project
Habanero Extreme Scale Software Research Project Comp215: Java Method Dispatch Zoran Budimlić (Rice University) Always remember that you are absolutely unique. Just like everyone else. - Margaret Mead
More informationD06 PROGRAMMING with JAVA. Ch3 Implementing Classes
Cicles Formatius de Grau Superior Desenvolupament d Aplicacions Informàtiques D06 PROGRAMMING with JAVA Ch3 Implementing Classes PowerPoint presentation, created by Angel A. Juan - ajuanp(@)gmail.com,
More informationLecture 1: Introduction
Programming Languages Lecture 1: Introduction Benjamin J. Keller Department of Computer Science, Virginia Tech Programming Languages Lecture 1 Introduction 2 Lecture Outline Preview History of Programming
More informationCrash Course in Java
Crash Course in Java Based on notes from D. Hollinger Based in part on notes from J.J. Johns also: Java in a Nutshell Java Network Programming and Distributed Computing Netprog 2002 Java Intro 1 What is
More informationInformatica e Sistemi in Tempo Reale
Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)
More informationJava Programming Fundamentals
Lecture 1 Part I Java Programming Fundamentals Topics in Quantitative Finance: Numerical Solutions of Partial Differential Equations Instructor: Iraj Kani Introduction to Java We start by making a few
More informationExample of a Java program
Example of a Java program class SomeNumbers static int square (int x) return x*x; public static void main (String[] args) int n=20; if (args.length > 0) // change default n = Integer.parseInt(args[0]);
More informationName: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.
Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to
More informationCS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013
Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)
More informationThe Cool Reference Manual
The Cool Reference Manual Contents 1 Introduction 3 2 Getting Started 3 3 Classes 4 3.1 Features.............................................. 4 3.2 Inheritance............................................
More informationTopics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives
Introduction to Programming and Algorithms Module 1 CS 146 Sam Houston State University Dr. Tim McGuire Module Objectives To understand: the necessity of programming, differences between hardware and software,
More informationJ a v a Quiz (Unit 3, Test 0 Practice)
Computer Science S-111a: Intensive Introduction to Computer Science Using Java Handout #11 Your Name Teaching Fellow J a v a Quiz (Unit 3, Test 0 Practice) Multiple-choice questions are worth 2 points
More informationINTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011
INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011 1 Goals of the Lecture Present an introduction to Objective-C 2.0 Coverage of the language will be INCOMPLETE
More informationIntroduction to Java Applications. 2005 Pearson Education, Inc. All rights reserved.
1 2 Introduction to Java Applications 2.2 First Program in Java: Printing a Line of Text 2 Application Executes when you use the java command to launch the Java Virtual Machine (JVM) Sample program Displays
More information1.1 WHAT IS A PROGRAMMING LANGUAGE?
1 INTRODUCTION 1.1 What is a Programming Language? 1.2 Abstractions in Programming Languages 1.3 Computational Paradigms 1.4 Language Definition 1.5 Language Translation 1.6 Language Design How we communicate
More informationThe Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1
The Java Series Java Essentials I What is Java? Basic Language Constructs Slide 1 What is Java? A general purpose Object Oriented programming language. Created by Sun Microsystems. It s a general purpose
More informationCSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals
CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals 1 Recall From Last Time: Java Program import java.util.scanner; public class EggBasket { public static void main(string[]
More informationStorage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas
CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage
More informationCS 111 Classes I 1. Software Organization View to this point:
CS 111 Classes I 1 Software Organization View to this point: Data Objects and primitive types Primitive types operators (+, /,,*, %). int, float, double, char, boolean Memory location holds the data Objects
More informationPROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON
PROBLEM SOLVING WITH SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON Addison Wesley Boston San Francisco New York London
More informationJava CPD (I) Frans Coenen Department of Computer Science
Java CPD (I) Frans Coenen Department of Computer Science Content Session 1, 12:45-14:30 (First Java Programme, Inheritance, Arithmetic) Session 2, 14:45-16:45 (Input and Programme Constructs) Materials
More informationPemrograman Dasar. Basic Elements Of Java
Pemrograman Dasar Basic Elements Of Java Compiling and Running a Java Application 2 Portable Java Application 3 Java Platform Platform: hardware or software environment in which a program runs. Oracle
More informationDebugging. Common Semantic Errors ESE112. Java Library. It is highly unlikely that you will write code that will work on the first go
Debugging ESE112 Java Programming: API, Psuedo-Code, Scope It is highly unlikely that you will write code that will work on the first go Bugs or errors Syntax Fixable if you learn to read compiler error
More informationRARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science
I. Basic Course Information RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE CISY 105 Foundations of Computer Science A. Course Number and Title: CISY-105, Foundations of Computer Science B. New
More informationVariables, Constants, and Data Types
Variables, Constants, and Data Types Primitive Data Types Variables, Initialization, and Assignment Constants Characters Strings Reading for this class: L&L, 2.1-2.3, App C 1 Primitive Data There are eight
More informationIntroduction to Java
Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high
More informationEl Dorado Union High School District Educational Services
El Dorado Union High School District Course of Study Information Page Course Title: ACE Computer Programming II (#495) Rationale: A continuum of courses, including advanced classes in technology is needed.
More informationC++ Programming Language
C++ Programming Language Lecturer: Yuri Nefedov 7th and 8th semesters Lectures: 34 hours (7th semester); 32 hours (8th semester). Seminars: 34 hours (7th semester); 32 hours (8th semester). Course abstract
More informationCourse Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies)
Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies) Duration of Course: 6 Months Fees: Rs. 25,000/- (including Service Tax) Eligibility: B.E./B.Tech., M.Sc.(IT/ computer
More informationCompiler Construction
Compiler Construction Lecture 1 - An Overview 2003 Robert M. Siegfried All rights reserved A few basic definitions Translate - v, a.to turn into one s own language or another. b. to transform or turn from
More informationChapter 15 Functional Programming Languages
Chapter 15 Functional Programming Languages Introduction - The design of the imperative languages is based directly on the von Neumann architecture Efficiency (at least at first) is the primary concern,
More informationCompilers. Introduction to Compilers. Lecture 1. Spring term. Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam.
Compilers Spring term Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam.es Lecture 1 to Compilers 1 Topic 1: What is a Compiler? 3 What is a Compiler? A compiler is a computer
More information7.1 Our Current Model
Chapter 7 The Stack In this chapter we examine what is arguably the most important abstract data type in computer science, the stack. We will see that the stack ADT and its implementation are very simple.
More informationJava Interview Questions and Answers
1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java
More informationSemester Review. CSC 301, Fall 2015
Semester Review CSC 301, Fall 2015 Programming Language Classes There are many different programming language classes, but four classes or paradigms stand out:! Imperative Languages! assignment and iteration!
More informationSyllabus for CS 134 Java Programming
- Java Programming Syllabus Page 1 Syllabus for CS 134 Java Programming Computer Science Course Catalog 2000-2001: This course is an introduction to objectoriented programming using the Java language.
More informationAP Computer Science Java Subset
APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall
More informationAn Incomplete C++ Primer. University of Wyoming MA 5310
An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages
More informationADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science
ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science Program Schedule CTech Computer Science Credits CS101 Computer Science I 3 MATH100 Foundations of Mathematics and
More informationMistakes are the portals of discovery. James Joyce (1882 1941)
Appendix B: Test Scripting Language Mistakes are the portals of discovery. James Joyce (1882 1941) Testing is a critically important element of systems development, and one that typically gets little attention
More informationCS1020 Data Structures and Algorithms I Lecture Note #1. Introduction to Java
CS1020 Data Structures and Algorithms I Lecture Note #1 Introduction to Java Objectives Java Basic Java features C Java Translate C programs in CS1010 into Java programs 2 References Chapter 1 Section
More informationPART-A Questions. 2. How does an enumerated statement differ from a typedef statement?
1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members
More informationC Compiler Targeting the Java Virtual Machine
C Compiler Targeting the Java Virtual Machine Jack Pien Senior Honors Thesis (Advisor: Javed A. Aslam) Dartmouth College Computer Science Technical Report PCS-TR98-334 May 30, 1998 Abstract One of the
More informationJava Basics: Data Types, Variables, and Loops
Java Basics: Data Types, Variables, and Loops If debugging is the process of removing software bugs, then programming must be the process of putting them in. - Edsger Dijkstra Plan for the Day Variables
More information6.1. Example: A Tip Calculator 6-1
Chapter 6. Transition to Java Not all programming languages are created equal. Each is designed by its creator to achieve a particular purpose, which can range from highly focused languages designed for
More informationJava Crash Course Part I
Java Crash Course Part I School of Business and Economics Institute of Information Systems HU-Berlin WS 2005 Sebastian Kolbe skolbe@wiwi.hu-berlin.de Overview (Short) introduction to the environment Linux
More informationClasses and Objects in Java Constructors. In creating objects of the type Fraction, we have used statements similar to the following:
In creating objects of the type, we have used statements similar to the following: f = new (); The parentheses in the expression () makes it look like a method, yet we never created such a method in our
More informationHow To Write Portable Programs In C
Writing Portable Programs COS 217 1 Goals of Today s Class Writing portable programs in C Sources of heterogeneity Data types, evaluation order, byte order, char set, Reading period and final exam Important
More informationChapter 13: Program Development and Programming Languages
15 th Edition Understanding Computers Today and Tomorrow Comprehensive Chapter 13: Program Development and Programming Languages Deborah Morley Charles S. Parker Copyright 2015 Cengage Learning Learning
More informationCompiling Object Oriented Languages. What is an Object-Oriented Programming Language? Implementation: Dynamic Binding
Compiling Object Oriented Languages What is an Object-Oriented Programming Language? Last time Dynamic compilation Today Introduction to compiling object oriented languages What are the issues? Objects
More informationLecture 1 Introduction to Android
These slides are by Dr. Jaerock Kwon at. The original URL is http://kettering.jrkwon.com/sites/default/files/2011-2/ce-491/lecture/alecture-01.pdf so please use that instead of pointing to this local copy
More informationIntegrating Formal Models into the Programming Languages Course
Integrating Formal Models into the Programming Languages Course Allen B. Tucker Robert E. Noonan Computer Science Department Computer Science Department Bowdoin College College of William and Mary Brunswick,
More informationProgramming Languages CIS 443
Course Objectives Programming Languages CIS 443 0.1 Lexical analysis Syntax Semantics Functional programming Variable lifetime and scoping Parameter passing Object-oriented programming Continuations Exception
More informationMULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.
Exam Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) The JDK command to compile a class in the file Test.java is A) java Test.java B) java
More informationComputing Concepts with Java Essentials
2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Computing Concepts with Java Essentials 3rd Edition Cay Horstmann
More informationStack Allocation. Run-Time Data Structures. Static Structures
Run-Time Data Structures Stack Allocation Static Structures For static structures, a fixed address is used throughout execution. This is the oldest and simplest memory organization. In current compilers,
More informationFirst Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science
First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca
More informationCS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08
CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 20: Stack Frames 7 March 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Where We Are Source code if (b == 0) a = b; Low-level IR code
More informationOKLAHOMA SUBJECT AREA TESTS (OSAT )
CERTIFICATION EXAMINATIONS FOR OKLAHOMA EDUCATORS (CEOE ) OKLAHOMA SUBJECT AREA TESTS (OSAT ) FIELD 081: COMPUTER SCIENCE September 2008 Subarea Range of Competencies I. Computer Use in Educational Environments
More informationComputers. An Introduction to Programming with Python. Programming Languages. Programs and Programming. CCHSG Visit June 2014. Dr.-Ing.
Computers An Introduction to Programming with Python CCHSG Visit June 2014 Dr.-Ing. Norbert Völker Many computing devices are embedded Can you think of computers/ computing devices you may have in your
More information#820 Computer Programming 1A
Computer Programming I Levels: 10-12 Units of Credit: 1.0 CIP Code: 11.0201 Core Code: 35-02-00-00-030 Prerequisites: Secondary Math I, Keyboarding Proficiency, Computer Literacy requirement Semester 1
More informationFree Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program
Free Java textbook available online "Thinking in Java" by Bruce Eckel, 4th edition, 2006, ISBN 0131872486, Pearson Education Introduction to the Java programming language CS 4354 Summer II 2015 The third
More informationLecture 5: Java Fundamentals III
Lecture 5: Java Fundamentals III School of Science and Technology The University of New England Trimester 2 2015 Lecture 5: Java Fundamentals III - Operators Reading: Finish reading Chapter 2 of the 2nd
More informationInstall Java Development Kit (JDK) 1.8 http://www.oracle.com/technetwork/java/javase/downloads/index.html
CS 259: Data Structures with Java Hello World with the IntelliJ IDE Instructor: Joel Castellanos e-mail: joel.unm.edu Web: http://cs.unm.edu/~joel/ Office: Farris Engineering Center 319 8/19/2015 Install
More informationA single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc
Other architectures Example. Accumulator-based machines A single register, called the accumulator, stores the operand before the operation, and stores the result after the operation. Load x # into acc
More informationFree Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program
Free Java textbook available online "Thinking in Java" by Bruce Eckel, 4th edition, 2006, ISBN 0131872486, Pearson Education Introduction to the Java programming language CS 4354 Summer II 2014 Jill Seaman
More informationAn Introduction to Assembly Programming with the ARM 32-bit Processor Family
An Introduction to Assembly Programming with the ARM 32-bit Processor Family G. Agosta Politecnico di Milano December 3, 2011 Contents 1 Introduction 1 1.1 Prerequisites............................. 2
More informationObject Oriented Software Design
Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 28, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction
More informationProgramming by Contract. Programming by Contract: Motivation. Programming by Contract: Preconditions and Postconditions
COMP209 Object Oriented Programming Designing Classes 2 Mark Hall Programming by Contract (adapted from slides by Mark Utting) Preconditions Postconditions Class invariants Programming by Contract An agreement
More informationJava Programming. Binnur Kurt binnur.kurt@ieee.org. Istanbul Technical University Computer Engineering Department. Java Programming. Version 0.0.
Java Programming Binnur Kurt binnur.kurt@ieee.org Istanbul Technical University Computer Engineering Department Java Programming 1 Version 0.0.4 About the Lecturer BSc İTÜ, Computer Engineering Department,
More informationChapter One Introduction to Programming
Chapter One Introduction to Programming 1-1 Algorithm and Flowchart Algorithm is a step-by-step procedure for calculation. More precisely, algorithm is an effective method expressed as a finite list of
More informationBasic Java Constructs and Data Types Nuts and Bolts. Looking into Specific Differences and Enhancements in Java compared to C
Basic Java Constructs and Data Types Nuts and Bolts Looking into Specific Differences and Enhancements in Java compared to C 1 Contents Hello World Program Statements Explained Java Program Structure in
More informationBachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)
Unit- I Introduction to c Language: C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating
More informationCSE 373: Data Structure & Algorithms Lecture 25: Programming Languages. Nicki Dell Spring 2014
CSE 373: Data Structure & Algorithms Lecture 25: Programming Languages Nicki Dell Spring 2014 What is a Programming Language? A set of symbols and associated tools that translate (if necessary) collections
More information1 The Java Virtual Machine
1 The Java Virtual Machine About the Spec Format This document describes the Java virtual machine and the instruction set. In this introduction, each component of the machine is briefly described. This
More informationSemantic Analysis: Types and Type Checking
Semantic Analysis Semantic Analysis: Types and Type Checking CS 471 October 10, 2007 Source code Lexical Analysis tokens Syntactic Analysis AST Semantic Analysis AST Intermediate Code Gen lexical errors
More informationObject Oriented Software Design
Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction
More information