Quickstart Guide

Return to Contents

Lexing and Parsing

The package that you will need is Packrat.Standard. If you are parsing ordinary strings then Packrat.Utilities may also be useful.

Define enumeration types for all the lexer token labels and parse graph node labels you need, then use them to instantiate Packrat.Standard.

Instantiate subprograms from the nested Lexers package to create your lexer, and subprograms from the nested Parsers package to create your parser.

Take special care when using any redirects from Parsers. They are used to allow for self-referential instantiation of parser combinators and must be set properly before using any parsers built with them. Otherwise an exception will be raised.

Feed your input through the lexer, then the results of that through the parser to obtain a parse graph.

Use subprograms from the nested Parse_Graphs package to inspect and manipulate the resulting graph.

Parsing Only

The package that you will need is Packrat.No_Lex. If you are parsing ordinary strings then Packrat.Utilities may also be useful.

Define an enumeration type for all the parse graph node labels you need, then use it to instantiate Packrat.No_Lex.

Instantiate subprograms from the nested Parsers package to create your parser.

Take special care when using any redirects. They are used to allow for self-referential instantiation of parser combinators and must be set properly before using any parsers built with them. Otherwise an exception will be raised.

Feed your input through the parser to obtain a parse graph.

Use subprograms from the nested Parse_Graphs package to inspect and manipulate the resulting graph.