Table of Contents
1 Overview
1.1 Principles of Language Design
1.2 Programming Paradigms and Application Domains
1.3 Pragmatic Considerations
1.4 A Brief History of Programming Languages
1.5 Programming Language Qualities
1.6 What's in a Name?
1.7 Goals of This Study
Exercises
2 Syntax
2.1 Formal Methods andLanguage Processing2.1.1 Backus-Naur Form (BNF)
2.1.2 BNF and Lexical Analysis
2.1.3 Lexical Analysis andthe Compiling Process
2.1.4 Regular Expressions andthe Lexical Analysis2.2 Syntactic Analysis
2.2.1 Ambiguity
2.2.2 Variations on BNFfor Syntactic Analysis
2.2.3 Case Study: The Syntax of Java2.3 Linking Syntax and Semantics
2.3.1 Abstract Syntax
2.3.2 Abstract Syntax Trees
2.3.3 Recursive Descent Parsing2.4 Example: Jay-A Familiar Minilanguage
2.4.1 Concrete Syntax of Jay
2.4.2 Abstract Syntax of JayExercises
3 Type Systems and Semantics
3.1 Type Systems3.1.1 Formalizing the Type System
3.1.2 Type Checking in Jay3.2 Semantic Domainsand State Transformation
3.3 Operational Semantics
3.4 Axiomatic Semantics3.4.1 Fundamental Concepts
3.4.2 Correctness of Factorial
3.4.3 Correctness of Fibonacci
3.4.4 Perspective3.5 Denotational Semantics
3.6 Example: Semantics of Jay Assignments and Expressions3.6.1 Meaning of Assignments
3.6.2 Meaning of Arithmetic Expressions
3.6.3 Implementing theSemantic FunctionsExercises
4 Imperative Programming
4.1 von Neumann Machines andImperative Programming
4.2 Naming and Variables
4.3 Elementary Types, Values,and Expressions4.3.1 Semantics
4.3.2 Elementary Typesin Real Languages
4.3.3 Expressions in Real Languages
4.3.4 Operator Overloading, Conversion, and Casting
4.3.5 Jay Extension: Floating Point Numbers and Operators4.4 Syntax and Semantics of Jay Statements
4.4.1 Syntax and Type Checking
4.4.2 Semantics4.5 Syntax and Semantics of Statementsin Real Languages
4.5.1 For Loops
4.5.2 Do Statements
4.5.3 Switch (Case) Statements
4.5.4 Break and Continue Statements4.6 Scope, Visibility, and Lifetime
4.7 Syntax and Type System for Methods and Parameters4.7.1 Concrete Syntax
4.7.2 Abstract Syntax
4.7.3 Static Type CheckingExercises
5 Memory Management
5.1 The Overall Structureof Run-Time Memory
5.2 Methods, Locals, Parameters, and the Run-Time Stack5.2.1 Program State I: Stack Allocation
5.2.2 Argument-Parameter Linkage
5.2.3 Semantics of Call and Return5.3 Pointers
5.4 Arrays5.4.1 Syntax and Type Checkingfor Arrays
5.4.2 Array Allocation and Referencing5.5 Structures
5.5.1 Syntax and Type Checking for Structures
5.6 Semantics of Arrays and Structures
5.6.1 Program State II: Heap Allocation
5.6.2 Semantics of Arrays
5.6.3 Semantics of Structures5.7 Memory Leaks and Garbage Collection
5.7.1 Widows and Orphans
5.7.2 Referencing Counting
5.7.3 Mark-Sweep
5.7.4 Copy Collection
5.7.5 Garbage Collection Strategiesin JavaExercises
6 Exception Handling
6.1 Traditional Techniques
6.2 Model
6.3 Exceptions in Java
6.4 Example: Missing Argument
6.5 Example: Invalid Input
6.6 Example: Throwing an Exception
6.7 An Assertion Class
Exercises
7 Object-Oriented Programming
7.1 Data Abstraction andModular Programming
7.2 The Object-Oriented Model7.2.1 Basic Concepts
7.2.2 Initialization of Objects
7.2.3 Inheritance
7.2.4 Abstract Classes
7.2.5 Interfaces
7.2.6 Polymorphism and Late Binding7.3 Example: Expression Evaluation
7.4 Example: Concordance
7.5 Example: Backtracking
7.6 Correctness
Exercises
8 Functional Programming
8.1 Functions and the Lambda Calculus
8.2 Scheme: An Overview8.2.1 Expressions
8.2.2 Expressions Evaluation
8.2.3 Lists
8.2.4 Elementary Values
8.2.5 Control Flow
8.2.6 Defining Functions
8.2.7 Let Expressions8.3 Debugging
8.4 Example: Scheme Applications8.4.1 Formal Semantics of Jay
8.4.2 Symbolic Differentiation
8.4.3 Eight Queens8.5 Program Correctness
8.6 Advances in Functional Programming: Haskell8.6.1 Expressions
8.6.2 Lists and List Comprehensions
8.6.3 Elementary Types and Values
8.6.4 Control Flow
8.6.5 Defining Functions
8.6.6 Tuples8.7 Example: Haskell Applications
8.7.1 Semantics of Jay
8.7.2 Program CorrectnessExercises
9 Logic Programming
9.1 Logic, Predicates, and Horn Clauses9.1.1 Horn Clauses
9.1.2 Resolution and Unification9.2 Prolog: Facts, Variables, and Queries
9.2.1 Loading and Executing Code
9.2.2 Unification, Evaluation Order, and Backtracking
9.2.3 Database Searching-The Family Tree9.3 Lists
9.4 Practical Aspects of Prolog9.4.1 Tracing
9.4.2 The Cut and Negation
9.4.3 The is, not,and Other Operators
9.4.4 The assert Function9.5 Example: Prolog Applications
9.5.1 Symbolic Differentiation
9.5.2 Solving Word Puzzles
9.5.3 Natural Language Processing
9.5.4 Syntax of Jay
9.5.5 Semantics of Jay9.6 Constraint Logic Programming
Exercises
10 Event-Driven Programming
10.1 Foundations: The Event Model
10.2 The Event-DrivenProgramming Paradigm
10.3 Applets
10.4 Event Handling10.4.1 Mouse Clicks
10.4.2 Mouse Motion
10.4.3 Buttons
10.4.4 Labels, TextAreas,and TextFields
10.4.5 Choices10.5 Example: A Simple GUI Interface
10.6 Example: Event-DrivenInteractive Games10.6.1 Tic-Tac-Toe
10.6.2 The Grid and CellClasses-Useful Assistants
10.6.3 Tic-Tac-Toe (continued)
10.6.4 Nim10.7 Other Event-DrivenProgramming Situations
10.7.1 ATM Machine
10.7.2 Home Security SystemExercises
11 Concurrent Programming
11.1 Concepts
11.2 Communication
11.3 Deadlocks and Unfairness
11.4 Semaphores
11.5 Monitors
11.6 Java Threads
11.7 Synchronization in Java
11.8 Example: Bouncing Balls
11.9 Example: Bounded Buffer
11.10 Example: Sieve of Eratosthenes
Exercises
Appendix A Summary of Notations
A.1 Functions and Sets
A.2 Predicate Logic
A.3 Syntax and Semantics
Appendix B Language Jay-A Formal Description
B.1 Lexical Syntax of Jay
B.2 Remaining Concrete Syntax of JayB.2.1 EBNF Version
B.2.2 BNF VersionB.3 Abstract Syntax of Jay
B.3.1 Java Implementation
B.4 Type Checking Functions for Jay
B.5 Semantics of Jay
Appendix C Java Tutorial
C.1 Running Java Programs
C.2 Basic Java SyntaxC.2.1 The Standard Java Packages
C.2.2 Declarations
C.2.3 Data Types and Variable Declarations
C.2.4 Variable Declarations
C.2.5 Expressions and Operators
C.2.6 Statements
C.2.7 Loops and Conditionals
C.2.8 Switch and Break
C.2.9 Classes and Methods (Functions and Procedures)C.3 Stream Input and Output
C.4 Example: Making An Application
C.5 Java Applets
C.6 Events and ListenersC.6.1 Mouse Clicks
C.6.2 Mouse Motions
C.6.3 Buttons
C.6.4 Labels, TextAreas, and TextFields
C.6.5 Choices
C.6.6 Summary of Components and Their Event HandlersC.7 Colors
C.8 The Graphics Environment
C.9 Placement of Objects in the Frame
C.10 Key Java ClassesC.10.1 The Object Class
C.10.2 The Math Class
C.10.3 The Integer and Float Classes
C.10.4 The String Class
C.10.5 The Vector Class
C.10.6 The Hashtable Class
C.10.7 The PrintStream and PrintWriter Classes
C.10.8 The Graphics ClassBibliography
Index
![]()
feedback form | permissions | international | locate your campus rep | request a review copy
digital solutions | publish with us | customer service | mhhe home
Copyright ©2001 The McGraw-Hill Companies.
Any use is subject to the Terms of Use and Privacy Policy.
McGraw-Hill Higher Education is one of the many fine businesses of the The McGraw-Hill Companies.