Vacation!

Size: px
Start display at page:

Download "Vacation!"

Transcription

1 Objects no really

2 Vacation!

3

4 Context

5 nand2tetris

6

7

8

9

10 Registers and RAM

11

12 Hardware Chips

13 Assembler Hardware Chips

14 Virtual Machine Assembler Hardware Chips

15 Operating System Virtual Machine Assembler Hardware Chips

16 Compiler Operating System Virtual Machine Assembler Hardware Chips

17

18 nand2tetris.org

19 Compiler Operating System Virtual Machine Assembler Hardware Chips

20 Virtual Machine

21 VM Bytecode Math/Logic Memory

22 MATH/LOGIC add sub MEMORY push segment index pop segment index neg eq gt lt and or not

23 Math/Logic Example: add

24 Math/Logic Example: add STACK 40 2

25 Math/Logic Example: add

26 Math/Logic Example: add STACK 42

27 push/pop setup the stack

28 Code

29 module VM class Command def self.token(new_token = = new_token unless

30 module VM class Command def self.token(new_token = = new_token unless

31 module VM class Command def self.token(new_token = = new_token unless

32 module VM class Command def self.token(new_token = = new_token unless new_token.nil? require_relative module VM class MemoryAccessCommand < Command def self.parse(tokens) def initialize(segment, = = index attr_reader :segment, :index

33 module VM class Command def self.token(new_token = = new_token unless new_token.nil? require_relative module VM class MemoryAccessCommand < Command def self.parse(tokens) def initialize(segment, = = index attr_reader :segment, :index

34 module VM class Command def self.token(new_token = = new_token unless new_token.nil? require_relative module VM class MemoryAccessCommand < Command def self.parse(tokens) def initialize(segment, = = index attr_reader :segment, :index

35 module VM class Command def self.token(new_token = = new_token unless new_token.nil? require_relative module VM class MemoryAccessCommand < Command def self.parse(tokens) require_relative "memory_access_command" def initialize(segment, = segment module = index class PushCommand < MemoryAccessCommand token "push" attr_reader :segment, :index

36 module VM class Command def self.token(new_token = = new_token unless new_token.nil? require_relative module VM class MemoryAccessCommand < Command def self.parse(tokens) require_relative "memory_access_command" def initialize(segment, = segment module = index class PushCommand < MemoryAccessCommand token "push" attr_reader :segment, :index

37 require_relative "command" module VM class MemoryAccessCommand < Command def write_to(runtime) case segment when "constant" runtime.s(self.class.token, index, "A") when argument" when local" when static" when this" when that" when pointer" when temp"

38 require_relative "command" module VM class MemoryAccessCommand < Command def write_to(runtime) case segment when "constant" runtime.s(self.class.token, index, "A") when argument" when local" when static" when this" when that" when pointer" when temp"

39 module VM class Command def self.token(new_token = = new_token unless

40 module VM class Command require_relative def self.token(new_token "command" = = new_token unless module VM class ArithmeticOrLogicCommand < Command def self.parse(tokens) def self.binary(new_binary = = new_binary unless def self.operator(new_operator = = new_operator unless

41 module VM class Command require_relative def self.token(new_token "command" = = new_token unless module VM class ArithmeticOrLogicCommand < Command def self.parse(tokens) def self.binary(new_binary = = new_binary unless def self.operator(new_operator = = new_operator unless

42 module VM class Command require_relative def self.token(new_token "command" = = new_token unless module VM class ArithmeticOrLogicCommand < Command def self.parse(tokens) def self.binary(new_binary = = new_binary unless def self.operator(new_operator = = new_operator unless

43 module VM class Command require_relative def self.token(new_token "command" = = new_token unless new_token.nil? VM class ArithmeticOrLogicCommand < Command def self.parse(tokens) require_relative "arithmetic_or_logic_command" module VM class AddCommand < ArithmeticOrLogicCommand def self.binary(new_binary = nil) token = new_binary unless new_binary.nil? binary operator :+ def self.operator(new_operator = = new_operator unless

44 module VM class Command require_relative def self.token(new_token "command" = = new_token unless new_token.nil? VM class ArithmeticOrLogicCommand < Command def self.parse(tokens) require_relative "arithmetic_or_logic_command" module VM class AddCommand < ArithmeticOrLogicCommand def self.binary(new_binary = nil) token = new_binary unless new_binary.nil? binary operator :+ require_relative "arithmetic_or_logic_command" def self.operator(new_operator = nil) VM = new_operator unless new_operator.nil? NegCommand < ArithmeticOrLogicCommand token "neg" binary false operator :-

45 require_relative "command" module VM class ArithmeticOrLogicCommand < Command def write_to(runtime) if self.class.binary write_binary_to(runtime) else write_unary_to(runtime)

46 require_relative "command" module VM class ArithmeticOrLogicCommand < Command def write_to(runtime) if self.class.binary write_binary_to(runtime) else write_unary_to(runtime)

47 require_relative "command" module VM class ArithmeticOrLogicCommand < Command require_relative "command" module def VMwrite_to(runtime) class if ArithmeticOrLogicCommand self.class.binary < Command write_binary_to(runtime) else private write_unary_to(runtime) def write_binary_to(runtime) runtime.pop(:right) runtime.pop(:left) # runtime.binary_op(:left,... self.class.operator, :right, :result) runtime.push(:result) def write_unary_to(runtime) runtime.pop(:result) runtime.unary_op(self.class.operator, :result, :result) runtime.push(:result)

48 require_relative "command" module VM class ArithmeticOrLogicCommand < Command require_relative "command" module def VMwrite_to(runtime) class if ArithmeticOrLogicCommand self.class.binary < Command write_binary_to(runtime) else private write_unary_to(runtime) def write_binary_to(runtime) runtime.pop(:right) runtime.pop(:left) # runtime.binary_op(:left,... self.class.operator, :right, :result) runtime.push(:result) def write_unary_to(runtime) runtime.pop(:result) runtime.unary_op(self.class.operator, :result, :result) runtime.push(:result)

49 Do we like it?

50

51 But is it typical?

52 require_relative "arithmetic_or_logic_command" module VM class AddCommand < ArithmeticOrLogicCommand token "add" binary true operator :+

53 require_relative "arithmetic_or_logic_command" module VM class AddCommand < ArithmeticOrLogicCommand token "add" binary true operator :+

54 require_relative "arithmetic_or_logic_command" module VM class AddCommand < ArithmeticOrLogicCommand token "add" binary true operator :+

55 require_relative "command" module VM class ArithmeticOrLogicCommand < Command def write_to(runtime) if self.class.binary write_binary_to(runtime) else write_unary_to(runtime)

56 require_relative "command" module VM class ArithmeticOrLogicCommand < Command def write_to(runtime) if self.class.binary write_binary_to(runtime) else write_unary_to(runtime)

57 require_relative "command" module VM class ArithmeticOrLogicCommand < Command require_relative "command" module def VMwrite_to(runtime) class if ArithmeticOrLogicCommand self.class.binary < Command write_binary_to(runtime) else private write_unary_to(runtime) def write_binary_to(runtime) runtime.pop(:right) runtime.pop(:left) # runtime.binary_op(:left,... self.class.operator, :right, :result) runtime.push(:result) def write_unary_to(runtime) runtime.pop(:result) runtime.unary_op(self.class.operator, :result, :result) runtime.push(:result)

58 require_relative "command" module VM class ArithmeticOrLogicCommand < Command require_relative "command" module def VMwrite_to(runtime) class if ArithmeticOrLogicCommand self.class.binary < Command write_binary_to(runtime) else private write_unary_to(runtime) def write_binary_to(runtime) runtime.pop(:right) runtime.pop(:left) # runtime.binary_op(:left,... self.class.operator, :right, :result) runtime.push(:result) def write_unary_to(runtime) runtime.pop(:result) runtime.unary_op(self.class.operator, :result, :result) runtime.push(:result)

59 $ ls lib/vm/*command.rb lib/vm/add_command.rb lib/vm/memory_access_command.rb lib/vm/and_command.rb lib/vm/neg_command.rb lib/vm/arithmetic_or_logic_command.rb lib/vm/not_command.rb lib/vm/command.rb lib/vm/or_command.rb lib/vm/eq_command.rb lib/vm/pop_command.rb lib/vm/gt_command.rb lib/vm/push_command.rb lib/vm/lt_command.rb lib/vm/sub_command.rb

60 Inheritance is not for sharing code. Sandi Metz

61 One Parent Class

62 One Axis of Change

63 Mix-ins Don t Change This

64 Inheritance is not for sharing code. Sandi Metz

65 MATH/LOGIC add sub MEMORY push segment index pop segment index neg eq gt lt and or not

66 UNARY BINARY OPERATOR CONDITIONAL STACK neg add add eq push not sub sub lt pop and neg gt or and or not

67 A Magic Trick

68 UNARY BINARY OPERATOR CONDITIONAL STACK neg add add eq push not sub sub lt pop and neg gt or and or not

69 module VM class Operator def = operator attr_reader :operator private :operator def write_to(runtime, options = { }) left = options[:has_left]? :left : nil runtime.operation(left, operator, :right, :result)

70 module VM class Operator def = operator attr_reader :operator private :operator def write_to(runtime, options = { }) left = options[:has_left]? :left : nil runtime.operation(left, operator, :right, :result)

71 module VM class Operator def = operator attr_reader :operator private :operator def write_to(runtime, options = { }) left = options[:has_left]? :left : nil runtime.operation(left, operator, :right, :result)

72 module VM class BinaryOperation def = operator attr_reader :operator private :operator def write_to(runtime, options = { }) runtime.pop(:right) runtime.pop(:left) operator.write_to(runtime, has_left: true) runtime.push(:result)

73 module VM class BinaryOperation def = operator attr_reader :operator private :operator def write_to(runtime, options = { }) runtime.pop(:right) runtime.pop(:left) operator.write_to(runtime, has_left: true) runtime.push(:result)

74 module VM class UnaryOperation def = operator attr_reader :operator private :operator def write_to(runtime, options = { }) runtime.pop(:right) operator.write_to(runtime, has_left: false) runtime.push(:result)

75 module VM class UnaryOperation def = operator attr_reader :operator private :operator def write_to(runtime, options = { }) runtime.pop(:right) operator.write_to(runtime, has_left: false) runtime.push(:result)

76 module VM class StackManipulation def write_to(runtime, options = { }) case options[:params][:segment] when "constant" runtime.s(options[:command], options[:params][:index], "A") when "argument" when "local" when "static" when "this" when "that" when "pointer" when "temp"

77 module VM class Conditional def = test attr_reader :test private :test def write_to(runtime, options = { }) runtime.pop(:right) runtime.pop(:left) runtime.operation(:left, :-, :right, :condition) runtime.jump(:condition, test)

78 module VM class Conditional def = test attr_reader :test private :test def write_to(runtime, options = { }) runtime.pop(:right) runtime.pop(:left) runtime.operation(:left, :-, :right, :condition) runtime.jump(:condition, test)

79 module VM class Conditional def = test attr_reader :test private :test def write_to(runtime, options = { }) runtime.pop(:right) runtime.pop(:left) runtime.operation(:left, :-, :right, :condition) runtime.jump(:condition, test)

80 module VM class Command def initialize(name:, params: { }, operations: = = = operations attr_reader :name attr_reader :params, :operations private :params, :operations

81 module VM class Command def initialize(name:, params: { }, operations: = = = operations attr_reader :name attr_reader :params, :operations private :params, :operations

82 module VM class Command def initialize(name:, params: { }, operations: ) module = name class = = operations def parse(tokens) attr_reader :name attr_reader :params, :operations def write_to(runtime, options = { }) private :params, :operations operations.write_to( runtime, command: name, params: options[:params] )

83 module VM class Command def initialize(name:, params: { }, operations: ) module = name class = = operations def parse(tokens) attr_reader :name attr_reader :params, :operations def write_to(runtime, options = { }) private :params, :operations operations.write_to( runtime, command: name, params: options[:params] )

84 module VM class Command def initialize(name:, params: { }, operations: ) module = name class = = operations def parse(tokens) attr_reader :name attr_reader :params, :operations def write_to(runtime, options = { }) private :params, :operations operations.write_to( runtime, command: name, params: options[:params] )

85 module VM ] COMMANDS = [ Command.new( name: "add", operations: BinaryOperation.new(Operator.new(:+)) ), Command.new( name: "sub", operations: BinaryOperation.new(Operator.new(:-)) ), Command.new( name: "neg", operations: UnaryOperation.new(Operator.new(:-)) ),

86 module VM ] COMMANDS = [ Command.new( name: "add", operations: BinaryOperation.new(Operator.new(:+)) ), Command.new( name: "sub", operations: BinaryOperation.new(Operator.new(:-)) ), Command.new( name: "neg", operations: UnaryOperation.new(Operator.new(:-)) ),

87 module VM ] COMMANDS = [ Command.new( name: "eq", operations: Conditional.new(:EQ) ), Command.new( name: "lt", operations: Conditional.new(:LT) ), Command.new( name: "gt", operations: Conditional.new(:GT) ),

88 module VM ] COMMANDS = [ Command.new( name: "and", operations: BinaryOperation.new(Operator.new(:&)) ), Command.new( name: "or", operations: BinaryOperation.new(Operator.new(: )) ), Command.new( name: "not", operations: UnaryOperation.new(Operator.new(:!)) ),

89 module VM SEGMENTS = %w[argument local static constant this that pointer temp] ] COMMANDS = [ Command.new( name: "push", params: { segment: ->(arg) { SEGMENTS.include?(arg) }, index: /\A\d+\z/ }, operations: StackManipulation.new ), Command.new( name: "pop", params: { segment: ->(arg) { SEGMENTS.include?(arg) }, index: /\A\d+\z/ }, operations: StackManipulation.new ), FailedParseCommand.new

90 module VM SEGMENTS = %w[argument local static constant this that pointer temp] ] COMMANDS = [ Command.new( name: "push", params: { segment: ->(arg) { SEGMENTS.include?(arg) }, index: /\A\d+\z/ }, operations: StackManipulation.new ), Command.new( name: "pop", params: { segment: ->(arg) { SEGMENTS.include?(arg) }, index: /\A\d+\z/ }, operations: StackManipulation.new ), FailedParseCommand.new

91 module VM SEGMENTS = %w[argument local static constant this that pointer temp] ] COMMANDS = [ Command.new( name: "push", params: { segment: ->(arg) { SEGMENTS.include?(arg) }, index: /\A\d+\z/ }, operations: StackManipulation.new ), Command.new( name: "pop", params: { segment: ->(arg) { SEGMENTS.include?(arg) }, index: /\A\d+\z/ }, operations: StackManipulation.new ), FailedParseCommand.new

92 $ ls lib/vm/*command.rb lib/vm/add_command.rb lib/vm/memory_access_command.rb lib/vm/and_command.rb lib/vm/neg_command.rb lib/vm/arithmetic_or_logic_command.rb lib/vm/not_command.rb lib/vm/command.rb lib/vm/or_command.rb lib/vm/eq_command.rb lib/vm/pop_command.rb lib/vm/gt_command.rb lib/vm/push_command.rb lib/vm/lt_command.rb lib/vm/sub_command.rb

93 $ ls lib/vm/*command.rb lib/vm/add_command.rb lib/vm/memory_access_command.rb lib/vm/and_command.rb lib/vm/neg_command.rb lib/vm/arithmetic_or_logic_command.rb lib/vm/not_command.rb lib/vm/command.rb lib/vm/or_command.rb lib/vm/eq_command.rb lib/vm/pop_command.rb lib/vm/gt_command.rb lib/vm/push_command.rb lib/vm/lt_command.rb lib/vm/sub_command.rb

94 A Magic Trick

95 A Magic Trick

96 A Magic Trick

97 Object-oriented Programming

98 Lesson Learned

99 Solve Problems With the Simplest Tool You Can

100 Simple OO Can Often Be That Tool

101 Thanks

102 Questions?

Virtual Machine. Part II: Program Control. Building a Modern Computer From First Principles.

Virtual Machine. Part II: Program Control. Building a Modern Computer From First Principles. Virtual Machine Part II: Program Control Building a Modern Computer From First Principles www.nand2tetris.org Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 8:

More information

Parsing Scheme (+ (* 2 3) 1) * 1

Parsing Scheme (+ (* 2 3) 1) * 1 Parsing Scheme + (+ (* 2 3) 1) * 1 2 3 Compiling Scheme frame + frame halt * 1 3 2 3 2 refer 1 apply * refer apply + Compiling Scheme make-return START make-test make-close make-assign make- pair? yes

More information

Virtual Machine. Part I: Stack Arithmetic. Building a Modern Computer From First Principles.

Virtual Machine. Part I: Stack Arithmetic. Building a Modern Computer From First Principles. Virtual Machine Part I: Stack Arithmetic Building a Modern Computer From First Principles www.nand2tetris.org Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 7:

More information

Motivation. Compiler. Our ultimate goal: Hack code. Jack code (example) Translate high-level programs into executable code. return; } } return

Motivation. Compiler. Our ultimate goal: Hack code. Jack code (example) Translate high-level programs into executable code. return; } } return Motivation Jack code (example) class class Main Main { { static static int int x; x; function function void void main() main() { { Inputs Inputs and and multiplies multiplies two two numbers numbers var

More information

Virtual Machine Where we are at: Part I: Stack Arithmetic. Motivation. Compilation models. direct compilation:... 2-tier compilation:

Virtual Machine Where we are at: Part I: Stack Arithmetic. Motivation. Compilation models. direct compilation:... 2-tier compilation: Where we are at: Virtual Machine Part I: Stack Arithmetic Human Thought Abstract design Chapters 9, 12 H.L. Language & Operating Sys. Compiler Chapters 10-11 Virtual Machine Software hierarchy Translator

More information

Chapter 8: Virtual Machine II: Program Control

Chapter 8: Virtual Machine II: Program Control Elements of Computing Systems, Nisan & Schocken, MIT Press, 2005 Chapter 8: Virtual Machine II: Program Control www.idc.ac.il/tecs Usage and Copyright Notice: Copyright 2005 Noam Nisan and Shimon Schocken

More information

Compiler II: Code Generation Human Thought

Compiler II: Code Generation Human Thought Course map Compiler II: Code Generation Human Thought Abstract design Chapters 9, 12 abstract interface H.L. Language & Operating Sys. Compiler Chapters 1-11 abstract interface Virtual Machine Software

More information

Expressions and Assignment

Expressions and Assignment Expressions and Assignment COS 301: Programming Languages Outline Other assignment mechanisms Introduction Expressions: fundamental means of specifying computations Imperative languages: usually RHS of

More information

CSE443 Compilers. Dr. Carl Alphonce 343 Davis Hall

CSE443 Compilers. Dr. Carl Alphonce 343 Davis Hall CSE443 Compilers Dr. Carl Alphonce alphonce@buffalo.edu 343 Davis Hall http://www.cse.buffalo.edu/faculty/alphonce/sp17/cse443/index.php https://piazza.com/class/iybn4ndqa1s3ei shift/reduce conflict with

More information

Project 3 Due October 21, 2015, 11:59:59pm

Project 3 Due October 21, 2015, 11:59:59pm Project 3 Due October 21, 2015, 11:59:59pm 1 Introduction In this project, you will implement RubeVM, a virtual machine for a simple bytecode language. Later in the semester, you will compile Rube (a simplified

More information

Chapter 11: Compiler II: Code Generation

Chapter 11: Compiler II: Code Generation Elements of Computing Systems, Nisan & Schocken, MIT Press, 2005 Chapter 11: Compiler II: Code Generation www.idc.ac.il/tecs Usage and Copyright Notice: Copyright 2005 Noam Nisan and Shimon Schocken This

More information

Lecture 7: Type Systems and Symbol Tables. CS 540 George Mason University

Lecture 7: Type Systems and Symbol Tables. CS 540 George Mason University Lecture 7: Type Systems and Symbol Tables CS 540 George Mason University Static Analysis Compilers examine code to find semantic problems. Easy: undeclared variables, tag matching Difficult: preventing

More information

An Overview to Compiler Design. 2008/2/14 \course\cpeg421-08s\topic-1a.ppt 1

An Overview to Compiler Design. 2008/2/14 \course\cpeg421-08s\topic-1a.ppt 1 An Overview to Compiler Design 2008/2/14 \course\cpeg421-08s\topic-1a.ppt 1 Outline An Overview of Compiler Structure Front End Middle End Back End 2008/2/14 \course\cpeg421-08s\topic-1a.ppt 2 Reading

More information

CS Introduction to Data Structures How to Parse Arithmetic Expressions

CS Introduction to Data Structures How to Parse Arithmetic Expressions CS3901 - Introduction to Data Structures How to Parse Arithmetic Expressions Lt Col Joel Young One of the common task required in implementing programming languages, calculators, simulation systems, and

More information

The PCAT Programming Language Reference Manual

The PCAT Programming Language Reference Manual The PCAT Programming Language Reference Manual Andrew Tolmach and Jingke Li Dept. of Computer Science Portland State University September 27, 1995 (revised October 15, 2002) 1 Introduction The PCAT language

More information

Today s Menu. >Use the Internal Register(s) >Use the Program Memory Space >Use the Stack >Use global memory

Today s Menu. >Use the Internal Register(s) >Use the Program Memory Space >Use the Stack >Use global memory Today s Menu Methods >Use the Internal Register(s) >Use the Program Memory Space >Use the Stack >Use global memory Look into my See examples on web-site: ParamPassing*asm and see Methods in Software and

More information

Intermediate Representa.on

Intermediate Representa.on IR Intermediate Representa.on CMPT 379: Compilers Instructor: Anoop Sarkar anoopsarkar.github.io/compilers-class Intermediate Representation Language Specific Language + Machine Independent Machine Dependent

More information

Introduction to Scientific Computing

Introduction to Scientific Computing Introduction to Scientific Computing Dr Hanno Rein Last updated: October 12, 2018 1 Computers A computer is a machine which can perform a set of calculations. The purpose of this course is to give you

More information

Towards Lean 4: Sebastian Ullrich 1, Leonardo de Moura 2.

Towards Lean 4: Sebastian Ullrich 1, Leonardo de Moura 2. Towards Lean 4: Sebastian Ullrich 1, Leonardo de Moura 2 1 Karlsruhe Institute of Technology, Germany 2 Microsoft Research, USA 1 2018/12/12 Ullrich, de Moura - Towards Lean 4: KIT The Research An University

More information

Principle of Compilers Lecture VIII: Intermediate Code Generation. Alessandro Artale

Principle of Compilers Lecture VIII: Intermediate Code Generation. Alessandro Artale Free University of Bolzano Principles of Compilers. Lecture VIII, 2003/2004 A.Artale (1 Principle of Compilers Lecture VIII: Intermediate Code Generation Alessandro Artale Faculty of Computer Science Free

More information

Compiler Theory. (Intermediate Code Generation Abstract S yntax + 3 Address Code)

Compiler Theory. (Intermediate Code Generation Abstract S yntax + 3 Address Code) Compiler Theory (Intermediate Code Generation Abstract S yntax + 3 Address Code) 006 Why intermediate code? Details of the source language are confined to the frontend (analysis phase) of a compiler, while

More information

Project 8: Virtual Machine Translator II

Project 8: Virtual Machine Translator II Project 8: Virtual Machine Translator II CS 220 Start: Nov. 18; Due: Dec. 8 at 11:55 pm Background We continue building the VM Translator a program that translates a program written in the VM language

More information

Virtual Machine Tutorial

Virtual Machine Tutorial Virtual Machine Tutorial CSA2201 Compiler Techniques Gordon Mangion Virtual Machine A software implementation of a computing environment in which an operating system or program can be installed and run.

More information

Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt

Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt www.introsoftwaretesting.com OO Software and Designs Emphasis on modularity and reuse puts complexity

More information

Programming Paradigms

Programming Paradigms PP 2016/17 Unit 4 Ruby Advanced 1/42 Programming Paradigms Unit 4 Ruby Advanced J. Gamper Free University of Bozen-Bolzano Faculty of Computer Science IDSE PP 2016/17 Unit 4 Ruby Advanced 2/42 Outline

More information

7. The Virtual Machine

7. The Virtual Machine Chapter 7: The Virtual Machine 1 7. The Virtual Machine The programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form

More information

Ruby: Object-Oriented Concepts

Ruby: Object-Oriented Concepts Ruby: Object-Oriented Concepts Computer Science and Engineering College of Engineering The Ohio State University Lecture 8 Classes Classes have methods and variables class LightBulb # name with CamelCase

More information

Data Structures and Algorithms

Data Structures and Algorithms Data Structures and Algorithms Alice E. Fischer Lecture 6: Stacks 2018 Alice E. Fischer Data Structures L5, Stacks... 1/29 Lecture 6: Stacks 2018 1 / 29 Outline 1 Stacks C++ Template Class Functions 2

More information

CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 165] Postfix Expressions

CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 165] Postfix Expressions CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 165] Postfix Expressions We normally write arithmetic expressions using infix notation: the operator (such as +) goes in between the

More information

Intermediate Code Generation

Intermediate Code Generation Intermediate Code Generation In the analysis-synthesis model of a compiler, the front end analyzes a source program and creates an intermediate representation, from which the back end generates target

More information

1 Method Signatures and Overloading (3 minutes, 2 points)

1 Method Signatures and Overloading (3 minutes, 2 points) CS180 Spring 2010 Exam 1 Solutions, 15 February, 2010 Prof. Chris Clifton Turn Off Your Cell Phone. Use of any electronic device during the test is prohibited. Time will be tight. If you spend more than

More information

CSE 220: System Fundamentals I Unit 14: MIPS Assembly: Multi-dimensional Arrays. Kevin McDonnell Stony Brook University CSE 220

CSE 220: System Fundamentals I Unit 14: MIPS Assembly: Multi-dimensional Arrays. Kevin McDonnell Stony Brook University CSE 220 CSE 220: System Fundamentals I Unit 14: MIPS Assembly: Multi-dimensional Arrays 1 Memory Alignment Perhaps at some point in your MIPS assembly programming you tried to perform a lw and received an error

More information

Assembly Language Manual for the STACK Computer

Assembly Language Manual for the STACK Computer Computer Science 301 1 Assembly Language Manual for the STACK Computer Assembly language programmers should read the hardware description of the STACK computer together with information about the effect

More information

Cpt S 122 Data Structures. Templatized Stack

Cpt S 122 Data Structures. Templatized Stack Cpt S 122 Data Structures Templatized Stack Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Test # 2 Jia XU (Lab Section 3) Xiaoyu Zhang (Lab Section 3) Anh

More information

Code Generation. Lecture 12

Code Generation. Lecture 12 Code Generation Lecture 12 1 Lecture Outline Topic 1: Basic Code Generation The MIPS assembly language A simple source language Stack-machine implementation of the simple language Topic 2: Code Generation

More information

Raspberry Pi / ARM Assembly. OrgArch / Fall 2018

Raspberry Pi / ARM Assembly. OrgArch / Fall 2018 Raspberry Pi / ARM Assembly OrgArch / Fall 2018 The Raspberry Pi uses a Broadcom System on a Chip (SoC), which is based on an ARM CPU. https://en.wikipedia.org/wiki/arm_architecture The 64-bit ARM processor

More information

EECS2030 Week 7 worksheet Tue Feb 28, 2017

EECS2030 Week 7 worksheet Tue Feb 28, 2017 1. Interfaces The Comparator interface provides a way to control how a sort method (such as Collections.sort) sorts elements of a collection. For example, the following main method sorts a list of strings

More information

Intermediate Representations

Intermediate Representations Intermediate Representations A variety of intermediate representations are used in compilers Most common intermediate representations are: Abstract Syntax Tree Directed Acyclic Graph (DAG) Three-Address

More information

CSE 12 Abstract Syntax Trees

CSE 12 Abstract Syntax Trees CSE 12 Abstract Syntax Trees Compilers and Interpreters Parse Trees and Abstract Syntax Trees (AST's) Creating and Evaluating AST's The Table ADT and Symbol Tables 16 Using Algorithms and Data Structures

More information

PICOBIT: A Compact Scheme System for Microcontrollers

PICOBIT: A Compact Scheme System for Microcontrollers PICOBIT: A Compact Scheme System for Microcontrollers Vincent St-Amour Université de Montréal (now at Northeastern University) Marc Feeley Université de Montréal 21st Symposium on the Implementation and

More information

Computer Components. Software{ User Programs. Operating System. Hardware

Computer Components. Software{ User Programs. Operating System. Hardware Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point

More information

//converts a string to a non-negative number string2int(string s){

//converts a string to a non-negative number string2int(string s){ EP1200 Introduktion till datorsystemteknik Omtenta fredagen den 22 augusti 2014, 9.00 till 13.00 Possible solutions added with red. Other solutions may of course exist and worth full point. Inga hjälpmedel

More information

Lecture 2. Object Orientation

Lecture 2. Object Orientation Lecture 2 Object Orientation 1 Homework 0 Grades Homework 0 grades were returned earlier this week Any questions? 2 Homework 1 Homework 1 is due tonight at 11:59pm You will be graded on: Correctness: 15

More information

Virtual Machine (Part II)

Virtual Machine (Part II) Harvard University CS 101 Fall 2005, Shimon Schocken Virtual Machine (Part II) Elements of Computing Systems 1 Virtual Machine II (Ch. 8) Where we are at: Human Thought Abstract design Chapters 9, 12 H.L.

More information

Code Reuse: Inheritance

Code Reuse: Inheritance Object-Oriented Design Lecture 14 CSU 370 Fall 2008 (Pucella) Tuesday, Nov 4, 2008 Code Reuse: Inheritance Recall the Point ADT we talked about in Lecture 8: The Point ADT: public static Point make (int,

More information

Scala : an LLVM-targeted Scala compiler

Scala : an LLVM-targeted Scala compiler Scala : an LLVM-targeted Scala compiler Da Liu, UNI: dl2997 Contents 1 Background 1 2 Introduction 1 3 Project Design 1 4 Language Prototype Features 2 4.1 Language Features........................................

More information

Disclaimer. A Bit About Forth. No Syntax. Outline. I don't know Forth Typical Forth tutorial. Dave Eckhardt

Disclaimer. A Bit About Forth. No Syntax. Outline. I don't know Forth Typical Forth tutorial. Dave Eckhardt A Bit About Forth Dave Eckhardt de0u@andrew.cmu.edu I don't know Forth Typical Forth tutorial Disclaimer Stack, postfix stack operators Writing a simple Forth word Loops Stack manipulation, simple built-ins

More information

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division Fall, 2001 Prof. R. Fateman SUGGESTED S CS 164 Final Examination: December 18, 2001, 8-11AM

More information

Good Luck! CSC207, Fall 2012: Quiz 3 Duration 25 minutes Aids allowed: none. Student Number: Lecture Section: L0101. Instructor: Horton

Good Luck! CSC207, Fall 2012: Quiz 3 Duration 25 minutes Aids allowed: none. Student Number: Lecture Section: L0101. Instructor: Horton CSC207, Fall 2012: Quiz 3 Duration 25 minutes Aids allowed: none Student Number: Last Name: Lecture Section: L0101 First Name: Instructor: Horton Please fill out the identification section above as well

More information

Assembler Human Thought

Assembler Human Thought Where we are at: Assembler Human Thought Abstract design Chapters 9, 12 H.L. Language & Operating Sys. Compiler Chapters 10-11 Virtual Machine Software hierarchy VM Translator Chapters 7-8 Assembly Language

More information

Postscript Control Flow

Postscript Control Flow Postscript Control Flow CSE 413, Autumn 2005 Programming Languages http://www.cs.washington.edu/education/courses/413/05au/ Variables Postscript uses dictionaries to associate a name with an object value»

More information

CS 2340 Objects and Design - Scala

CS 2340 Objects and Design - Scala CS 2340 Objects and Design - Scala Objects and Operators Christopher Simpkins chris.simpkins@gatech.edu Chris Simpkins (Georgia Tech) CS 2340 Objects and Design - Scala Objects and Operators 1 / 13 Classes

More information

MaanavaN.Com CS1203 OBJECT ORIENTED PROGRAMMING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

MaanavaN.Com CS1203 OBJECT ORIENTED PROGRAMMING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING SUB CODE / SUBJECT: CS1203 / Object oriented programming YEAR / SEM: II / III QUESTION BANK UNIT I FUNDAMENTALS PART-A (2 MARKS) 1. What is Object Oriented

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Winter 2017 Lecture 6a Andrew Tolmach Portland State University 1994-2017 Iteration into Recursion Any iteration can be written as a recursion, e.g. while (c) {e Scala is equivalent

More information

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8 Epic Test Review 1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4 Write a line of code that outputs the phase Hello World to the console without creating a new line character. System.out.print(

More information

SOURCE LANGUAGE DESCRIPTION

SOURCE LANGUAGE DESCRIPTION 1. Simple Integer Language (SIL) SOURCE LANGUAGE DESCRIPTION The language specification given here is informal and gives a lot of flexibility for the designer to write the grammatical specifications to

More information

Run-time Environments

Run-time Environments Run-time Environments Status We have so far covered the front-end phases Lexical analysis Parsing Semantic analysis Next come the back-end phases Code generation Optimization Register allocation Instruction

More information

CS 2150 Final Exam, Spring 2018 Page 1 of 10 UVa userid:

CS 2150 Final Exam, Spring 2018 Page 1 of 10 UVa userid: CS 2150 Final Exam, Spring 2018 Page 1 of 10 UVa userid: CS 2150 Final Exam Name You MUST write your e-mail ID on EACH page and put your name on the top of this page, too. If you are still writing when

More information

Stack Frames. Compilers use the stack: to store the to to a subroutine for storage of declared in the subroutine and a place to

Stack Frames. Compilers use the stack: to store the to to a subroutine for storage of declared in the subroutine and a place to Stack Frames EE 357 Unit 8 Stack Frames Compilers use the stack: to store the to to a subroutine for storage of declared in the subroutine and a place to Every call to a subroutine will create a data structure

More information

CMPT 379 Compilers. Anoop Sarkar. 11/13/07 1. TAC: Intermediate Representation. Language + Machine Independent TAC

CMPT 379 Compilers. Anoop Sarkar.  11/13/07 1. TAC: Intermediate Representation. Language + Machine Independent TAC CMPT 379 Compilers Anoop Sarkar http://www.cs.sfu.ca/~anoop 11/13/07 1 TAC: Intermediate Representation Language Specific Language + Machine Independent Machine Dependent Front End AST Intermediate Code

More information

Intermediate Programming, Spring 2017*

Intermediate Programming, Spring 2017* 600.120 Intermediate Programming, Spring 2017* Misha Kazhdan *Much of the code in these examples is not commented because it would otherwise not fit on the slides. This is bad coding practice in general

More information

Run-time Environments

Run-time Environments Run-time Environments Status We have so far covered the front-end phases Lexical analysis Parsing Semantic analysis Next come the back-end phases Code generation Optimization Register allocation Instruction

More information

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java

More information

CMSC131. Inheritance. Object. When we talked about Object, I mentioned that all Java classes are "built" on top of that.

CMSC131. Inheritance. Object. When we talked about Object, I mentioned that all Java classes are built on top of that. CMSC131 Inheritance Object When we talked about Object, I mentioned that all Java classes are "built" on top of that. This came up when talking about the Java standard equals operator: boolean equals(object

More information

CSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1

CSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1 CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Winter 2008 3/11/2008 2002-08 Hal Perkins & UW CSE V-1 Agenda Java virtual machine architecture.class files Class loading Execution engines

More information

UNIVERSITY OF OSLO Department of Informatics. Interpreter and bytecode for INF5110. Fredrik Sørensen, Stein Krogdahl and Birger Møller-Pedersen

UNIVERSITY OF OSLO Department of Informatics. Interpreter and bytecode for INF5110. Fredrik Sørensen, Stein Krogdahl and Birger Møller-Pedersen UNIVERSITY OF OSLO Department of Informatics Interpreter and bytecode for INF5110 Fredrik Sørensen, Stein Krogdahl and Birger Møller-Pedersen 26th May 2008 Contents 1 Introduction 2 1.1 The interpreter..........................

More information

Type Checking Binary Operators

Type Checking Binary Operators Type Checking Binary Operators binaryopnode expr tree expr tree Type checking steps: 1. Type check left and right operands. 2. Check that left and right operands are both scalars. 3. binaryopnode.kind

More information

UMBC CMSC 331 Final Exam

UMBC CMSC 331 Final Exam UMBC CMSC 331 Final Exam Name: UMBC Username: You have two hours to complete this closed book exam. We reserve the right to assign partial credit, and to deduct points for answers that are needlessly wordy

More information

CSC 2400: Computing Systems. X86 Assembly: Function Calls"

CSC 2400: Computing Systems. X86 Assembly: Function Calls CSC 24: Computing Systems X86 Assembly: Function Calls" 1 Lecture Goals! Challenges of supporting functions" Providing information for the called function" Function arguments and local variables" Allowing

More information

Binghamton University. CS-120 Summer Introduction to C. Text: Introduction to Computer Systems : Chapters 11, 12, 14, 13

Binghamton University. CS-120 Summer Introduction to C. Text: Introduction to Computer Systems : Chapters 11, 12, 14, 13 Introduction to C Text: Introduction to Computer Systems : Chapters 11, 12, 14, 13 Problem: Too Many Details For example: Lab 7 Bubble Sort Needed to keep track of too many details! Outer Loop When do

More information

Basics Inheritance and Instance Variables Inheritance and Methods Class Variables. Ruby Inheritance CSCI September 2017.

Basics Inheritance and Instance Variables Inheritance and Methods Class Variables. Ruby Inheritance CSCI September 2017. CSCI400 05 September 2017 Color Key Clickable URL link Write down an answer to this for class participation Just a comment don t confuse with yellow Class Participation Get out a piece of paper, we ll

More information

Talen en Compilers. Johan Jeuring , period 2. December 15, Department of Information and Computing Sciences Utrecht University

Talen en Compilers. Johan Jeuring , period 2. December 15, Department of Information and Computing Sciences Utrecht University Talen en Compilers 2016-2017, period 2 Johan Jeuring Department of Information and Computing Sciences Utrecht University December 15, 2016 9 Simple stack machine 9-1 Recap: Semantic functions In the previous

More information

CS356: Discussion #6 Assembly Procedures and Arrays. Marco Paolieri

CS356: Discussion #6 Assembly Procedures and Arrays. Marco Paolieri CS356: Discussion #6 Assembly Procedures and Arrays Marco Paolieri (paolieri@usc.edu) Procedures Functions are a key abstraction in software They break down a problem into subproblems. Reusable functionality:

More information

CSc 520 Principles of Programming Languages

CSc 520 Principles of Programming Languages CSc 520 Principles of Programming Languages 16 : Types Polymorphism Christian Collberg collberg+520@gmail.com Department of Computer Science University of Arizona Copyright c 2008 Christian Collberg [1]

More information

Assembler. Building a Modern Computer From First Principles.

Assembler. Building a Modern Computer From First Principles. Assembler Building a Modern Computer From First Principles www.nand2tetris.org Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 6: Assembler slide 1 Where we are

More information

Tizen/Artik IoT Lecture Chapter 3. JerryScript Parser & VM

Tizen/Artik IoT Lecture Chapter 3. JerryScript Parser & VM 1 Tizen/Artik IoT Lecture Chapter 3. JerryScript Parser & VM Sungkyunkwan University Contents JerryScript Execution Flow JerryScript Parser Execution Flow Lexing Parsing Compact Bytecode (CBC) JerryScript

More information

INF 212 ANALYSIS OF PROG. LANGS FUNCTION COMPOSITION. Instructors: Crista Lopes Copyright Instructors.

INF 212 ANALYSIS OF PROG. LANGS FUNCTION COMPOSITION. Instructors: Crista Lopes Copyright Instructors. INF 212 ANALYSIS OF PROG. LANGS FUNCTION COMPOSITION Instructors: Crista Lopes Copyright Instructors. Topics Recursion Higher-order functions Continuation-Passing Style Monads (take 1) Identity Monad Maybe

More information

Data Structure Layout. In HERA/Assembly

Data Structure Layout. In HERA/Assembly Data Structure Layout In HERA/Assembly Today, we re going to build some data structures in HERA First, a note on memory Registers are very fast RAM is relatively slow We use a cache to sit between them

More information

What the CPU Sees Basic Flow Control Conditional Flow Control Structured Flow Control Functions and Scope. C Flow Control.

What the CPU Sees Basic Flow Control Conditional Flow Control Structured Flow Control Functions and Scope. C Flow Control. C Flow Control David Chisnall February 1, 2011 Outline What the CPU Sees Basic Flow Control Conditional Flow Control Structured Flow Control Functions and Scope Disclaimer! These slides contain a lot of

More information

CS 211 Programming Practicum Fall 2018

CS 211 Programming Practicum Fall 2018 Due: Wednesday, 11/7/18 at 11:59 pm Infix Expression Evaluator Programming Project 5 For this lab, write a C++ program that will evaluate an infix expression. The algorithm REQUIRED for this program will

More information

CSE 401/M501 Compilers

CSE 401/M501 Compilers CSE 401/M501 Compilers Code Shape II Objects & Classes Hal Perkins Autumn 2018 UW CSE 401/M501 Autumn 2018 L-1 Administrivia Semantics/type check due next Thur. 11/15 How s it going? Reminder: if you want

More information

Assignment II: Calculator Brain

Assignment II: Calculator Brain Assignment II: Calculator Brain Objective You will start this assignment by enhancing your Assignment 1 Calculator to include the changes made in lecture (i.e. CalculatorBrain, etc.). This is the last

More information

Operating Systems CMPSCI 377, Lec 2 Intro to C/C++ Prashant Shenoy University of Massachusetts Amherst

Operating Systems CMPSCI 377, Lec 2 Intro to C/C++ Prashant Shenoy University of Massachusetts Amherst Operating Systems CMPSCI 377, Lec 2 Intro to C/C++ Prashant Shenoy University of Massachusetts Amherst Department of Computer Science Why C? Low-level Direct access to memory WYSIWYG (more or less) Effectively

More information

6.184 Lecture 4. Interpretation. Tweaked by Ben Vandiver Compiled by Mike Phillips Original material by Eric Grimson

6.184 Lecture 4. Interpretation. Tweaked by Ben Vandiver Compiled by Mike Phillips Original material by Eric Grimson 6.184 Lecture 4 Interpretation Tweaked by Ben Vandiver Compiled by Mike Phillips Original material by Eric Grimson 1 Interpretation Parts of an interpreter Arithmetic calculator

More information

Lecture Code Generation for WLM

Lecture Code Generation for WLM Lecture 17+18 Code Generation for WLM CS 241: Foundations of Sequential Programs Winter 2018 Troy Vasiga et al University of Waterloo 1 Code Generation (A9/A10) Input: Output: Number of different outputs:

More information

Intermediate Code & Local Optimizations. Lecture 20

Intermediate Code & Local Optimizations. Lecture 20 Intermediate Code & Local Optimizations Lecture 20 Lecture Outline Intermediate code Local optimizations Next time: global optimizations 2 Code Generation Summary We have discussed Runtime organization

More information

CS 406/534 Compiler Construction Putting It All Together

CS 406/534 Compiler Construction Putting It All Together CS 406/534 Compiler Construction Putting It All Together Prof. Li Xu Dept. of Computer Science UMass Lowell Fall 2004 Part of the course lecture notes are based on Prof. Keith Cooper, Prof. Ken Kennedy

More information

Review: Object Diagrams for Inheritance. Type Conformance. Inheritance Structures. Car. Vehicle. Truck. Vehicle. conforms to Object

Review: Object Diagrams for Inheritance. Type Conformance. Inheritance Structures. Car. Vehicle. Truck. Vehicle. conforms to Object Review: Diagrams for Inheritance - String makemodel - int mileage + (String, int) Class #3: Inheritance & Polymorphism Software Design II (CS 220): M. Allen, 25 Jan. 18 + (String, int) + void

More information

Working with Bytecodes: IRBuilder and InstructionStream. Marcus Denker. Reasons for working with Bytecode

Working with Bytecodes: IRBuilder and InstructionStream. Marcus Denker. Reasons for working with Bytecode Working with Bytecodes: IRBuilder and InstructionStream Reasons for working with Bytecode Generating Bytecode Implementing compilers for other languages Experimentation with new language features Parsing

More information

Binary Search Tree Binary Search tree is a binary tree in which each internal node x stores an element such that the element stored in the left subtree of x are less than or equal to x and elements stored

More information

CS 211. Project 5 Infix Expression Evaluation

CS 211. Project 5 Infix Expression Evaluation CS 211 Project 5 Infix Expression Evaluation Part 1 Create you own Stack Class Need two stacks one stack of integers for the operands one stack of characters for the operators Do we need 2 Stack Classes?

More information

Control Structures. CIS 118 Intro to LINUX

Control Structures. CIS 118 Intro to LINUX Control Structures CIS 118 Intro to LINUX Basic Control Structures TEST The test utility, has many formats for evaluating expressions. For example, when given three arguments, will return the value true

More information

Final exam. Final exam will be 12 problems, drop any 2. Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers)

Final exam. Final exam will be 12 problems, drop any 2. Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers) Review Final exam Final exam will be 12 problems, drop any 2 Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers) 2 hours exam time, so 12 min per problem (midterm 2 had

More information

An assembler for Tcl bytecode:???? Kevin Kenny GE Research Ozgur Dogan Ugurlu University of San Francisco

An assembler for Tcl bytecode:???? Kevin Kenny GE Research Ozgur Dogan Ugurlu University of San Francisco An assembler for Tcl bytecode:???? Kevin Kenny GE Research Ozgur Dogan Ugurlu University of San Francisco An assembler for Tcl bytecode: A technological dead end Kevin Kenny GE Research Ozgur Dogan Ugurlu

More information

CISC-235* Test #1 January 31, 2018

CISC-235* Test #1 January 31, 2018 CISC-235* Test #1 January 31, 2018 Student Number (Required) Name (Optional) This is a closed book test. You may not refer to any resources. This is a 50 minute test. Please write your answers in ink.

More information

We cover recursion in 150. Why do it again in 151?

We cover recursion in 150. Why do it again in 151? Recursion We cover recursion in 150. Why do it again in 151? First, good solutions to problems are often recursive. Here is a quick way to sort a list of objects: split the list in half, recursively sort

More information

Introduction to C An overview of the programming language C, syntax, data types and input/output

Introduction to C An overview of the programming language C, syntax, data types and input/output Introduction to C An overview of the programming language C, syntax, data types and input/output Teil I. a first C program TU Bergakademie Freiberg INMO M. Brändel 2018-10-23 1 PROGRAMMING LANGUAGE C is

More information

Monday, November 13, 2017

Monday, November 13, 2017 Monday, November 13, 2017 Topics for today ode generation nalysis lgorithm 1: evaluation of postfix lgorithm 2: infix to postfix lgorithm 3: evaluation of infix lgorithm 4: infix to tree nalysis We are

More information

Lecture Outline. Topic 1: Basic Code Generation. Code Generation. Lecture 12. Topic 2: Code Generation for Objects. Simulating a Stack Machine

Lecture Outline. Topic 1: Basic Code Generation. Code Generation. Lecture 12. Topic 2: Code Generation for Objects. Simulating a Stack Machine Lecture Outline Code Generation Lecture 12 Topic 1: Basic Code Generation The MIPS assembly language A simple source language Stack-machine implementation of the simple language Topic 2: Code Generation

More information

Pharo Syntax in a Nutshell

Pharo Syntax in a Nutshell Pharo Syntax in a Nutshell Damien Cassou, Stéphane Ducasse and Luc Fabresse W1S06, 2015 W1S06 2 / 28 Getting a Feel About Syntax In this lecture we want to give you the general feel to get started: Overview

More information