"http://www.w3.org/TR/html4/loose.dtd"> >

Contents

I  Introduction and tutorial
1 Introduction
 1.1 Introduction
 1.2 License
 1.3 Structure of the document
2 Installation
 2.1 Getting TPG
 2.2 Requirements
 2.3 TPG for Linux and other Unix like
 2.4 TPG for M$ Windows
 2.5 TPG for other operating systems
3 Tutorial
 3.1 Introduction
 3.2 Defining the grammar
 3.3 Reading the input and returning values
 3.4 Embeding the parser in a script
 3.5 Conclusion
II  TPG reference
4 Usage
 4.1 Package content
 4.2 Command line usage
5 Grammar structure
 5.1 TPG grammar structure
 5.2 Comments
 5.3 Options
  5.3.1 Magic option
  5.3.2 CSL options
 5.4 Python code
  5.4.1 Syntax
  5.4.2 Indentation
 5.5 TPG parsers
  5.5.1 Initialisation
  5.5.2 Rules
  5.5.3 Python code
6 Lexer
 6.1 Regular expression syntax
 6.2 Token definition
  6.2.1 Predefined tokens
  6.2.2 Inline tokens
 6.3 Token matching
  6.3.1 Splitting the input string
  6.3.2 Matching tokens in grammar rules
7 Parser
 7.1 Declaration
 7.2 Base classes of TPG parsers
  7.2.1 Default base class
  7.2.2 User defined base classes
 7.3 Grammar rules
 7.4 Parsing terminal symbols
 7.5 Parsing non terminal symbols
  7.5.1 Starting the parser
  7.5.2 In a rule
 7.6 Sequences
 7.7 Cut
 7.8 Alternatives
 7.9 Repetitions
 7.10 Precedence and grouping
 7.11 Actions
  7.11.1 Abstract syntax trees
  7.11.2 Text extraction
  7.11.3 Object
  7.11.4 Actions in Python code
8 Context sensitive lexer
 8.1 Introduction
 8.2 Grammar structure
 8.3 CSL lexers
  8.3.1 Regular expression syntax
  8.3.2 Token definition
  8.3.3 Token matching
 8.4 CSL parsers
III  Some examples to illustrate TPG
9 Complete interactive calculator
 9.1 Introduction
 9.2 New functions
  9.2.1 Trigonometric and other functions
  9.2.2 Memories
 9.3 Source code
  9.3.1 TPG grammar
  9.3.2 Python script
10 Infix/Prefix/Postfix notation converter
 10.1 Introduction
 10.2 Abstract syntax trees
 10.3 Grammar
  10.3.1 Infix expressions
  10.3.2 Prefix expressions
  10.3.3 Postfix expressions
 10.4 Source code
IV  Internal structure of TPG for the curious
11 Structure of the package
 11.1 General structure of the package
12 Lexer
 12.1 Token matching
13 Parser
 13.1 Interface with the lexer
 13.2 Sequences of subexpressions
 13.3 Alternatives between subexpressions
 13.4 Repetitions
14 Code generation
 14.1 Inheritance
 14.2 Lexer
 14.3 Parser
  14.3.1 Grammar rules
  14.3.2 Symbols
  14.3.3 Sequences
  14.3.4 Cut
  14.3.5 Alternatives
  14.3.6 Repetitions
  14.3.7 Abstract syntax trees
  14.3.8 Text extraction
  14.3.9 Python objects