Introduction to JavaCard Dynamic Logic
|
|
- Arleen Small
- 6 years ago
- Views:
Transcription
1 Introduction to JavaCard Dynamic Logic Prof. P. H. Schmitt, Christian Engel, Benjamin Weiß December 10, 2008 Introduction to JavaCard Dynamic Logic December 10, / 13
2 Some Java Features Assignments, complex expressions with side effects int i = 0; if ((i=2) >= 2) {i++;} // value of i? Introduction to JavaCard Dynamic Logic December 10, / 13
3 Some Java Features Assignments, complex expressions with side effects int i = 0; if ((i=2) >= 2) {i++;} // value of i? Abrupt termination Introduction to JavaCard Dynamic Logic December 10, / 13
4 Some Java Features Assignments, complex expressions with side effects int i = 0; if ((i=2) >= 2) {i++;} // value of i? Abrupt termination Exceptions (try catch finally) Introduction to JavaCard Dynamic Logic December 10, / 13
5 Some Java Features Assignments, complex expressions with side effects int i = 0; if ((i=2) >= 2) {i++;} // value of i? Abrupt termination Exceptions (try catch finally) Local jumps return, break, continue Introduction to JavaCard Dynamic Logic December 10, / 13
6 Some Java Features Assignments, complex expressions with side effects int i = 0; if ((i=2) >= 2) {i++;} // value of i? Abrupt termination Exceptions (try catch finally) Local jumps return, break, continue Aliasing Different navigation expressions may be same object reference I = o.age. = 1 -> u.age = 2; o.age. = u.age? Depends on whether I = o. = u Introduction to JavaCard Dynamic Logic December 10, / 13
7 Some Java Features Assignments, complex expressions with side effects int i = 0; if ((i=2) >= 2) {i++;} // value of i? Abrupt termination Exceptions (try catch finally) Local jumps return, break, continue Aliasing Different navigation expressions may be same object reference I = o.age. = 1 -> u.age = 2; o.age. = u.age? Depends on whether I = o. = u Method calls, blocks Introduction to JavaCard Dynamic Logic December 10, / 13
8 Some Java Features Assignments, complex expressions with side effects int i = 0; if ((i=2) >= 2) {i++;} // value of i? Abrupt termination Exceptions (try catch finally) Local jumps return, break, continue Aliasing Different navigation expressions may be same object reference I = o.age. = 1 -> u.age = 2; o.age. = u.age? Depends on whether I = o. = u Method calls, blocks Solution within KeY to be discussed in detail Introduction to JavaCard Dynamic Logic December 10, / 13
9 More Java Features Addressed in KeY Java s rules for localisation of attributes and method implementations (polymorphism, dynamic binding) Introduction to JavaCard Dynamic Logic December 10, / 13
10 More Java Features Addressed in KeY Java s rules for localisation of attributes and method implementations (polymorphism, dynamic binding) Scope (class/instance) Context (static/runtime) Visibility super Introduction to JavaCard Dynamic Logic December 10, / 13
11 More Java Features Addressed in KeY Java s rules for localisation of attributes and method implementations (polymorphism, dynamic binding) Scope (class/instance) Context (static/runtime) Visibility super Solution: branch proof if implementation not uniquely determined Introduction to JavaCard Dynamic Logic December 10, / 13
12 More Java Features Addressed in KeY Java s rules for localisation of attributes and method implementations (polymorphism, dynamic binding) Scope (class/instance) Context (static/runtime) Visibility super Solution: branch proof if implementation not uniquely determined Run time errors (null pointer exceptions) Functions that model attributes are partially defined Introduction to JavaCard Dynamic Logic December 10, / 13
13 More Java Features Addressed in KeY Java s rules for localisation of attributes and method implementations (polymorphism, dynamic binding) Scope (class/instance) Context (static/runtime) Visibility super Solution: branch proof if implementation not uniquely determined Run time errors (null pointer exceptions) Functions that model attributes are partially defined Solution: optional rule set enforces proof of!(o. = null) (whenever object reference o accessed) Introduction to JavaCard Dynamic Logic December 10, / 13
14 More Java Features Java Card data types boolean, char, String int, byte, long (cyclic!) Arrays Solution: optional rule sets IN/int, rules for built-ins Introduction to JavaCard Dynamic Logic December 10, / 13
15 More Java Features Java Card data types boolean, char, String int, byte, long (cyclic!) Arrays Solution: optional rule sets IN/int, rules for built-ins Object creation and initialisation Trick to keep same universe U in all states: all objects exist anytime, use attributes o.created, o.initialized Introduction to JavaCard Dynamic Logic December 10, / 13
16 Side Effects and Complex Expressions int i = 0; if ((i=2) >= 2) {i++;} // value of i? Java expressions can assign values (assignment operators) FOL/DL terms have no side effects Introduction to JavaCard Dynamic Logic December 10, / 13
17 Side Effects and Complex Expressions int i = 0; if ((i=2) >= 2) {i++;} // value of i? Java expressions can assign values (assignment operators) FOL/DL terms have no side effects Decomposition of complex terms following symbolic execution as defined for expressions Java language specification Local program transformations iterated-assignment Γ ==> π y = t; x = y; ω φ, Γ ==> π x = y = t; ω φ, t simple Introduction to JavaCard Dynamic Logic December 10, / 13
18 Side Effects and Complex Expressions int i = 0; if ((i=2) >= 2) {i++;} // value of i? Java expressions can assign values (assignment operators) FOL/DL terms have no side effects Decomposition of complex terms following symbolic execution as defined for expressions Java language specification Local program transformations iterated-assignment Γ ==> π y = t; x = y; ω φ, Γ ==> π x = y = t; ω φ, t simple Temporary program variables var<n> store intermediate results if-eval Γ ==> π boolean v new; v new = b; if (v new ) {α}; ω φ, Γ ==> π if (b) {α}; ω φ, where b complex Introduction to JavaCard Dynamic Logic December 10, / 13
19 Side Effects and Complex Expressions, Cont d Applying rule to statement including guard with side effect is incorrect Restrict applicability of if-then and other rules with guards: Guard expression needs to be simple (ie, side effect-free) if-split Γ, b =. TRUE ==> π α; ω φ, Γ, b =. FALSE ==> π ω φ, Γ ==> π if (b) {α}; ω φ, where b simple javadl/complex.key Demo Introduction to JavaCard Dynamic Logic December 10, / 13
20 Abrupt Termination Redirection of control flow via return, break, continue, exceptions π try {ξα} catch(e) {γ} finally {ɛ}; ω φ Introduction to JavaCard Dynamic Logic December 10, / 13
21 Abrupt Termination Redirection of control flow via return, break, continue, exceptions π try {ξα} catch(e) {γ} finally {ɛ}; ω φ Solution: rules work on first active statement, try part of prefix Introduction to JavaCard Dynamic Logic December 10, / 13
22 Abrupt Termination Redirection of control flow via return, break, continue, exceptions π try {ξα} catch(e) {γ} finally {ɛ}; ω φ Solution: rules work on first active statement, try part of prefix try-throw (exc simple) π if (exc instanceof Exception) { Γ ==> try {e = exc; γ} finally {ɛ} φ, } else {ɛ throw exc}; ω Γ ==> π try {throw exc; α} catch(e) {γ} finally {ɛ}; ω φ, Introduction to JavaCard Dynamic Logic December 10, / 13
23 Aliasing Naive alias resolution causes proof split (on o. = u) at each access Γ ==> o.age. = 1 -> u.age = 2; o.age. = u.age, Introduction to JavaCard Dynamic Logic December 10, / 13
24 Aliasing Naive alias resolution causes proof split (on o. = u) at each access Γ ==> o.age. = 1 -> u.age = 2; o.age. = u.age, Unnecessary in many cases! Γ ==> o.age. = 1 -> u.age = 2; o.age = 2; o.age. = u.age, Γ ==> o.age. = 1 -> u.age = 2; u.age. = 2, Introduction to JavaCard Dynamic Logic December 10, / 13
25 Aliasing Naive alias resolution causes proof split (on o. = u) at each access Γ ==> o.age. = 1 -> u.age = 2; o.age. = u.age, Unnecessary in many cases! Γ ==> o.age. = 1 -> u.age = 2; o.age = 2; o.age. = u.age, Γ ==> o.age. = 1 -> u.age = 2; u.age. = 2, Updates avoid such proof splits: Delayed state computation until clear what actually required Simplification of updates Introduction to JavaCard Dynamic Logic December 10, / 13
26 Updates for Java Let loc be either one of program variable x Introduction to JavaCard Dynamic Logic December 10, / 13
27 Updates for Java Let loc be either one of program variable x attribute access o.attr (o has object type) Introduction to JavaCard Dynamic Logic December 10, / 13
28 Updates for Java Let loc be either one of program variable x attribute access o.attr (o has object type) array access a[i] (a has array type, not discussed here) Introduction to JavaCard Dynamic Logic December 10, / 13
29 Updates for Java Let loc be either one of where program variable x attribute access o.attr (o has object type) array access a[i] (a has array type, not discussed here) assign Γ ==> {loc := val} π ω φ, Γ ==> π loc=val; ω φ, loc and val satisfy above restrictions val is a side-effect free term, {loc := val} is DL update (usage and semantics as in simple DL) Introduction to JavaCard Dynamic Logic December 10, / 13
30 Computing Effect of Updates: Attributes Use conditional terms to delay splitting further (\if (t1 = t2) \then t \else e) I,β = { t I,β t I,β 1 = t I,β 2 e I,β otherwise Introduction to JavaCard Dynamic Logic December 10, / 13
31 Computing Effect of Updates: Attributes Use conditional terms to delay splitting further (\if (t1 = t2) \then t \else e) I,β = { t I,β t I,β 1 = t I,β 2 e I,β otherwise Computing update followed by attribute access {o.a := t}o.a t {o.a := t}u.b ({o.a := t}u).b {o.a := t}u.a \if (({o.a:=t}u)=o) \then t \else ({o.a:=t}u).a Introduction to JavaCard Dynamic Logic December 10, / 13
32 Computing Effect of Updates: Attributes Use conditional terms to delay splitting further (\if (t1 = t2) \then t \else e) I,β = Computing update followed by attribute access { t I,β t I,β 1 = t I,β 2 e I,β otherwise {o.a := t}o.a t {o.a := t}u.b ({o.a := t}u).b {o.a := t}u.a \if (({o.a:=t}u)=o) \then t \else ({o.a:=t}u).a Example {o.a := o}o.a.a.b Introduction to JavaCard Dynamic Logic December 10, / 13
33 Computing Effect of Updates: Attributes Use conditional terms to delay splitting further (\if (t1 = t2) \then t \else e) I,β = Computing update followed by attribute access { t I,β t I,β 1 = t I,β 2 e I,β otherwise {o.a := t}o.a t {o.a := t}u.b ({o.a := t}u).b {o.a := t}u.a \if (({o.a:=t}u)=o) \then t \else ({o.a:=t}u).a Example {o.a := o}o.a.a.b {o.a := o}o.a.a.b Introduction to JavaCard Dynamic Logic December 10, / 13
34 Computing Effect of Updates: Attributes Use conditional terms to delay splitting further (\if (t1 = t2) \then t \else e) I,β = Computing update followed by attribute access { t I,β t I,β 1 = t I,β 2 e I,β otherwise {o.a := t}o.a t {o.a := t}u.b ({o.a := t}u).b {o.a := t}u.a \if (({o.a:=t}u)=o) \then t \else ({o.a:=t}u).a Example {o.a := o}o.a.a.b ({o.a := o}o.a.a).b Introduction to JavaCard Dynamic Logic December 10, / 13
35 Computing Effect of Updates: Attributes Use conditional terms to delay splitting further (\if (t1 = t2) \then t \else e) I,β = Computing update followed by attribute access { t I,β t I,β 1 = t I,β 2 e I,β otherwise {o.a := t}o.a t {o.a := t}u.b ({o.a := t}u).b {o.a := t}u.a \if (({o.a:=t}u)=o) \then t \else ({o.a:=t}u).a Example {o.a := o}o.a.a.b ( \if (({o.a := o}o.a) = o) \then o \else ({o.a := o}o.a).a ).b Introduction to JavaCard Dynamic Logic December 10, / 13
36 Computing Effect of Updates: Attributes Use conditional terms to delay splitting further (\if (t1 = t2) \then t \else e) I,β = Computing update followed by attribute access { t I,β t I,β 1 = t I,β 2 e I,β otherwise {o.a := t}o.a t {o.a := t}u.b ({o.a := t}u).b {o.a := t}u.a \if (({o.a:=t}u)=o) \then t \else ({o.a:=t}u).a Example {o.a := o}o.a.a.b ( \if (o = o) \then o \else o.a ).b Introduction to JavaCard Dynamic Logic December 10, / 13
37 Computing Effect of Updates: Attributes Use conditional terms to delay splitting further (\if (t1 = t2) \then t \else e) I,β = Computing update followed by attribute access { t I,β t I,β 1 = t I,β 2 e I,β otherwise {o.a := t}o.a t {o.a := t}u.b ({o.a := t}u).b {o.a := t}u.a \if (({o.a:=t}u)=o) \then t \else ({o.a:=t}u).a Example {o.a := o}o.a.a.b o.b Introduction to JavaCard Dynamic Logic December 10, / 13
38 Parallel Updates Computing update followed by update results in parallel update: {l 1 := r 1 }{l 2 := r 2 } = {{l 1 := r 1 }, {{l 1 := r 1 } l 2 := {l 1 := r 1 }r 2 }} where {l := r} f (t 1,..., t n ) = f ({l := r}t 1,..., {l := r}t n ) Introduction to JavaCard Dynamic Logic December 10, / 13
39 Parallel Updates Computing update followed by update results in parallel update: {l 1 := r 1 }{l 2 := r 2 } = {{l 1 := r 1 }, {{l 1 := r 1 } l 2 := {l 1 := r 1 }r 2 }} where {l := r} f (t 1,..., t n ) = f ({l := r}t 1,..., {l := r}t n ) Syntax {l 1 := v 1,..., l n := v n } Introduction to JavaCard Dynamic Logic December 10, / 13
40 Parallel Updates Computing update followed by update results in parallel update: {l 1 := r 1 }{l 2 := r 2 } = {{l 1 := r 1 }, {{l 1 := r 1 } l 2 := {l 1 := r 1 }r 2 }} where {l := r} f (t 1,..., t n ) = f ({l := r}t 1,..., {l := r}t n ) Syntax {l 1 := v 1,..., l n := v n } Semantics All l i and v i computed in old state All updates done simultaneously If conflict l i = l j, v i v j later update wins Introduction to JavaCard Dynamic Logic December 10, / 13
41 Method Call Method call with actual parameters arg 1,..., arg n {arg 1 := t 1,..., arg n := t n, o := t o } o.m(arg 1,..., arg n ); φ Where method declaration is: void m(t 1 p 1,..., T n p n ) Introduction to JavaCard Dynamic Logic December 10, / 13
42 Method Call Method call with actual parameters arg 1,..., arg n {arg 1 := t 1,..., arg n := t n, o := t o } o.m(arg 1,..., arg n ); φ Where method declaration is: void m(t 1 p 1,..., T n p n ) What the rule method-call does: (type conformance of arg i to T i guaranteed by Java compiler) Introduction to JavaCard Dynamic Logic December 10, / 13
43 Method Call Method call with actual parameters arg 1,..., arg n {arg 1 := t 1,..., arg n := t n, o := t o } o.m(arg 1,..., arg n ); φ Where method declaration is: void m(t 1 p 1,..., T n p n ) What the rule method-call does: (type conformance of arg i to T i guaranteed by Java compiler) for each formal parameter p i of m declare & initialize new local variable T i p i = arg i ; Introduction to JavaCard Dynamic Logic December 10, / 13
44 Method Call Method call with actual parameters arg 1,..., arg n {arg 1 := t 1,..., arg n := t n, o := t o } o.m(arg 1,..., arg n ); φ Where method declaration is: void m(t 1 p 1,..., T n p n ) What the rule method-call does: (type conformance of arg i to T i guaranteed by Java compiler) for each formal parameter p i of m declare & initialize new local variable T i p i = arg i ; look up implementation class C of m split proof, if implementation not determinable Introduction to JavaCard Dynamic Logic December 10, / 13
45 Method Call Method call with actual parameters arg 1,..., arg n {arg 1 := t 1,..., arg n := t n, o := t o } o.m(arg 1,..., arg n ); φ Where method declaration is: void m(t 1 p 1,..., T n p n ) What the rule method-call does: (type conformance of arg i to T i guaranteed by Java compiler) for each formal parameter p i of m declare & initialize new local variable T i p i = arg i ; look up implementation class C of m split proof, if implementation not determinable make concrete call o.c::m(p 1,..., p n ) Introduction to JavaCard Dynamic Logic December 10, / 13
46 Method Body Expand After processing code that binds actual to formal parameters (symbolic execution of T i p i = arg i ; ) method-body-expand Γ ==> π method-frame(c(o)){ b } ω φ, Γ ==> π o.c::m(p 1,..., p n ); ω φ, Introduction to JavaCard Dynamic Logic December 10, / 13
47 Method Body Expand After processing code that binds actual to formal parameters (symbolic execution of T i p i = arg i ; ) method-body-expand Γ ==> π method-frame(c(o)){ b } ω φ, Γ ==> π o.c::m(p 1,..., p n ); ω φ, Symbolic Execution Introduction to JavaCard Dynamic Logic December 10, / 13
48 Method Body Expand After processing code that binds actual to formal parameters (symbolic execution of T i p i = arg i ; ) method-body-expand Γ ==> π method-frame(c(o)){ b } ω φ, Γ ==> π o.c::m(p 1,..., p n ); ω φ, Symbolic Execution Only static information available, proof splitting Introduction to JavaCard Dynamic Logic December 10, / 13
49 Method Body Expand After processing code that binds actual to formal parameters (symbolic execution of T i p i = arg i ; ) method-body-expand Γ ==> π method-frame(c(o)){ b } ω φ, Γ ==> π o.c::m(p 1,..., p n ); ω φ, Symbolic Execution Only static information available, proof splitting Runtime infrastructure required in calculus Introduction to JavaCard Dynamic Logic December 10, / 13
Fundamentals of Software Engineering
Fundamentals of Software Engineering Reasoning about Programs with Dynamic Logic - Part II Ina Schaefer Institute for Software Systems Engineering TU Braunschweig, Germany Slides by Wolfgang Ahrendt, Richard
More informationFundamentals of Software Engineering
Fundamentals of Software Engineering Reasoning about Programs with Dynamic Logic - Part II Ina Schaefer Institute for Software Systems Engineering TU Braunschweig, Germany Slides by Wolfgang Ahrendt, Richard
More informationSoftware Engineering using Formal Methods
Software Engineering using Formal Methods Reasoning about Programs with Dynamic Logic Wolfgang Ahrendt & Richard Bubel & Wojciech Mostowski 5 October 2011 SEFM: Java DL /GU 111005 1 / 45 Dynamic Logic
More informationFormal Systems II: Applications
Formal Systems II: Applications Functional Verification of Java Programs: Java Dynamic Logic Bernhard Beckert Mattias Ulbrich SS 2017 KIT INSTITUT FÜR THEORETISCHE INFORMATIK KIT University of the State
More informationFundamentals of Software Engineering
Fundamentals of Software Engineering Reasoning about Programs - Selected Features Ina Schaefer Institute for Software Systems Engineering TU Braunschweig, Germany Slides by Wolfgang Ahrendt, Richard Bubel,
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationVerifying Java Programs Verifying Java Programs with KeY
Verifying Java Programs Verifying Java Programs with KeY Wolfgang Schreiner Wolfgang.Schreiner@risc.jku.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.jku.at
More informationDynamic Logic with Non-rigid Functions
Dynamic Logic with Non-rigid Functions A Basis for Object-oriented Program Verification Bernhard Beckert 1 André Platzer 2 1 University of Koblenz-Landau, Department of Computer Science beckert@uni-koblenz.de
More informationWeiss Chapter 1 terminology (parenthesized numbers are page numbers)
Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement
More informationVerifying Java Programs with KeY
Verifying Java Programs with KeY Wolfgang Schreiner Wolfgang.Schreiner@risc.jku.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.jku.at Wolfgang
More informationVerifying Java Programs Verifying Java Programs with KeY
Verifying Java Programs Verifying Java Programs with KeY Wolfgang Schreiner Wolfgang.Schreiner@risc.jku.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.jku.at
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science Department Lecture 3: C# language basics Lecture Contents 2 C# basics Conditions Loops Methods Arrays Dr. Amal Khalifa, Spr 2015 3 Conditions and
More informationGetting started with Java
Getting started with Java by Vlad Costel Ungureanu for Learn Stuff Programming Languages A programming language is a formal constructed language designed to communicate instructions to a machine, particularly
More informationFormal Methods for Java
Formal Methods for Java Lecture 17: Advanced Key Jochen Hoenicke Software Engineering Albert-Ludwigs-University Freiburg December 21, 2011 Jochen Hoenicke (Software Engineering) Formal Methods for Java
More informationAssignment 4: Semantics
Assignment 4: Semantics 15-411: Compiler Design Jan Hoffmann Jonathan Burns, DeeDee Han, Anatol Liu, Alice Rao Due Thursday, November 3, 2016 (9:00am) Reminder: Assignments are individual assignments,
More informationMotivation was to facilitate development of systems software, especially OS development.
A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.
More informationMotivation was to facilitate development of systems software, especially OS development.
A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.
More informationComputer Science Department Carlos III University of Madrid Leganés (Spain) David Griol Barres
Computer Science Department Carlos III University of Madrid Leganés (Spain) David Griol Barres dgriol@inf.uc3m.es Introduction He am a driver might be syntactically correct but semantically wrong. Semantic
More informationStatic Checking and Type Systems
1 Static Checking and Type Systems Chapter 6 COP5621 Compiler Construction Copyright Robert van Engelen, Florida State University, 2007-2009 2 The Structure of our Compiler Revisited Character stream Lexical
More informationCOP4020 Programming Languages. Functional Programming Prof. Robert van Engelen
COP4020 Programming Languages Functional Programming Prof. Robert van Engelen Overview What is functional programming? Historical origins of functional programming Functional programming today Concepts
More informationBrief Summary of Java
Brief Summary of Java Java programs are compiled into an intermediate format, known as bytecode, and then run through an interpreter that executes in a Java Virtual Machine (JVM). The basic syntax of Java
More informationCSC Java Programming, Fall Java Data Types and Control Constructs
CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference
More informationChapter 13: Reference. Why reference Typing Evaluation Store Typings Safety Notes
Chapter 13: Reference Why reference Typing Evaluation Store Typings Safety Notes References Computational Effects Also known as side effects. A function or expression is said to have a side effect if,
More informationCSE431 Translation of Computer Languages
CSE431 Translation of Computer Languages Semantic Analysis Doug Shook Control Structure Analysis Three major phases for Java: Type Checking How might this apply to control structures? Reachability Analysis
More information(Not Quite) Minijava
(Not Quite) Minijava CMCS22620, Spring 2004 April 5, 2004 1 Syntax program mainclass classdecl mainclass class identifier { public static void main ( String [] identifier ) block } classdecl class identifier
More information1 Shyam sir JAVA Notes
1 Shyam sir JAVA Notes 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write
More information2 rd class Department of Programming. OOP with Java Programming
1. Structured Programming and Object-Oriented Programming During the 1970s and into the 80s, the primary software engineering methodology was structured programming. The structured programming approach
More informationArray. Prepared By - Rifat Shahriyar
Java More Details Array 2 Arrays A group of variables containing values that all have the same type Arrays are fixed length entities In Java, arrays are objects, so they are considered reference types
More information10/30/2010. Introduction to Control Statements. The if and if-else Statements (cont.) Principal forms: JAVA CONTROL STATEMENTS SELECTION STATEMENTS
JAVA CONTROL STATEMENTS Introduction to Control statements are used in programming languages to cause the flow of control to advance and branch based on changes to the state of a program. In Java, control
More informationPierce Ch. 3, 8, 11, 15. Type Systems
Pierce Ch. 3, 8, 11, 15 Type Systems Goals Define the simple language of expressions A small subset of Lisp, with minor modifications Define the type system of this language Mathematical definition using
More information3. Java - Language Constructs I
Educational Objectives 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations, Evaluation of Expressions, Type Conversions You know the basic blocks
More informationCMSC131. 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 informationSchool of Computer Science CPS109 Course Notes 5 Alexander Ferworn Updated Fall 15
Table of Contents 1 INTRODUCTION... 1 2 IF... 1 2.1 BOOLEAN EXPRESSIONS... 3 2.2 BLOCKS... 3 2.3 IF-ELSE... 4 2.4 NESTING... 5 3 SWITCH (SOMETIMES KNOWN AS CASE )... 6 3.1 A BIT ABOUT BREAK... 7 4 CONDITIONAL
More informationCS111: PROGRAMMING LANGUAGE II
CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 1(c): Java Basics (II) Lecture Contents Java basics (part II) Conditions Loops Methods Conditions & Branching Conditional Statements A
More informationAdministrivia. Java Review. Objects and Variables. Demo. Example. Example: Assignments
CMSC433, Spring 2004 Programming Language Technology and Paradigms Java Review Jeff Foster Feburary 3, 2004 Administrivia Reading: Liskov, ch 4, optional Eckel, ch 8, 9 Project 1 posted Part 2 was revised
More informationObject 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 information3. Java - Language Constructs I
Names and Identifiers A program (that is, a class) needs a name public class SudokuSolver {... 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations,
More informationCOP 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 informationLanguage Fundamentals Summary
Language Fundamentals Summary Claudia Niederée, Joachim W. Schmidt, Michael Skusa Software Systems Institute Object-oriented Analysis and Design 1999/2000 c.niederee@tu-harburg.de http://www.sts.tu-harburg.de
More informationG Programming Languages - Fall 2012
G22.2110-003 Programming Languages - Fall 2012 Lecture 4 Thomas Wies New York University Review Last week Control Structures Selection Loops Adding Invariants Outline Subprograms Calling Sequences Parameter
More informationProgramming Languages Third Edition. Chapter 7 Basic Semantics
Programming Languages Third Edition Chapter 7 Basic Semantics Objectives Understand attributes, binding, and semantic functions Understand declarations, blocks, and scope Learn how to construct a symbol
More informationExceptions, Case Study-Exception handling in C++.
PART III: Structuring of Computations- Structuring the computation, Expressions and statements, Conditional execution and iteration, Routines, Style issues: side effects and aliasing, Exceptions, Case
More informationObjectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java
Introduction Objectives An overview of object-oriented concepts. Programming and programming languages An introduction to Java 1-2 Problem Solving The purpose of writing a program is to solve a problem
More informationThe Compiler So Far. Lexical analysis Detects inputs with illegal tokens. Overview of Semantic Analysis
The Compiler So Far Overview of Semantic Analysis Adapted from Lectures by Profs. Alex Aiken and George Necula (UCB) Lexical analysis Detects inputs with illegal tokens Parsing Detects inputs with ill-formed
More informationLecture 8 CS 412/413 Spring '00 -- Andrew Myers 2. Lecture 8 CS 412/413 Spring '00 -- Andrew Myers 4
CS412/413 Introduction to Compilers and Translators Spring 00 Outline Typechecking Symbol tables Using symbol tables for analysis Lecture 8: Semantic Analysis and Symbol Tables Lecture 8 CS 412/413 Spring
More informationOOPs Concepts. 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8.
OOPs Concepts 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8. Type Casting Let us discuss them in detail: 1. Data Hiding: Every
More informationFollowing is the general form of a typical decision making structure found in most of the programming languages:
Decision Making Decision making structures have one or more conditions to be evaluated or tested by the program, along with a statement or statements that are to be executed if the condition is determined
More informationAP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS
AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this
More informationThe role of semantic analysis in a compiler
Semantic Analysis Outline The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Static analyses that detect type errors
More informationDOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS
Chapter 1 : Chapter-wise Java Multiple Choice Questions and Answers Interview MCQs Java Programming questions and answers with explanation for interview, competitive examination and entrance test. Fully
More information6. Operatoren. 7. Safe Programming: Assertions. Table of Operators. Table of Operators - Explanations. Tabular overview of all relevant operators
6. Operatoren Tabular overview of all relevant operators 180 Table of Operators Description Operator Arity Precedence Associativity Object member access. 2 16 left Array access [ ] 2 16 left Method invocation
More informationPROGRAMMING FUNDAMENTALS
PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write
More informationCS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find
CS1622 Lecture 15 Semantic Analysis CS 1622 Lecture 15 1 Semantic Analysis How to build symbol tables How to use them to find multiply-declared and undeclared variables. How to perform type checking CS
More informationOperational Semantics of Cool
Operational Semantics of Cool Key Concepts semantics: the meaning of a program, what does program do? how the code is executed? operational semantics: high level code generation steps of calculating values
More informationObject-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018
Object-oriented programming 1 and data-structures CS/ENGRD 2110 SUMMER 2018 Lecture 1: Types and Control Flow http://courses.cs.cornell.edu/cs2110/2018su Lecture 1 Outline 2 Languages Overview Imperative
More informationComputer 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 informationIntermediate Code, Object Representation, Type-Based Optimization
CS 301 Spring 2016 Meetings March 14 Intermediate Code, Object Representation, Type-Based Optimization Plan Source Program Lexical Syntax Semantic Intermediate Code Generation Machine- Independent Optimization
More informationJava Basics. Object Orientated Programming in Java. Benjamin Kenwright
Java Basics Object Orientated Programming in Java Benjamin Kenwright Outline Essential Java Concepts Syntax, Grammar, Formatting, Introduce Object-Orientated Concepts Encapsulation, Abstract Data, OO Languages,
More informationSoftware Engineering using Formal Methods
Software Engineering using Formal Methods Introduction to Promela Wolfgang Ahrendt 03 September 2015 SEFM: Promela /GU 150903 1 / 36 Towards Model Checking System Model Promela Program byte n = 0; active
More informationThe Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and
The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Op. Use Description + x + y adds x and y x y
More informationThe Arithmetic Operators
The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Examples: Op. Use Description + x + y adds x
More informationCOMP 2355 Introduction to Systems Programming
COMP 2355 Introduction to Systems Programming Christian Grothoff christian@grothoff.org http://grothoff.org/christian/ 1 Today Class syntax, Constructors, Destructors Static methods Inheritance, Abstract
More informationOCaml. ML Flow. Complex types: Lists. Complex types: Lists. The PL for the discerning hacker. All elements must have same type.
OCaml The PL for the discerning hacker. ML Flow Expressions (Syntax) Compile-time Static 1. Enter expression 2. ML infers a type Exec-time Dynamic Types 3. ML crunches expression down to a value 4. Value
More informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-17/cc/ Generation of Intermediate Code Conceptual Structure of
More informationIntermediate 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 informationOperators and Expressions
Operators and Expressions Conversions. Widening and Narrowing Primitive Conversions Widening and Narrowing Reference Conversions Conversions up the type hierarchy are called widening reference conversions
More informationProgramming Languages
CSE 130 : Spring 2011 Programming Languages Lecture 3: Crash Course Ctd, Expressions and Types Ranjit Jhala UC San Diego A shorthand for function binding # let neg = fun f -> fun x -> not (f x); # let
More informationCSE 504. Expression evaluation. Expression Evaluation, Runtime Environments. One possible semantics: Problem:
Expression evaluation CSE 504 Order of evaluation For the abstract syntax tree + + 5 Expression Evaluation, Runtime Environments + + x 3 2 4 the equivalent expression is (x + 3) + (2 + 4) + 5 1 2 (. Contd
More informationFormal Specification and Verification
Formal Specification and Verification Introduction to Promela Bernhard Beckert Based on a lecture by Wolfgang Ahrendt and Reiner Hähnle at Chalmers University, Göteborg Formal Specification and Verification:
More informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-17/cc/ Generation of Intermediate Code Outline of Lecture 15 Generation
More informationCSC 1214: Object-Oriented Programming
CSC 1214: Object-Oriented Programming J. Kizito Makerere University e-mail: jkizito@cis.mak.ac.ug www: http://serval.ug/~jona materials: http://serval.ug/~jona/materials/csc1214 e-learning environment:
More informationSemantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End
Outline Semantic Analysis The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Static analyses that detect type errors
More informationSemantic Analysis. CSE 307 Principles of Programming Languages Stony Brook University
Semantic Analysis CSE 307 Principles of Programming Languages Stony Brook University http://www.cs.stonybrook.edu/~cse307 1 Role of Semantic Analysis Syntax vs. Semantics: syntax concerns the form of a
More informationFormale Entwicklung objektorientierter Software
Formale Entwicklung objektorientierter Software Praktikum im Wintersemester 2008/2009 Prof. P. H. Schmitt Christian Engel, Benjamin Weiß Institut für Theoretische Informatik Universität Karlsruhe 5. November
More informationBIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic
BIT 3383 Java Programming Sem 1 Session 2011/12 Chapter 2 JAVA basic Objective: After this lesson, you should be able to: declare, initialize and use variables according to Java programming language guidelines
More informationCS 330 Lecture 18. Symbol table. C scope rules. Declarations. Chapter 5 Louden Outline
CS 0 Lecture 8 Chapter 5 Louden Outline The symbol table Static scoping vs dynamic scoping Symbol table Dictionary associates names to attributes In general: hash tables, tree and lists (assignment ) can
More informationInstructor: SIR MUHAMMAD NAVEED Created by: ARSLAN AHMED SHAAD ( ) MUHAMMAD BILAL ( ) ISIT:
Instructor: SIR MUHAMMAD NAVEED Created by: ARSLAN AHMED SHAAD ( 1163135 ) MUHAMMAD BILAL (1163122 ) ISIT:www.techo786.wordpress.com CHAPTER: 3 NOTE: CONTROL STATEMENTS Question s Given below are Long
More informationSoftware Engineering using Formal Methods
Software Engineering using Formal Methods Introduction to Promela Wolfgang Ahrendt & Richard Bubel & Reiner Hähnle & Wojciech Mostowski 31 August 2011 SEFM: Promela /GU 110831 1 / 35 Towards Model Checking
More informationChapter 6 Introduction to Defining Classes
Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of
More informationCMSC 132: Object-Oriented Programming II
CMSC 132: Object-Oriented Programming II Java Support for OOP Department of Computer Science University of Maryland, College Park Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation
More informationChapter 7 Control I Expressions and Statements
Chapter 7 Control I Expressions and Statements Expressions Conditional Statements and Guards Loops and Variation on WHILE The GOTO Controversy Exception Handling Values and Effects Important Concepts in
More informationSE352b: Roadmap. SE352b Software Engineering Design Tools. W3: Programming Paradigms
SE352b Software Engineering Design Tools W3: Programming Paradigms Feb. 3, 2005 SE352b, ECE,UWO, Hamada Ghenniwa SE352b: Roadmap CASE Tools: Introduction System Programming Tools Programming Paradigms
More informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Seminar Analysis and Verification of Pointer Programs (WS
More informationAnatomy of a Compiler. Overview of Semantic Analysis. The Compiler So Far. Why a Separate Semantic Analysis?
Anatomy of a Compiler Program (character stream) Lexical Analyzer (Scanner) Syntax Analyzer (Parser) Semantic Analysis Parse Tree Intermediate Code Generator Intermediate Code Optimizer Code Generator
More informationBasic Principles of analysis and testing software
Basic Principles of analysis and testing software Software Reliability and Testing - Barbara Russo SwSE - Software and Systems Engineering Research Group 1 Basic principles of analysis and testing As in
More informationObject oriented programming. Instructor: Masoud Asghari Web page: Ch: 3
Object oriented programming Instructor: Masoud Asghari Web page: http://www.masses.ir/lectures/oops2017sut Ch: 3 1 In this slide We follow: https://docs.oracle.com/javase/tutorial/index.html Trail: Learning
More informationJava Identifiers, Data Types & Variables
Java Identifiers, Data Types & Variables 1. Java Identifiers: Identifiers are name given to a class, variable or a method. public class TestingShastra { //TestingShastra is an identifier for class char
More informationx = 3 * y + 1; // x becomes 3 * y + 1 a = b = 0; // multiple assignment: a and b both get the value 0
6 Statements 43 6 Statements The statements of C# do not differ very much from those of other programming languages. In addition to assignments and method calls there are various sorts of selections and
More informationIndex COPYRIGHTED MATERIAL
Index COPYRIGHTED MATERIAL Note to the Reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations. A abstract classes
More informationCONTENTS: Array Usage Multi-Dimensional Arrays Reference Types. COMP-202 Unit 6: Arrays
CONTENTS: Array Usage Multi-Dimensional Arrays Reference Types COMP-202 Unit 6: Arrays Introduction (1) Suppose you want to write a program that asks the user to enter the numeric final grades of 350 COMP-202
More informationArray. Array Declaration:
Array Arrays are continuous memory locations having fixed size. Where we require storing multiple data elements under single name, there we can use arrays. Arrays are homogenous in nature. It means and
More informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Seminar Analysis and Verification of Pointer Programs (WS
More informationCOMP 202 Java in one week
COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of
More informationPASS4TEST IT 인증시험덤프전문사이트
PASS4TEST IT 인증시험덤프전문사이트 http://www.pass4test.net 일년동안무료업데이트 Exam : 1z0-809 Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z0-809 Exam's Question and Answers 1 from
More informationTHE CONCEPT OF OBJECT
THE CONCEPT OF OBJECT An object may be defined as a service center equipped with a visible part (interface) and an hidden part Operation A Operation B Operation C Service center Hidden part Visible part
More informationVariables and Bindings
Net: Variables Variables and Bindings Q: How to use variables in ML? Q: How to assign to a variable? # let = 2+2;; val : int = 4 let = e;; Bind the value of epression e to the variable Variables and Bindings
More informationJava Loop Control. Programming languages provide various control structures that allow for more complicated execution paths.
Loop Control There may be a situation when you need to execute a block of code several number of times. In general, statements are executed sequentially: The first statement in a function is executed first,
More informationOutline. Overview. Control statements. Classes and methods. history and advantage how to: program, compile and execute 8 data types 3 types of errors
Outline Overview history and advantage how to: program, compile and execute 8 data types 3 types of errors Control statements Selection and repetition statements Classes and methods methods... 2 Oak A
More informationCSE450. Translation of Programming Languages. Lecture 11: Semantic Analysis: Types & Type Checking
CSE450 Translation of Programming Languages Lecture 11: Semantic Analysis: Types & Type Checking Structure Project 1 - of a Project 2 - Compiler Today! Project 3 - Source Language Lexical Analyzer Syntax
More informationCS4215 Programming Language Implementation. Martin Henz
CS4215 Programming Language Implementation Martin Henz Thursday 15 March, 2012 2 Chapter 11 impl: A Simple Imperative Language 11.1 Introduction So far, we considered only languages, in which an identifier
More information