Guided Notes Ch. 5 Basic Semantics Ch. 6 Data Types PHP Fundamentals Lecture Notes from both Louden...
-
Upload
lee-miller -
Category
Documents
-
view
216 -
download
0
Transcript of Guided Notes Ch. 5 Basic Semantics Ch. 6 Data Types PHP Fundamentals Lecture Notes from both Louden...
Guided Notes Ch. 5 Basic Semantics
Ch. 6 Data TypesPHP 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)
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
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
In-class Exercise for Scoping
• A exercise from Sebesta Ch. 5 #9
• Goal: to understand static and dynamic scoping rules
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
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
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.
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…
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