Guided Notes Ch. 5 Basic Semantics Ch. 6 Data Types PHP Fundamentals Lecture Notes from both Louden...

10
Guided Notes Ch. 5 Basic Semantics Ch. 6 Data Types PHP Fundamentals Lecture Notes from both Louden and Sebesta Review questions

Transcript of Guided Notes Ch. 5 Basic Semantics Ch. 6 Data Types PHP Fundamentals Lecture Notes from both Louden...

Page 1: Guided Notes Ch. 5 Basic Semantics Ch. 6 Data Types PHP Fundamentals Lecture Notes from both Louden and Sebesta Review questions.

Guided Notes Ch. 5 Basic Semantics

Ch. 6 Data TypesPHP Fundamentals

Lecture Notes from both Louden and Sebesta

Review questions

Page 2: Guided Notes Ch. 5 Basic Semantics Ch. 6 Data Types PHP Fundamentals Lecture Notes from both Louden and Sebesta Review questions.

Semantics

• Semantics – what the language construct actually do

• Specification methods• By a language reference manual (most common)

• By a defining translator (by experiment or simulation, must execute to discover)

• By a formal definition (ch.13– operational, denotational, axiomatic semantics)

Page 3: Guided Notes Ch. 5 Basic Semantics Ch. 6 Data Types PHP Fundamentals Lecture Notes from both Louden and Sebesta Review questions.

Attributes, Binding, and Semantic Functions

• Attributes – properties that determine the meaning of a name.

• Binding – process of associating attribute to a name (binding time: static and dynamic)

• Semantic Functions– Environment: Names locations– Symbol table: Name attributes– Memory: Names values

Page 4: Guided Notes Ch. 5 Basic Semantics Ch. 6 Data Types PHP Fundamentals Lecture Notes from both Louden and Sebesta Review questions.

Scope rules

• Scope of a variable – the range of statements in which the variable is visible

• Static scoping – determined by the program units spatial relationship before execution

• Dynamic scoping – based on the calling sequence of subprograms only at running time

Page 5: Guided Notes Ch. 5 Basic Semantics Ch. 6 Data Types PHP Fundamentals Lecture Notes from both Louden and Sebesta Review questions.

In-class Exercise for Scoping

• A exercise from Sebesta Ch. 5 #9

• Goal: to understand static and dynamic scoping rules

Page 6: Guided Notes Ch. 5 Basic Semantics Ch. 6 Data Types PHP Fundamentals Lecture Notes from both Louden and Sebesta Review questions.

Aliases, Dangling references, and garbage

• Aliases – the same object is bound to two different names at the same time

• Dangling references – a location that has been deallocated but can still be accessed by a program

• Garbage – memory that has been allocated in the environment but that has become inaccessible to the program

Page 7: Guided Notes Ch. 5 Basic Semantics Ch. 6 Data Types PHP Fundamentals Lecture Notes from both Louden and Sebesta Review questions.

Data Type

• Definition 1 – A set of values.

• Definition 2 – a set of values, together with a set of operations on those values having certain properties.

• Strongly-typed

• Weakly-typed

• Untyped or dynamically typed

Page 8: Guided Notes Ch. 5 Basic Semantics Ch. 6 Data Types PHP Fundamentals Lecture Notes from both Louden and Sebesta Review questions.

The Evolution of PHP

• 1995, PHP 1.0, reflects the concerns at that time: password-protecting pages, easily creating forms, and accessing form data on subsequent pages – no plan to create a scripting language

• 1996, PHP 2.0, large project demanded better performance and integration, conditional HTML tag-replacement becomes a parser and end up writing an entire scripting language.

Page 9: Guided Notes Ch. 5 Basic Semantics Ch. 6 Data Types PHP Fundamentals Lecture Notes from both Louden and Sebesta Review questions.

The Evolution of PHP (cont.)

• 1998 PHP 3.0 since 1997, one man-project becomes team project with many developers

• 2000 PHP 4.0 Zend engine – abstracting the layer between the language and the web server, adding thread-safety, adding a more advanced two stage parse/execute tag-parsing system

• More to see PHP site…

Page 10: Guided Notes Ch. 5 Basic Semantics Ch. 6 Data Types PHP Fundamentals Lecture Notes from both Louden and Sebesta Review questions.

Review questions

• Define each of following terms and then give an explanation example:

• Semantics and its specification methods• Binding and binding time (static and dynamic) • Semantic functions• Scoping (static and dynamic)• Aliases and garbage• Data type • Strongly-typed language