Tcl Library Source Code

EuroTcl/OpenACS 11 - 12 JULY 2024, VIENNA

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


pt::pe::op - Parsing Expression Utilities

Table Of Contents


package require Tcl 8.5 9
package require pt::pe::op ?1.0.2?
package require pt::pe ?1?
package require struct::set

::pt::pe::op drop dropset pe
::pt::pe::op rename nt ntnew pe
::pt::pe::op called pe
::pt::pe::op flatten pe
::pt::pe::op fusechars 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 additional commands to work with the serializations of parsing expressions as managed by the PEG and related packages, and specified in section PE serialization format.

This is an internal package, for use by the higher level packages handling PEGs, their conversion into and out of various other formats, or other uses.


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