Modern Programming Languages:
A Practical Introduction
Second Edition
Dr. Adam Brooks Webber
Welcome
This page accesses supporting material for the book. The page was last updated on 8/9/2015. (If you are not yet familiar with my book, you can learn about it by reading the preface.)
Please note that the book is now in the second edition. Instructors who were using the previous edition should use the links below to get updated versions of the slide sets and source code. (Instructors should also contact the publisher for updated sample solutions.)
Errata
Here is a list of errors in the book (pdf), containing all those known to the author as of August 9, 2015.
Lecture Notes
These are PowerPoint slides for each chapter of the book. They are specific to the second edition. Please email me with any defects you find.
- All PowerPoint slide sets, zipped
- Chapter 1: Programming Languages
- Chapter 2: Defining Program Syntax
- Chapter 3: Where Syntax Meets Semantics
- Chapter 4: Language Systems
- Chapter 5: A First Look At ML
- Chapter 6: Types
- Chapter 7: A Second Look At ML
- Chapter 8: Polymorphism
- Chapter 9: A Third Look At ML
- Chapter 10: Scope
- Chapter 11: A Fourth Look A ML
- Chapter 12: Memory Locations For Variables
- Chapter 13: A First Look At Java
- Chapter 14: Memory Management
- Chapter 15: A Second Look At Java
- Chapter 16: Object Orientation
- Chapter 17: A Third Look At Java
- Chapter 18: Parameters
- Chapter 19: A First Look At Prolog
- Chapter 20: A Second Look At Prolog
- Chapter 21: Cost Models
- Chapter 22: A Third Look At Prolog
- Chapter 23: Formal Semantics
- Chapter 24: The History of Programming Languages
The slides can also be retrieved as pdf files.
- All pdf slide sets, zipped
- Chapter 1: Programming Languages
- Chapter 2: Defining Program Syntax
- Chapter 3: Where Syntax Meets Semantics
- Chapter 4: Language Systems
- Chapter 5: A First Look At ML
- Chapter 6: Types
- Chapter 7: A Second Look At ML
- Chapter 8: Polymorphism
- Chapter 9: A Third Look At ML
- Chapter 10: Scope
- Chapter 11: A Fourth Look A ML
- Chapter 12: Memory Locations For Variables
- Chapter 13: A First Look At Java
- Chapter 14: Memory Management
- Chapter 15: A Second Look At Java
- Chapter 16: Object Orientation
- Chapter 17: A Third Look At Java
- Chapter 18: Parameters
- Chapter 19: A First Look At Prolog
- Chapter 20: A Second Look At Prolog
- Chapter 21: Cost Models
- Chapter 22: A Third Look At Prolog
- Chapter 23: Formal Semantics
- Chapter 24: The History of Programming Languages
Source Code
Here are links to source code for the larger examples from the book.
Chapter 7
Chapter 12
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
- A version of the Java worklist example demonstrating the use of generics: Worklist.java, Node.java, 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 greatgrandparent 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
Other Resources
All language systems required by the book are available for free. Platforms include Windows and a variety of Unix-based systems, including Mac OS X.
ML
The implementation of ML used in the book is Standard ML of New Jersey. You can download it from the Standard ML of New Jersey web site.
The Standard ML of New Jersey web site also has links for downloading a nice emacs mode for ML. It autoindents your ML code and runs the ML language system as an inferior process. (In past semesters, few of my students made use of this, so I have stopped installing it for them. However, experienced emacs hackers might consider installing it for themselves.)
There are several good ML tutorials available on the Web. A tutorial developed by Stephen Gilmore is called Programming In Standard ML ’97: An On-line Tutorial. The text for this one is very well organized. Robert Harper has a very extensive introductory on-line text, Programming in Standard ML, that includes lots of examples. Andrew Cumming of Napier University in Edinburgh has written a tutorial site for ML called A Gentle Introduction to ML. There are many small tutorial exercises, and if you set things up right you can cut from them and paste into an ML session.
Java
The implementation of Java used in the book is the basic Java Development Kit (JDK), using the simple command-line compiler, javac. You can download this for Windows and Unix platforms from Oracle’s Java site; Java SE, the Standard Edition, is the one you want. Most Mac OS X systems already have the necessary java and javac commands; to check, run the Terminal application and try the command “javac -version”. It should show the version information for the javac tool, and any version 1.5 or later will work fine. If it shows an earlier version, or if it gives a “command not found” error message, then you will need to install tools maintained by Apple at the Mac Dev Center . This will require registering as an Apple Developer, but it’s free.
Those who have already learned to program in Java may be familiar with a integrated development environment such as Eclipse. That will work fine too. In fact, if you are planning to do any Java programming beyond the elementary level covered in the book, it would be a good idea to learn how to use Eclipse, which is very good, very popular, and free. You can download it here.
The classic on-line tutorials for more experienced programmers are the Java Tutorials, which are also available in book form. These are very thorough tutorials with many examples.
I wrote a Java tutorial called The Java Trainer when I was teaching at Western Illinois University. It delivers entirely Web-based, on-line puzzles integrated with the text. Unfortunately it is meant to teach rudimentary programming to people who have never programmed before, so it is way too elementary to supplement the book. Still, students may find some of the puzzles challenging.
Prolog
The implementation of Prolog used in the book is SWI-Prolog from the University of Amsterdam. You can download it from the SWI-Prolog web site.
A useful Web resource is Paul Brna’s online Prolog textbook. For general Prolog information and lots of source code, check out the Prolog Repository at CMU.
Miscellaneous
Don’t miss the on-line collection of programs to print the lyrics of that heart-warming classic song, “99 Bottles of Beer on the Wall“. Some 1500 different programming languages are represented.
Contacts
You can email me here with comments and questions.
Could I get the solutions of the whole book please ?
Thanks,
Hi Raheem,
There are sample solutions to the exercises for both my current textbooks: Modern Programming Languages (2nd. ed.) and Formal Language: A Practical Introduction. These are only given out to those who are teaching a class using the book in question. My publisher provides access to these resources.
Bolches yarboclos, Batman!!!
This book rules
Just finished reading the book c: Love the postscript <3