Material: Specification and Reasoning. Book: Logic in Computer Science, M.Huth, M.Ryan, Cambridge University Press. Lectures mondays here,

Size: px
Start display at page:

Download "Material: Specification and Reasoning. Book: Logic in Computer Science, M.Huth, M.Ryan, Cambridge University Press. Lectures mondays here,"

Transcription

1 Material: Specification and Reasoning Lectures mondays here, Lecturer Pasquale Malacaria CS/428 Labs thursdays with Dino DiStefano Book: Logic in Computer Science, M.Huth, M.Ryan, Cambridge University Press. Plus additional material from the web page. pm/sar/ Some of the topics of this course aren t on textbooks, so attendance is essential. 1 2

2 Specification: Specification and Reasoning what does that mean? We want to learn how to say precisely what we want from a system (software or physical system) Reasoning: We want to learn to reason precisely about a system. 3 4

3 Why do we want to do that? Our computers work ok, they crash rarely (10 per cent), so why bother? The 99 percent problem... The 99.9 percent problem Think of the software controlling the following: Trains, airplanes, nuclear power stations, car cpu, underground, rockets, stock market, keyhole surgery, traffic controller, ships, power grid, water, gas supplies... basically everything outside personal use of computers need to work more than ok and often need to crash never. 5 6

4 How to achieve these high standard? Duplication? E.g. 3 computers running at the same time; output by majority Testing? white/ black box testing Do these things work for critical systems? Duplication: Two wrong do not make one right. Testing: How much can you test? 1 int var = 2 32 cases ( > spoonful of sea),... 4 int vars =2 128 cases (> particles in the universe). 7 8

5 The logical approach: We specify in some logics what we want to do. The system is interpreted as some kind of model for this logic We use standard logic techniques (e.g. proofs) to reason about the system, e.g. to prove or disprove that the system does what we want. Two relevant families of logics: Temporal logics: logic as you know it + operators to say things like at some point in the future P will be true or always in the future P will be true Program logics: logic as you know it + rules to say if P was true before the program statement c then P is true after c has been executed 9 10

6 Lecture 1: A meaningful example of temporal logic statement It will always be true that if the pressure in a nuclear reactor exceed a critical limit the alarm will be reaised Topics: Program Models, Transition Systems, To know this some kind of temporal logical proof is required. Kripke Transition systems, While Language

7 How can we model systems? For example how can we model a simple vending machine? What do we need to know to model a simple vending machine? (that thing where you insert coins and then choose a drink). and what is a model anyway? For our purposes a model is some kind of formalism which represents the behaviour of the system. A vending machine is basically a system which has an initial state and then changes its state according to the user behaviour: E.g.:If the user inserts the right amount the machine get into a state where the user can choose a drink

8 So let s take the view that a model for a simple vending machine is a formalism where we can represent the possible states of the machine and the transitions between these states. States:{ 1:start, 2:chooseDrink, 3:releaseCoke, 4:releaseOrange, 5:finish} The difference is that 2 3 happens when the user chooses a coke and 2 4 happens when he chooses an orange. We have hence to specify the action bringing from one state to another, e.g. 2 coke 3 Here is a picture of the system: Transitions:{1 2, 2 3, 2 4, 3 1, 4 1, 1 5} Something is still missing. Can you see what? What s the difference between 2 3 and 2 4? 15 16

9 Our model of the vending machine is an example of a Labeled Transition System. a Labeled Transition System is a triple T = (S, A, ) where S is a set of nodes Can we model programs in a similar way? What are the states? What are the transitions? A a set of actions S A S a set of labelled transitions A state is a snapshot of a system; in the case of a program what is its snapshot? int x=0; int y =5; x+=y*2; Note that if A = {a} (any singleton will do) we recover (directed) graphs

10 A snapshot of an executing program can be seen as the state of the memory when the current command is executed. A Program Model is a 5-tuple (S, A,, s, E) where S is a set of nodes (or program states) In our case: After : int x = 0; int y = 5; State : x = 0, y = 5 After : x = x + y 2; State : x = 10, y = So we can take as the state of a program at a program point the values of the program variables at that particular program point. A a set of actions (or program commands) S A S a set of labelled transitions s S is the initial state and E S the set of end states

11 Our simple program int x=0; int y =5; x+=y*2; can be interpreted in the following program model (S, A,, s, E): S = { 1,2,3,4}, where 1=ɛ, 2={x=0}, 3={x=0,y=5}, 4={x=10,y=5}. A = { int x=0, int y =5, x+=y*2} 1 int x=0 2, 2 int y=5 3, 3 x+=y 2 4 A more interesting example Consider the following fragment of a Java program: while (Mod(x)) { x=x/2; x++;} } where s = 1, E = {4}. Mod(x) returns true if x is even and false otherwise

12 Program Models and labeled transition systems are part of a family of models for various logical or physical systems. Labels on arcs denotes the possible actions of the system, i.e. its dynamics; it is however convenient to enrich the states of the system to include atomic propositions associated to states. A Kripke transition system over a set of atomic propositions P is a structure T = (S, A,, I) where T = (S, A) is a labeled transition system and I : S 2 P is an interpretation

13 I(s) = {p 1,..., p n } means p 1,..., p n are true in the state s. The idea is that with an interpretation we add the basic truths we want to hold at a particular state. Example: consider again int x=0; int y =5; x+=y*2; An interpretation for this program could be as follows: Some more interpretations for int x=0; int y =5; x+=y*2; I(1) = ɛ, I(2) = {y = 5}, I(3) = {x < y}, I(4) = {x > y} I(1) = I(2) = I(3) = I(4) = ɛ I(1) = I(2) = ɛ, I(3) = {x < y}, I(4) = {x > y} I(1) = I(2) = I(3) = I(4) = {x > 0} Hence an interpretation allows us to add basic truths to the model

14 Summary: Labeled transition systems (LTS)= states + transitions with labels. Program Models (PM)= (LTS)+initial state and final states. Kripke transition system(kts)=(lts)+ interpretation. The While language The programs we will consider will be written in a subset of java consisting of while and if statements and sequence of assignments. We call this the While language. Example z = 0; i = 0; while(!(i == y)){z+ = x; i + +; } LTS are a basic universal model of everything. PM are special LTS appropriate for programs. How restrictive is that? Can we translate all java programs we saw last year in that form? KTS are LTS with added basic logic

15 In short the answer is yes. example to give the idea: We just give an public class Account { private double balance; public Account(double initialbalance) { balance = initialbalance; } public void deposit(double amount) { balance += amount; } public void withdraw(double amount) { balance -= amount; } public class TestAccount { public static void main(string[] args) { Account acc1=new Account(1000); Account acc2=new Account(500); double sum=acc1.getbalance()+acc2.getbalance(); acc2.deposit(sum); } } public double getbalance() { return balance; } } 30 31

16 To translate into our simple language we start from the main and statement after statement we do: When creating a new object with some initial value we create one variable for each instance variable created in the original program and give the correspondent initial value. Replace all loop constructor with while. For example for(int i=0; i<n; i++){...} is replaced by int i=0; while (i<n){...i++;}. We then replace all method calls with the method bodies (you learned that in Programming 1). Here is what we get in our example: acc1balance=1000; acc2balance=500; Lecture 2: Course page: pm/sar We have seen so far: Some models for systems: LTS, PM, KTS. That Java can be translated into the much smaller while language. sum=acc1balance+acc2balance; acc2balance=sum; 32 33

17 Small step operational semantics (SSOP) for the While language: We can give a reasonably simple mathematical description of the evaluation process of the while language; it is called operational semantics. The SSOP is a way to describe formally how a program of the While language is evaluated. It also tell us precisely how to build the program model of a program. Why would we want to do that? To simplify we assume our programs contain only variables of type int. Our first task is to formalize the idea of a computer memory 34 35

18 x y z w The syntax of our While language is defined using the Backus-Naur form as follows: Commands are: C ::= Var = E skip C; C if (BE) {C} else {C} while (BE) {C} where Var ::= x y z... Here x = 5, y = 3, z = 32, w =? and we don t care what is in the other memory cells E ::= Var E + E E E E E E/E n... We then define the memory M as a partial map from name of variables to int undefined on some argu- Why partial (i.e. ments)? M : Var int 36 BE ::= E == E E < E E > E E is the set of (arithmetic) expressions and BE is the set of (boolean) expressions. e.g. x = 5; if(x > 3){x = x 4} else {skip} 37

19 SSOP Rules The SSOP tell us what happen when we meet a particular command in a given memory; The definition is given case by case and has one of the two following shapes: (command, memory) (command, memory ) (command, memory) memory In this last case the computation has ended. assign: (v = e, M) v=e M [v=e] Here M [v=e] is the memory M where the variable v is now mapped to e, i.e. M [v=e] (v ) = M(v ) if v v M [v=e] (v ) = e if v = v skip: (skip, M) skip M A pair (command, memory) is called a configuration. seq1: seq2: (c 1,M) c M (c 1 ;c 2,M) c (c 2,M ) (c 1,M) c (c 1,M ) (c 1 ;c 2,M) c (c 1 ;c 2,M ) 38 39

20 The rules for if require first to evaluate the boolean expression involved. For example (x = 5, ɛ) x=5 ɛ [x=5] here ɛ is the map undefined on all variables, i.e. ɛ(y) is undefined for all variables y Notice that when there is no ambiguity we can drop the labels over the arrows, so the above can be written To understand the rule consider the following example: x=0; if (x>3) x=1; else x=2; What would x become? That depend on if (x>3) is true; but we know that the value of x in the memory is 0 (i.e. M(x) = 0 so (x>3) is false. (x = 5, ɛ) ɛ [x=5] So when we meet a conditional we have to evaluate the expression, that is we have to replace all variable in the expression with their values at that program point

21 Given an expression e and a memory M let s M(e) denotes the boolean value obtained by replacing all variables in e with their value in M, e.g. M(x < y) = true if M(x) < M(y) M(x < y) = false if M(x) >= M(y) and M(x < y) is undefined if M(x) or M(y) are undefined. if1: M(e)=true (if e c 1 else c 2, M) e (c 1,M) Let s see for example the SSOP of the program P defined as: x=4; while (Mod(x)) { x=x/2; x++; } The SSOP of a program usually start with the empty memory ɛ. (x = 4, ɛ) x=4 M 0 (rule assign) where if2: M(e)=false (if e c 1 else c 2, M)!e (c 2,M) M 0 (v) = 4 if v = x, and is undefined otherwise We don t need any rule for while. This is because we can use the following recursive identity: while-if: while e c if e {c; while e c}else skip 42 Hence (P, ɛ) x=4 (P 1, M 0 ) with P 1 = while(mod(x)){x = x/2; x + +; } (rule seq1) 43

22 By using again rules assign and seq1 we get Using while-if rule we get (x + +; P 1, M 1 ) x++ (P 1, M 2 ) P 1 = if(mod(x)){x = x/2; x + +; P 1 } else skip; with M 2 (v) = 3 if v = x, and is undefined otherwise and using if1 (because (Mod(4))=true) We reapply again the identity while-if to get we get (P 1, M 0 ) (Mod(4)) (x = x/2; x + +; P 1, M 0 ) P 1 = if(mod(x)){x = x/2; x + +; P 1 } else skip; Now by rule assign we get but now (Mod(3))=false so (x = x/2, M 0 ) x=x/2 M 1 (P 1, M 2 ) (Mod(3)) (skip, M 2 ) with M 1 (v) = 2 if v = x, and is undefined otherwise and (skip rule) so (x = x/2; x + +; P 1, M 0 ) x=x/2 (x + +; P 1, M 1 ) (rule seq1) 44 (skip, M 2 ) skip M 2 So as expected the computation finish with the memory holding the value 3 for x. 45

23 SSOP and program models The standard program model of a program is defined as: States are the configurations (i.e. the pairs (command, memory)) generated by its SSOP. Actions are assignments and boolean expressions. Transitions are defined by the small steps assign and if1, if2 rules. The start state is the initial configuration and end states are those with no successor. Example: (x = 4; while(mod(x)){x = x/2; x + +;}, ɛ) x=4 (P 1, M 0 ) Mod(4) (x = x/2; x + +; P 1, M 0 ) x=x/2 (x + +; P 1, M 1 ) x++ (P 1, M 2 )!Mod(3) (skip, M 2 ) skip M

24 What about while (Mod(x)) { x=x/2; x++; } where A standard program model represents a particular run of the program. Is there a program model which represents all possible runs? or programs where some variables are not instantiated? Mod(x) return true if x is even and false otherwise

25 When is the rule seq2 applied? First think of a sequence of statements c 1 ; c 2 ;... ; c n This sequence should be seen as a sequence of two statements: Lecture 3: c 1 and c 2 ;... ; c n the second being itself a sequence of statements. (In mathematical terms we are saying that sequencing associates to the right) 50 51

26 Consider x = 0; while(x < 2)x + +; y = x + 1; this is a sequence of three statements: A: x = 0; B: while(x < 2)x + +; C: y = x + 1; which, according to the previous slide, we will consider as a sequence of two statements: By evaluating A;B;C according to the SSOP we will first apply seq1 where c 1 =A and c 2 =B;C We will then be left to evaluate c 1 ; c 2 where c 1 =B and c 2 = C in the memory M [x=0] But now we cannot apply seq1 to B;C because there is no rule of the form (while e c, M) M A and B;C 52 53

27 The best we can do is something along the following lines: So when evaluating B;C we cannot use seq1 but we can use seq2. In general it is easy to see that (while e c, M) (if e{ c; while e c} else skip, M) and then apply the appropriate if rule and get either ( c; while e c, M) or ( skip, M) seq1 and seq2 are exclusive if1 and if2 are exclusive. (B,M [x=0] ) ( c;b, M [x=0] ) if x < 2 (B,M [x=0] ) ( skip, M [x=0] ) if x 2 This implies that the while language is deterministic, i.e. for a given input a program always return the same value. This implies that Java is deterministic

28 What about while (Mod(x)) { x=x/2; x++; } where Mod(x) return true if x is even and false otherwise. A standard program model represents a particular run of the program. Is there a program model which represents all possible runs? or programs where some variables are not instantiated? Do you remember what a flowchart is? 56 57

29 Recall that a memory is a map M : Var int. The way flowcharts are usually taught is by reading the code and thinking this is an assignment, here we have a decision... What we are doing there is to abstract from the program data. What happen if we consider instead a memory as a map M : Var { }, i.e. the map which gives to all variables the same value { }? Then at the node x = x/2 i.e. M(x) =! This abstraction of program data can be formally presented using what is called abstract interpretation, a techniques we will give an example now: In the flowchart case a rough abstraction would consists of taking a singleton as the only possible value for program variables (instead of int), Let s call flow memory the map M : Var { } 58 59

30 Let s now modify SSOP by changing if1, if2 as follows: AbstractIf1: (if e c 1 else c 2, M) e (c 1, M) AbstractIf2: (if e c 1 else c 2, M)!e (c 2, M) Compute the ASSOP for the following program using the flow memory map M : Var { } while(mod(x)){x = x/2; x + +;} Let s call ASSOP this modified SSOP (Abstract small step operational semantics) The flowchart of a program P is the standard program model of the ASSOP of P using the flow memory. Nodes=configurations or memories of the program Edges=transitions according to the ASSOP rules 60 61

31 (while(mod(x)) {x=x/2;x++}, [x=*]) Or when there is no risk of confusion we can simplify it as follows: x++ {*} x++ {*} ( x=x/2; x++;while(mod(x)){x=x/2;x++},[x=*]) x=x/2 {*} {*} x=x/2 (x++;while(mod(x)){x=x/2;x++},[x=*]) {*} 62 63

32 In general an abstraction of the memory will replace the real values in the memory with some property of those values: x y z w The even/odd memory, M : Var {e, o, } M(x) = e if x has an even value x y z w M(x) = o if x has an odd value M(x) = if we don t know x value o o e * 64 65

33 the ASSOP(even/odd memory) of while(mod(x)){x = x/2; x + +;} {*} The sign memory M : Var {e, o, } M(x) = + if x value is positive x++ M(x) = if x value is negative {o} {e} M(x) = if we don t know x sign x=x/2 what is the ASSOP (sign memory) of {*} while(mod(x)){x = x/2; x + +;}? 66 67

34 Let s define The point memory M : Var {3,!3, } M(x) = 3 if x = 3 Is the following the ASSOP (point memory ) of while(mod(x)){x = x/2; x + +;}? {*} x++ M(x) =!3 if x 3 M(x) = if we don t know which class x belongs to. {3} {!3} x=x/2 {*} 68 69

35 The memory maps flow, even/odd, sign and point are just examples of abstractions; For most particular problems we can create an appropriate abstraction; Abstraction is the holy grail of computer science; the only way to study systems with billions of states by abstracting them to systems with few thousands of states. Question: is ASSOP deterministic? 70

Fundamental Concepts. Chapter 1

Fundamental Concepts. Chapter 1 Chapter 1 Fundamental Concepts This book is about the mathematical foundations of programming, with a special attention on computing with infinite objects. How can mathematics help in programming? There

More information

The Rule of Constancy(Derived Frame Rule)

The Rule of Constancy(Derived Frame Rule) The Rule of Constancy(Derived Frame Rule) The following derived rule is used on the next slide The rule of constancy {P } C {Q} {P R} C {Q R} where no variable assigned to in C occurs in R Outline of derivation

More information

Shared Variables and Interference

Shared Variables and Interference Illinois Institute of Technology Lecture 24 Shared Variables and Interference CS 536: Science of Programming, Spring 2018 A. Why Parallel programs can coordinate their work using shared variables, but

More information

The Substitution Model

The Substitution Model The Substitution Model Prof. Clarkson Fall 2017 Today s music: Substitute by The Who Review Previously in 3110: simple interpreter for expression language abstract syntax tree (AST) evaluation based on

More information

CS164: Midterm I. Fall 2003

CS164: Midterm I. Fall 2003 CS164: Midterm I Fall 2003 Please read all instructions (including these) carefully. Write your name, login, and circle the time of your section. Read each question carefully and think about what s being

More information

CS1 Lecture 3 Jan. 18, 2019

CS1 Lecture 3 Jan. 18, 2019 CS1 Lecture 3 Jan. 18, 2019 Office hours for Prof. Cremer and for TAs have been posted. Locations will change check class website regularly First homework assignment will be available Monday evening, due

More information

CMPSCI 250: Introduction to Computation. Lecture 20: Deterministic and Nondeterministic Finite Automata David Mix Barrington 16 April 2013

CMPSCI 250: Introduction to Computation. Lecture 20: Deterministic and Nondeterministic Finite Automata David Mix Barrington 16 April 2013 CMPSCI 250: Introduction to Computation Lecture 20: Deterministic and Nondeterministic Finite Automata David Mix Barrington 16 April 2013 Deterministic and Nondeterministic Finite Automata Deterministic

More information

CS2104 Prog. Lang. Concepts

CS2104 Prog. Lang. Concepts CS2104 Prog. Lang. Concepts Operational Semantics Abhik Roychoudhury Department of Computer Science National University of Singapore Organization An imperative language IMP Formalizing the syntax of IMP

More information

Shared Variables and Interference

Shared Variables and Interference Solved Shared Variables and Interference CS 536: Science of Programming, Fall 2018 A. Why Parallel programs can coordinate their work using shared variables, but it s important for threads to not interfere

More information

CS1 Lecture 3 Jan. 22, 2018

CS1 Lecture 3 Jan. 22, 2018 CS1 Lecture 3 Jan. 22, 2018 Office hours for me and for TAs have been posted, locations will change check class website regularly First homework available, due Mon., 9:00am. Discussion sections tomorrow

More information

Note that in this definition, n + m denotes the syntactic expression with three symbols n, +, and m, not to the number that is the sum of n and m.

Note that in this definition, n + m denotes the syntactic expression with three symbols n, +, and m, not to the number that is the sum of n and m. CS 6110 S18 Lecture 8 Structural Operational Semantics and IMP Today we introduce a very simple imperative language, IMP, along with two systems of rules for evaluation called small-step and big-step semantics.

More information

CSCI 3155: Principles of Programming Languages Exam preparation #1 2007

CSCI 3155: Principles of Programming Languages Exam preparation #1 2007 CSCI 3155: Principles of Programming Languages Exam preparation #1 2007 Exercise 1. Consider the if-then-else construct of Pascal, as in the following example: IF 1 = 2 THEN PRINT X ELSE PRINT Y (a) Assume

More information

The Substitution Model. Nate Foster Spring 2018

The Substitution Model. Nate Foster Spring 2018 The Substitution Model Nate Foster Spring 2018 Review Previously in 3110: simple interpreter for expression language abstract syntax tree (AST) evaluation based on single steps parser and lexer (in lab)

More information

Problem Grade Total

Problem Grade Total CS 101, Prof. Loftin: Final Exam, May 11, 2009 Name: All your work should be done on the pages provided. Scratch paper is available, but you should present everything which is to be graded on the pages

More information

Goals: Define the syntax of a simple imperative language Define a semantics using natural deduction 1

Goals: Define the syntax of a simple imperative language Define a semantics using natural deduction 1 Natural Semantics Goals: Define the syntax of a simple imperative language Define a semantics using natural deduction 1 1 Natural deduction is an instance of first-order logic; that is, it is the formal

More information

Agenda: Notes on Chapter 3. Create a class with constructors and methods.

Agenda: Notes on Chapter 3. Create a class with constructors and methods. Bell Work 9/19/16: How would you call the default constructor for a class called BankAccount? Agenda: Notes on Chapter 3. Create a class with constructors and methods. Objectives: To become familiar with

More information

Basic Class Diagrams. Class Diagrams, cont d. Class Diagrams, cont d. Car. Car. Car. What does the minus sign here mean?

Basic Class Diagrams. Class Diagrams, cont d. Class Diagrams, cont d. Car. Car. Car. What does the minus sign here mean? Class #02: Inheritance and Object-Oriented Design Software Design II (CS 220): M. Allen, 23 Jan. 18 Basic Class Diagrams Describes a class and how it can be used properly Sketch of properties and behaviors

More information

Hoare Logic. COMP2600 Formal Methods for Software Engineering. Rajeev Goré

Hoare Logic. COMP2600 Formal Methods for Software Engineering. Rajeev Goré Hoare Logic COMP2600 Formal Methods for Software Engineering Rajeev Goré Australian National University Semester 2, 2016 (Slides courtesy of Ranald Clouston) COMP 2600 Hoare Logic 1 Australian Capital

More information

Quarter 1 Practice Exam

Quarter 1 Practice Exam University of Chicago Laboratory Schools Advanced Placement Computer Science Quarter 1 Practice Exam Baker Franke 2005 APCS - 12/10/08 :: 1 of 8 1.) (10 percent) Write a segment of code that will produce

More information

(Refer Slide Time 6:48)

(Refer Slide Time 6:48) Digital Circuits and Systems Prof. S. Srinivasan Department of Electrical Engineering Indian Institute of Technology Madras Lecture - 8 Karnaugh Map Minimization using Maxterms We have been taking about

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 19 Tuesday, April 3, 2018 1 Introduction to axiomatic semantics The idea in axiomatic semantics is to give specifications

More information

CS 242. Fundamentals. Reading: See last slide

CS 242. Fundamentals. Reading: See last slide CS 242 Fundamentals Reading: See last slide Syntax and Semantics of Programs Syntax The symbols used to write a program Semantics The actions that occur when a program is executed Programming language

More information

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS What is discrete? Sets (Rosen, Chapter 2) TOPICS Discrete math Set Definition Set Operations Tuples Consisting of distinct or unconnected elements, not continuous (calculus) Helps us in Computer Science

More information

Semantics of programming languages

Semantics of programming languages Semantics of programming languages Informatics 2A: Lecture 27 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 21 November, 2011 1 / 19 1 2 3 4 2 / 19 Semantics for programming

More information

Lecture 5: Implementing Lists, Version 1

Lecture 5: Implementing Lists, Version 1 CS18 Integrated Introduction to Computer Science Fisler, Nelson Lecture 5: Implementing Lists, Version 1 Contents 1 Implementing Lists 1 2 Methods 2 2.1 isempty...........................................

More information

T Reactive Systems: Kripke Structures and Automata

T Reactive Systems: Kripke Structures and Automata Tik-79.186 Reactive Systems 1 T-79.186 Reactive Systems: Kripke Structures and Automata Spring 2005, Lecture 3 January 31, 2005 Tik-79.186 Reactive Systems 2 Properties of systems invariants: the system

More information

CS 101 Fall 2005 Midterm 2 Name: ID:

CS 101 Fall 2005 Midterm 2 Name:  ID: This exam is open text book but closed-notes, closed-calculator, closed-neighbor, etc. Questions are worth different amounts (in particular, the final two questions are worth substantially more than any

More information

Lectures 20, 21: Axiomatic Semantics

Lectures 20, 21: Axiomatic Semantics Lectures 20, 21: Axiomatic Semantics Polyvios Pratikakis Computer Science Department, University of Crete Type Systems and Static Analysis Based on slides by George Necula Pratikakis (CSD) Axiomatic Semantics

More information

Lecture 5 - Axiomatic semantics

Lecture 5 - Axiomatic semantics Program Verification March 2014 Lecture 5 - Axiomatic semantics Lecturer: Noam Rinetzky Scribes by: Nir Hemed 1.1 Axiomatic semantics The development of the theory is contributed to Robert Floyd, C.A.R

More information

Program Analysis: Lecture 02 Page 1 of 32

Program Analysis: Lecture 02 Page 1 of 32 Program Analysis: Lecture 02 Page 1 of 32 Program Analysis/ Mooly Sagiv Lecture 1, 31/10/2012 Operational Semantics Notes by: Kalev Alpernas As background to the subject of Program Analysis, we will first

More information

Lecture 7 Objects and Classes

Lecture 7 Objects and Classes Lecture 7 Objects and Classes An Introduction to Data Abstraction MIT AITI June 13th, 2005 1 What do we know so far? Primitives: int, double, boolean, String* Variables: Stores values of one type. Arrays:

More information

COMS 1003 Fall Introduction to Computer Programming in C. Bits, Boolean Logic & Discrete Math. September 13 th

COMS 1003 Fall Introduction to Computer Programming in C. Bits, Boolean Logic & Discrete Math. September 13 th COMS 1003 Fall 2005 Introduction to Computer Programming in C Bits, Boolean Logic & Discrete Math September 13 th Hello World! Logistics See the website: http://www.cs.columbia.edu/~locasto/ Course Web

More information

CSc 372 Comparative Programming Languages

CSc 372 Comparative Programming Languages CSc 372 Comparative Programming Languages 8 : Haskell Function Examples Christian Collberg collberg+372@gmail.com Department of Computer Science University of Arizona Copyright c 2005 Christian Collberg

More information

Scheme: Data. CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, Glenn G.

Scheme: Data. CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, Glenn G. Scheme: Data CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, 2017 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks ggchappell@alaska.edu

More information

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions): CS 70 Discrete Mathematics for CS Spring 2005 Clancy/Wagner Notes 7 This lecture returns to the topic of propositional logic. Whereas in Lecture Notes 1 we studied this topic as a way of understanding

More information

Computation Club: Gödel s theorem

Computation Club: Gödel s theorem Computation Club: Gödel s theorem The big picture mathematicians do a lot of reasoning and write a lot of proofs formal systems try to capture the ideas of reasoning and proof in a purely mechanical set

More information

Types and Static Type Checking (Introducing Micro-Haskell)

Types and Static Type Checking (Introducing Micro-Haskell) Types and Static (Introducing Micro-Haskell) Informatics 2A: Lecture 13 Alex Simpson School of Informatics University of Edinburgh als@inf.ed.ac.uk 16 October, 2012 1 / 21 1 Types 2 3 4 2 / 21 Thus far

More information

The semantics of a programming language is concerned with the meaning of programs, that is, how programs behave when executed on computers.

The semantics of a programming language is concerned with the meaning of programs, that is, how programs behave when executed on computers. Semantics The semantics of a programming language is concerned with the meaning of programs, that is, how programs behave when executed on computers. The semantics of a programming language assigns a precise

More information

CSc 372. Comparative Programming Languages. 8 : Haskell Function Examples. Department of Computer Science University of Arizona

CSc 372. Comparative Programming Languages. 8 : Haskell Function Examples. Department of Computer Science University of Arizona 1/43 CSc 372 Comparative Programming Languages 8 : Haskell Function Examples Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2013 Christian Collberg Functions over Lists

More information

On Meaning Preservation of a Calculus of Records

On Meaning Preservation of a Calculus of Records On Meaning Preservation of a Calculus of Records Emily Christiansen and Elena Machkasova Computer Science Discipline University of Minnesota, Morris Morris, MN 56267 chri1101, elenam@morris.umn.edu Abstract

More information

Chapter 3: Theory of Modular Arithmetic 1. Chapter 3: Theory of Modular Arithmetic

Chapter 3: Theory of Modular Arithmetic 1. Chapter 3: Theory of Modular Arithmetic Chapter 3: Theory of Modular Arithmetic 1 Chapter 3: Theory of Modular Arithmetic SECTION A Introduction to Congruences By the end of this section you will be able to deduce properties of large positive

More information

Types and Static Type Checking (Introducing Micro-Haskell)

Types and Static Type Checking (Introducing Micro-Haskell) Types and Static (Introducing Micro-Haskell) Informatics 2A: Lecture 14 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 17 October 2017 1 / 21 1 Types 2 3 4 2 / 21 So far in

More information

Overview. Probabilistic Programming. Dijkstra s guarded command language: Syntax. Elementary pgcl ingredients. Lecture #4: Probabilistic GCL

Overview. Probabilistic Programming. Dijkstra s guarded command language: Syntax. Elementary pgcl ingredients. Lecture #4: Probabilistic GCL Overview Lecture #4: Probabilistic GCL 1 Joost-Pieter Katoen 2 3 Recursion RWTH Lecture Series on 2018 Joost-Pieter Katoen 1/31 Joost-Pieter Katoen 2/31 Dijkstra s guarded command language: Syntax Elementary

More information

PROGRAM ANALYSIS & SYNTHESIS

PROGRAM ANALYSIS & SYNTHESIS Lecture 02 Structural Operational Semantics (SOS) PROGRAM ANALYSIS & SYNTHESIS EranYahav 1 Previously static analysis over-approximation of program behavior abstract interpretation abstraction, transformers,

More information

Software Design and Analysis for Engineers

Software Design and Analysis for Engineers Software Design and Analysis for Engineers by Dr. Lesley Shannon Email: lshannon@ensc.sfu.ca Course Website: http://www.ensc.sfu.ca/~lshannon/courses/ensc251 Simon Fraser University Slide Set: 2 Date:

More information

Final Exam 2, CS154. April 25, 2010

Final Exam 2, CS154. April 25, 2010 inal Exam 2, CS154 April 25, 2010 Exam rules. he exam is open book and open notes you can use any printed or handwritten material. However, no electronic devices are allowed. Anything with an on-off switch

More information

Tail Calls. CMSC 330: Organization of Programming Languages. Tail Recursion. Tail Recursion (cont d) Names and Binding. Tail Recursion (cont d)

Tail Calls. CMSC 330: Organization of Programming Languages. Tail Recursion. Tail Recursion (cont d) Names and Binding. Tail Recursion (cont d) CMSC 330: Organization of Programming Languages Tail Calls A tail call is a function call that is the last thing a function does before it returns let add x y = x + y let f z = add z z (* tail call *)

More information

Chapter 3: Propositional Languages

Chapter 3: Propositional Languages Chapter 3: Propositional Languages We define here a general notion of a propositional language. We show how to obtain, as specific cases, various languages for propositional classical logic and some non-classical

More information

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions): CS 70 Discrete Mathematics for CS Fall 2003 Wagner Lecture 7 This lecture returns to the topic of propositional logic. Whereas in Lecture 1 we studied this topic as a way of understanding proper reasoning

More information

Tips from the experts: How to waste a lot of time on this assignment

Tips from the experts: How to waste a lot of time on this assignment Com S 227 Spring 2018 Assignment 1 100 points Due Date: Friday, September 14, 11:59 pm (midnight) Late deadline (25% penalty): Monday, September 17, 11:59 pm General information This assignment is to be

More information

STUDENT LESSON A5 Designing and Using Classes

STUDENT LESSON A5 Designing and Using Classes STUDENT LESSON A5 Designing and Using Classes 1 STUDENT LESSON A5 Designing and Using Classes INTRODUCTION: This lesson discusses how to design your own classes. This can be the most challenging part of

More information

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,,

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,, CMPSCI 601: Recall From Last Time Lecture 5 Definition: A context-free grammar (CFG) is a 4- tuple, variables = nonterminals, terminals, rules = productions,,, are all finite. 1 ( ) $ Pumping Lemma for

More information

Creating and Using Objects

Creating and Using Objects Creating and Using Objects 1 Fill in the blanks Object behaviour is described by, and object state is described by. Fill in the blanks Object behaviour is described by methods, and object state is described

More information

CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures

CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures Dan Grossman Fall 2014 Hi! I m not Hal J I love this stuff and have taught

More information

Where We Are. CMSC 330: Organization of Programming Languages. This Lecture. Programming Languages. Motivation for Grammars

Where We Are. CMSC 330: Organization of Programming Languages. This Lecture. Programming Languages. Motivation for Grammars CMSC 330: Organization of Programming Languages Context Free Grammars Where We Are Programming languages Ruby OCaml Implementing programming languages Scanner Uses regular expressions Finite automata Parser

More information

CS February 17

CS February 17 Discrete Mathematics CS 26 February 7 Equal Boolean Functions Two Boolean functions F and G of degree n are equal iff for all (x n,..x n ) B, F (x,..x n ) = G (x,..x n ) Example: F(x,y,z) = x(y+z), G(x,y,z)

More information

Lexical and Syntax Analysis

Lexical and Syntax Analysis Lexical and Syntax Analysis (of Programming Languages) Top-Down Parsing Lexical and Syntax Analysis (of Programming Languages) Top-Down Parsing Easy for humans to write and understand String of characters

More information

Midterm 2 Solutions Many acceptable answers; one was the following: (defparameter g1

Midterm 2 Solutions Many acceptable answers; one was the following: (defparameter g1 Midterm 2 Solutions 1. [20 points] Consider the language that consist of possibly empty lists of the identifier x enclosed by parentheses and separated by commas. The language includes { () (x) (x,x) (x,x,x)

More information

COMP-202: Foundations of Programming. Lecture 26: Review; Wrap-Up Jackie Cheung, Winter 2016

COMP-202: Foundations of Programming. Lecture 26: Review; Wrap-Up Jackie Cheung, Winter 2016 COMP-202: Foundations of Programming Lecture 26: Review; Wrap-Up Jackie Cheung, Winter 2016 Announcements Final is scheduled for Apr 21, 2pm 5pm GYM FIELD HOUSE Rows 1-21 Please submit course evaluations!

More information

Formal Semantics of Programming Languages

Formal Semantics of Programming Languages Formal Semantics of Programming Languages Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson http://www.daimi.au.dk/~bra8130/wiley_book/wiley.html Benefits of formal

More information

CSE 142 Su 04 Computer Programming 1 - Java. Objects

CSE 142 Su 04 Computer Programming 1 - Java. Objects Objects Objects have state and behavior. State is maintained in instance variables which live as long as the object does. Behavior is implemented in methods, which can be called by other objects to request

More information

CS 251 Intermediate Programming Methods and Classes

CS 251 Intermediate Programming Methods and Classes CS 251 Intermediate Programming Methods and Classes Brooke Chenoweth University of New Mexico Fall 2018 Methods An operation that can be performed on an object Has return type and parameters Method with

More information

CS 251 Intermediate Programming Methods and More

CS 251 Intermediate Programming Methods and More CS 251 Intermediate Programming Methods and More Brooke Chenoweth University of New Mexico Spring 2018 Methods An operation that can be performed on an object Has return type and parameters Method with

More information

Lexical and Syntax Analysis. Top-Down Parsing

Lexical and Syntax Analysis. Top-Down Parsing Lexical and Syntax Analysis Top-Down Parsing Easy for humans to write and understand String of characters Lexemes identified String of tokens Easy for programs to transform Data structure Syntax A syntax

More information

About this exam review

About this exam review Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review

More information

Boolean Algebra & Digital Logic

Boolean Algebra & Digital Logic Boolean Algebra & Digital Logic Boolean algebra was developed by the Englishman George Boole, who published the basic principles in the 1854 treatise An Investigation of the Laws of Thought on Which to

More information

Formal Semantics of Programming Languages

Formal Semantics of Programming Languages Formal Semantics of Programming Languages Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson http://www.daimi.au.dk/~bra8130/wiley_book/wiley.html Benefits of formal

More information

CSCI 161 Introduction to Computer Science

CSCI 161 Introduction to Computer Science CSCI 161 Introduction to Computer Science Department of Mathematics and Computer Science Lecture 2b A First Look at Class Design Last Time... We saw: How fields (instance variables) are declared How methods

More information

Lecture 2: SML Basics

Lecture 2: SML Basics 15-150 Lecture 2: SML Basics Lecture by Dan Licata January 19, 2012 I d like to start off by talking about someone named Alfred North Whitehead. With someone named Bertrand Russell, Whitehead wrote Principia

More information

Compiler Theory. (Semantic Analysis and Run-Time Environments)

Compiler Theory. (Semantic Analysis and Run-Time Environments) Compiler Theory (Semantic Analysis and Run-Time Environments) 005 Semantic Actions A compiler must do more than recognise whether a sentence belongs to the language of a grammar it must do something useful

More information

These notes are intended exclusively for the personal usage of the students of CS352 at Cal Poly Pomona. Any other usage is prohibited without

These notes are intended exclusively for the personal usage of the students of CS352 at Cal Poly Pomona. Any other usage is prohibited without These notes are intended exclusively for the personal usage of the students of CS352 at Cal Poly Pomona. Any other usage is prohibited without previous written authorization. 1 2 The simplest way to create

More information

6.001 Notes: Section 6.1

6.001 Notes: Section 6.1 6.001 Notes: Section 6.1 Slide 6.1.1 When we first starting talking about Scheme expressions, you may recall we said that (almost) every Scheme expression had three components, a syntax (legal ways of

More information

CSE 113 A. Announcements - Lab

CSE 113 A. Announcements - Lab CSE 113 A February 21-25, 2011 Announcements - Lab Lab 1, 2, 3, 4; Practice Assignment 1, 2, 3, 4 grades are available in Web-CAT look under Results -> Past Results and if looking for Lab 1, make sure

More information

News. Programming Languages. Complex types: Lists. Recap: ML s Holy Trinity. CSE 130: Spring 2012

News. Programming Languages. Complex types: Lists. Recap: ML s Holy Trinity. CSE 130: Spring 2012 News CSE 130: Spring 2012 Programming Languages On webpage: Suggested HW #1 PA #1 (due next Fri 4/13) Lecture 2: A Crash Course in ML Please post questions to Piazza Ranjit Jhala UC San Diego Today: A

More information

CS 251 Intermediate Programming Java Basics

CS 251 Intermediate Programming Java Basics CS 251 Intermediate Programming Java Basics Brooke Chenoweth University of New Mexico Spring 2018 Prerequisites These are the topics that I assume that you have already seen: Variables Boolean expressions

More information

Intro to Computer Science 2. Inheritance

Intro to Computer Science 2. Inheritance Intro to Computer Science 2 Inheritance Admin Questions? Quizzes Midterm Exam Announcement Inheritance Inheritance Specializing a class Inheritance Just as In science we have inheritance and specialization

More information

CS 115 Lecture 4. More Python; testing software. Neil Moore

CS 115 Lecture 4. More Python; testing software. Neil Moore CS 115 Lecture 4 More Python; testing software Neil Moore Department of Computer Science University of Kentucky Lexington, Kentucky 40506 neil@cs.uky.edu 8 September 2015 Syntax: Statements A statement

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Fall 2016 Lecture 7a Andrew Tolmach Portland State University 1994-2016 Values and Types We divide the universe of values according to types A type is a set of values and a

More information

SCHEME 7. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. October 29, 2015

SCHEME 7. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. October 29, 2015 SCHEME 7 COMPUTER SCIENCE 61A October 29, 2015 1 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,

More information

CMSC 330: Organization of Programming Languages. Operational Semantics

CMSC 330: Organization of Programming Languages. Operational Semantics CMSC 330: Organization of Programming Languages Operational Semantics Notes about Project 4, Parts 1 & 2 Still due today (7/2) Will not be graded until 7/11 (along with Part 3) You are strongly encouraged

More information

Programming Language Concepts, cs2104 Lecture 04 ( )

Programming Language Concepts, cs2104 Lecture 04 ( ) Programming Language Concepts, cs2104 Lecture 04 (2003-08-29) Seif Haridi Department of Computer Science, NUS haridi@comp.nus.edu.sg 2003-09-05 S. Haridi, CS2104, L04 (slides: C. Schulte, S. Haridi) 1

More information

CMSC 330: Organization of Programming Languages. Formal Semantics of a Prog. Lang. Specifying Syntax, Semantics

CMSC 330: Organization of Programming Languages. Formal Semantics of a Prog. Lang. Specifying Syntax, Semantics Recall Architecture of Compilers, Interpreters CMSC 330: Organization of Programming Languages Source Scanner Parser Static Analyzer Operational Semantics Intermediate Representation Front End Back End

More information

CS70 - Lecture 6. Graphs: Coloring; Special Graphs. 1. Review of L5 2. Planar Five Color Theorem 3. Special Graphs:

CS70 - Lecture 6. Graphs: Coloring; Special Graphs. 1. Review of L5 2. Planar Five Color Theorem 3. Special Graphs: CS70 - Lecture 6 Graphs: Coloring; Special Graphs 1. Review of L5 2. Planar Five Color Theorem 3. Special Graphs: Trees: Three characterizations Hypercubes: Strongly connected! Administration You need

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Operational Semantics CMSC 330 Summer 2018 1 Formal Semantics of a Prog. Lang. Mathematical description of the meaning of programs written in that language

More information

Database Management System Prof. D. Janakiram Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

Database Management System Prof. D. Janakiram Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. Database Management System Prof. D. Janakiram Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. # 20 Concurrency Control Part -1 Foundations for concurrency

More information

1 Probability Review. CS 124 Section #8 Hashing, Skip Lists 3/20/17. Expectation (weighted average): the expectation of a random quantity X is:

1 Probability Review. CS 124 Section #8 Hashing, Skip Lists 3/20/17. Expectation (weighted average): the expectation of a random quantity X is: CS 124 Section #8 Hashing, Skip Lists 3/20/17 1 Probability Review Expectation (weighted average): the expectation of a random quantity X is: x= x P (X = x) For each value x that X can take on, we look

More information

Public-Service Announcements

Public-Service Announcements Public-Service Announcements "CSUA has a Welcome BBQ on Wednesday, 2 September at 7PM in the Woz. Open to anyone interested in computer science. Please drop by our office located in 311 Soda Hall" Last

More information

CS 177 Week 5 Recitation Slides. Loops

CS 177 Week 5 Recitation Slides. Loops CS 177 Week 5 Recitation Slides Loops 1 Announcements Project 1 due tonight at 9PM because of evac. Project 2 is posted and is due on Oct. 8th 9pm Exam 1 Wednesday Sept 30 6:30 7:20 PM Please see class

More information

CS2 Algorithms and Data Structures Note 1

CS2 Algorithms and Data Structures Note 1 CS2 Algorithms and Data Structures Note 1 Analysing Algorithms This thread of the course is concerned with the design and analysis of good algorithms and data structures. Intuitively speaking, an algorithm

More information

(a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are rational they can be written as the ratio of integers a 1

(a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are rational they can be written as the ratio of integers a 1 CS 70 Discrete Mathematics for CS Fall 2000 Wagner MT1 Sol Solutions to Midterm 1 1. (16 pts.) Theorems and proofs (a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are

More information

Timo Latvala. January 28, 2004

Timo Latvala. January 28, 2004 Reactive Systems: Kripke Structures and Automata Timo Latvala January 28, 2004 Reactive Systems: Kripke Structures and Automata 3-1 Properties of systems invariants: the system never reaches a bad state

More information

Programming Language Concepts, cs2104 Lecture 01 ( )

Programming Language Concepts, cs2104 Lecture 01 ( ) Programming Language Concepts, cs2104 Lecture 01 (2003-08-15) Seif Haridi Department of Computer Science, NUS haridi@comp.nus.edu.sg 2002-08-15 S. Haridi, CS2104, L01 (slides: C. Schulte, S. Haridi) 1

More information

sample exam Concurrent Programming tda383/dit390 Sample exam March 2016 Time:?? Place: Johanneberg

sample exam Concurrent Programming tda383/dit390 Sample exam March 2016 Time:?? Place: Johanneberg sample exam Concurrent Programming tda383/dit390 Sample exam March 2016 Time:?? Place: Johanneberg Responsible Michał Pałka 0707966066 Result Available no later than?-?-2016 Aids Max 2 books and max 4

More information

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Semantics via Syntax. f (4) = if define f (x) =2 x + 55. 1 Semantics via Syntax The specification of a programming language starts with its syntax. As every programmer knows, the syntax of a language comes in the shape of a variant of a BNF (Backus-Naur Form)

More information

Application: Programming Language Semantics

Application: Programming Language Semantics Chapter 8 Application: Programming Language Semantics Prof. Dr. K. Madlener: Specification and Verification in Higher Order Logic 527 Introduction to Programming Language Semantics Programming Language

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #06 Loops: Operators

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #06 Loops: Operators Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #06 Loops: Operators We have seen comparison operators, like less then, equal to, less than or equal. to and

More information

CS187 - Science Gateway Seminar for CS and Math

CS187 - Science Gateway Seminar for CS and Math CS187 - Science Gateway Seminar for CS and Math Fall 2013 Class 6 Sep. 19, 2013 Programming and Programming Languages Why, How and What? A programming language is a formal language (vs. natural language)

More information

Java Coding 3. Over & over again!

Java Coding 3. Over & over again! Java Coding 3 Over & over again! Repetition Java repetition statements while (condition) statement; do statement; while (condition); where for ( init; condition; update) statement; statement is any Java

More information

COP 3330 Final Exam Review

COP 3330 Final Exam Review COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time

More information

false, import, new 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4

false, import, new 1 class Lecture2 { 2 3 Data types, Variables, and Operators 4 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4 5 } 6 7 // Keywords: 8 byte, short, int, long, char, float, double, boolean, true, false, import, new Zheng-Liang Lu Java Programming 44

More information