Source Code
Here are links to source code for the larger examples from the book.
Chapter 7
An ML merge sort
An ML merge sort showing nested function definitions
Chapter 12
An ML quicksort
Chapter 13
A Java linked list example:
ConsCell.java
,
IntList.java
, and
Driver.java
Chapter 14
A Java stack manager:
StackManager.java
A Java heap manager with no coalescing:
HeapManager.java
A Java heap manager with coalescing:
HeapManager.java
Fragments of a Java heap manager with quick lists:
allocate
,
deallocate
, and
QuickHeapManager
Chapter 15
A Java worklist example:
Worklist.java
,
Node.java
, and
Stack.java
Demo application/applet
for worklist example (not in the book)
Java inheritance examples:
PeekableStack.java
and
DoublePeekableStack.java
Code for a Java association list exercise:
ANode.java
,
AList.java
,
SizedAList.java
, and
AHash.java
Chapter 16
A simple ML implementation of an
object-oriented cons cell
A full ML implementation of an
object-oriented stack
An example of un-object-oriented Java:
Main.java
,
Node.java
, and
Stack.java
Code for a Java object-oriented redesign exercise:
FormattedInteger.java
and
FormattedIntegerDemo.java
Chapter 17
A Java application to demonstrate uncaught exceptions:
Test.java
A Java application to demonstrate a try with one catch:
Test.java
A Java application to demonstrate a try with two catches:
Test.java
A Java application to demonstrate a try with overlapping catches:
Test.java
A Java integer stack class with preconditions only:
IntStack.java
and
Node.java
A Java integer stack class demonstrating total definition:
IntStack.java
and
Node.java
A Java integer stack class with fatal errors:
IntStack.java
and
Node.java
Java integer stack classes with error flagging:
StackMachine.java
,
IntStack.java
, and
Node.java
Java integer stack classes using exception handling:
StackMachine.java
,
IntStack.java
,
Node.java
, and
EmptyStack.java
.
Code for a Java iterator exercise:
CharIter.java
and
CharIterX.java
Code for a Java calculator exercise:
CalcParser.java
and
CalcLexer.java
Demo application/applet
for calculator exercise (not in the book)
Chapter 19
Prolog
relations example
with grandparent rule
Prolog
man/wolf/goat/cabbage example
Chapter 20
Prolog
adventure game
Chapter 22
Simple
8-queens example
in Prolog
More efficient
8-queens example
in Prolog
Knapsack example
in Prolog
Chapter 23
Prolog
interpreter for Language One
Prolog
interpreter for Language Two
Prolog
interpreter for Language Three
, with dynamic scoping
Prolog
interpreter for Language Three
, with static scoping