The phc Developer's Manual


Table of Contents
1. Introduction
System Requirements
Demonstration
The Source Program
The Transform
The Result
Writing Plugins
Reference
I. Tree Traversal API Tutorials
2. Getting Started
Compiling a Plugin
About extern "C"
Abstract Syntax
The Abstract Syntax Tree
Working with the AST
Actually..
Writing Stand Alone Applications
What's Next?
3. Traversing the Tree
The Grammar (Revisited)
Statements and Expressions
The Difficult Solution
The Easy Solution
Pre and Post Methods
4. Modifying Tree Nodes
First Attempt
Modifying the Parameters
Refactoring
What's Next?
5. Restructuring the Tree
Introducing the Tree_transform API
The Implementation
Running Transformations
A Subtlety
What's Next?
6. Using State
The Implementation
What's Next?
7. Modifying the Traversal Order
The Solution
What's Next?
8. Returning Lists
Deleting Nodes
Using the XML unparser
The Full Transform
What's Next?
II. Reference
9. The Abstract Grammar
Overall Structure
Statements
Expressions
Additional Structure
Mix-in Code
10. Representing PHP
Top Level Grammar Structure
Method targets
Variables
Comments
String parsing
Global Variables
elseif
Miscellaneous Other Changes
Comparison to the PHP grammar
11. Limitations
Nested Function Definitions
Comments
Numbers
12. Overview of the AST classes and transformation API
The AST classes
Deep Equality
Cloning
Pattern Matching
The Tree Visitor API
The Tree Transform API
13. Maketea Theory
Introduction
The Grammar Formalism
Context Resolution
List of Figures
1-1. Abstract syntax tree for the demo example
3-1. Abstract syntax tree for the running example
10-1. Function call in the AST
10-2. Function call as represented by PHP
12-1. Sequence Diagram for the Visitor API
12-2. Sequence Diagram for the Transform API