Contents
Part I A guided tour of Tom: code examples
Chapter 1 Basic usage: Algebraic terms and Pattern matching
1.1 Algebraic terms in
Java
– %gom
1.2 A pretty printer – %match
1.3 Antipatterns
1.4 Computing a fixpoint – %strategy, RepeatId
1.5 An expression evaluator – %strategy, InnerMostId
1.6 Variable Collector – %strategy with mutable parameters
1.7 Collecting free variables – µ operator, composed strategies
Chapter 2 Data structure invariants: Hooks
2.1 Sorted list – maintaining invariants with rule-based hooks
2.2 Sorted list revisited – advanced hooks
Chapter 3 Seeing
Java
objects as terms: Mappings
3.1 Matching java.util.LinkedList – standard mappings
3.2 Matching cars – Handwritten Mappings
Chapter 4 Term-graph rewriting
Part II Tutorial
Chapter 5 Language Basics – Level 1
5.1 Defining a data-structure
5.2 Retrieving information in a data-structure
5.3 Using rules to simplify expressions
5.4 Separating Gom from Tom (
*
)
5.5 Programming in Tom
Chapter 6 Language Basics – Level 2
6.1 The “Hello World” example
6.2 “Hello World” revisited: introduction to list-matching
6.3 String matching – continued
6.4 List matching – Associative matching
Chapter 7 Language Basics – Level 3
7.1 Introduction to strategies
7.1.1 Elementary transformation
7.1.2 Basic combinators
7.1.3 Parameterized strategies
7.1.4 Traversal strategies
7.1.5 High level strategies
7.2 Strategies in practice
7.2.1 Printing constants using a strategy
7.2.2 Combining elementary strategies
7.2.3 Modifying a subterm
7.2.4 Re-implementing the tiny optimizer
7.3 Anti pattern-matching
7.4 Using constraints for more flexibility
Chapter 8 Advanced features (
*
)
8.1 Hand-written mappings
8.1.1 Defining a simple mapping
8.1.2 Using backquote constructs
8.1.3 Advanced examples
8.1.4 Using list-matching
Chapter 9 XML
9.1 Manipulating
Xml
documents
9.1.1 Loading
Xml
documents
9.1.2 Retrieving information
9.1.3 Comparing two
Xml
subtrees
9.1.4 Retrieving information using traversal functions
9.2 Building and sorting
Xml
/DOM documents
9.2.1 Loading
Xml
documents
9.2.2 Comparing two nodes
9.2.3 Sorting a list of nodes
9.2.4 Sorting by side effect
Part III Language
Chapter 10 Tom
10.1 Notations
10.1.1 Lexical conventions
10.1.2 Names
10.2 Tom constructs
10.2.1 Tom program
10.2.2 Match construct
10.2.3 Tom pattern
10.2.4 Tom anti-pattern
10.2.5 Backquote construct
10.2.6
Meta-quote
construct
10.3 Tom signature constructs (
*
)
10.3.1 Sort definition constructs
10.3.2 Constructor definition constructs
10.3.3 Predefined sorts and operators
10.3.4 Gom construct
10.4 XML pattern
Chapter 11 Gom
11.1 Gom syntax
11.1.1 Builtin sorts and operators
11.1.2 Example of signature
11.1.3 Combining Gom with Tom
11.2 Hooks
11.2.1 Algebraic rules
11.2.2 Hooks to alter the creation operations
11.2.3 List theory hooks
11.3 Generated API
11.3.1 Example of generated API
11.3.2 Hooks to alter the generated API
11.4 Term-Graph rewriting (
**
)
11.4.1 Term-graph data-structures
11.4.2 Term-graph rules
11.5 Strategies support (
*
)
11.5.1 Basic strategy support
11.5.2 Congruence strategies
11.5.3 Construction strategies
Chapter 12 Strategies
12.1 Overview
12.1.1 Strategy interface
12.1.2 Environment
12.2 Elementary strategy
12.2.1 Elementary strategies from
sl
12.2.2 Elementary strategies defined by users
12.3 Basic strategy combinators
12.4 Strategy library
12.5 Strategies with identity considered as failure (
*
)
12.6 Congruence strategies (generated by Gom)
12.7 Matching and visiting a strategy (
*
)
12.8 Applying a strategy on a user defined data-structures (
*
)
12.8.1 Simple implementation of the data structure
12.8.2 Visiting data-structures by introspection
Chapter 13 Runtime Library
13.1 Predefined mappings
13.1.1 Builtin sorts
13.1.2 Java
13.2 Strategies
13.3 Term viewer
13.4 XML
13.5 Bytecode transformation (
*
)
13.5.1 Predefined mapping
13.5.2 Java classes as Gom terms
13.5.3 Simulation of control flow by Strategies
Part IV Tools
Chapter 14 Installation
14.1 Requirements
14.2 Installing Tom
14.2.1 Windows
14.2.2 Windows with Cygwin
14.2.3 Unix
14.2.4 Eclipse plugin
14.3 Getting some examples
14.4 Compiling Tom from sources (
*
)
14.4.1 Getting the sources
14.4.2 Prepare for the build
14.4.3 Build the Tom distribution
14.4.4 Setup
Chapter 15 Using Tom
15.1 The Tom compiler
15.2 Development process
15.3 Command line tool
15.4 Ant task
Chapter 16 Using Gom
16.1 Command line tool
16.2 Ant task
16.3 Gom Antlr adaptor
16.3.1 Command line tool
16.3.2 Ant task
Chapter 17 Configuring your environment
17.1 Editor
17.1.1 Vim
17.2 Shell
17.2.1 Zsh
17.3 Build Tom projects using Ant
Chapter 18 Migration Guide
18.1 Migration from 2.5 to 2.6
18.2 Migration from 2.4 to 2.5
18.3 Migration from 2.3 to 2.4
18.4 Migration from 2.2 to 2.3
18.5 Migration from 2.1 to 2.2
18.6 Migration from 2.0 to 2.1
18.7 Migration from 1.5 to 2.0