Tcl Library Source Code


[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]


pt::pe - Parsing Expression Serialization

Table Of Contents


package require Tcl 8.5
package require pt::pe ?1.0.1?
package require char

::pt::pe verify serial ?canonvar?
::pt::pe verify-as-canonical serial
::pt::pe canonicalize serial
::pt::pe print serial
::pt::pe bottomup cmdprefix pe
cmdprefix pe op arguments
::pt::pe topdown cmdprefix pe
::pt::pe equal seriala serialb
::pt::pe epsilon
::pt::pe dot
::pt::pe alnum
::pt::pe alpha
::pt::pe ascii
::pt::pe control
::pt::pe digit
::pt::pe graph
::pt::pe lower
::pt::pe print
::pt::pe punct
::pt::pe space
::pt::pe upper
::pt::pe wordchar
::pt::pe xdigit
::pt::pe ddigit
::pt::pe terminal t
::pt::pe range ta tb
::pt::pe nonterminal nt
::pt::pe choice pe...
::pt::pe sequence pe...
::pt::pe repeat0 pe
::pt::pe repeat1 pe
::pt::pe optional pe
::pt::pe ahead pe
::pt::pe notahead pe


Are you lost ? Do you have trouble understanding this document ? In that case please read the overview provided by the Introduction to Parser Tools. This document is the entrypoint to the whole system the current package is a part of.

This package provides commands to work with the serializations of parsing expressions as managed by the Parser Tools, and specified in section PE serialization format.

This is a supporting package in the Core Layer of Parser Tools.


PE serialization format

Here we specify the format used by the Parser Tools to serialize Parsing Expressions as immutable values for transport, comparison, etc.

We distinguish between regular and canonical serializations. While a parsing expression may have more than one regular serialization only exactly one of them will be canonical.


Assuming the parsing expression shown on the right-hand side of the rule

Expression <- Term (AddOp Term)*

then its canonical serialization (except for whitespace) is

{x {n Term} {* {x {n AddOp} {n Term}}}}

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category pt of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.


EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer


Parsing and Grammars


Copyright © 2009 Andreas Kupries