pt_introduction(3tcl)
π pt_introduction β a lil intro to Parser Tools π
okay so bestie, welcome to the Parser Tools page, part of the tcllib manual set, section 3tcl. this is the "hi, hello, let me walk you through the whole vibe" page for a system that makes parsers and the grammars that drive them. grab a snack π, we're doing architecture.
β¨ SYNOPSIS β¨
package require Tcl 8.5 9
πΈ DESCRIPTION πΈ
Welcome to the Parser Tools, a system for the creation and manipulation of parsers and the grammars driving them.
So like... what's your goal, why are you here, vibe check time:
- Do you simply wish to create a parser for some language?
In that case have a look at our parser generator application, pt, or, for a slightly deeper access, the package underneath it, pt::pgen.
- Do you wish to know more about the architecture of the system?
This is described in the section Parser Tools Architecture, below.
- Is your interest in the theoretical background upon which the packages and tools are build?
See the Introduction to Parsing Expression Grammars.
π¦ PARSER TOOLS ARCHITECTURE π¦
The system can be split into roughly three layers, as seen in the figure below.
IMAGE: architecture
These layers are, from high to low:
- At the top we have the application and the packages using the packages of the layer below to implement common usecases. One example is the aforementioned
pt::pgenwhich provides a parser generator.
The list of packages belonging to this layer can be found in section User Packages.
- In this layer we have the packages which provide the core of the functionality for the whole system. They are, in essence, a set of blocks which can be combined in myriad ways, like Lego (tm). The packages in the previous level are 'just' pre-fabricated combinations to cover the most important use cases.
The list of packages belonging to this layer can be found in section Core Packages.
- Last, but not least is the layer containing support packages providing generic functionality which not necessarily belong into the module.
The list of packages belonging to this layer can be found in section Support Packages.
π USER PACKAGES π
pt::pgen
π CORE PACKAGES π
This layer is further split into six sections handling the storage, import, export, transformation, and execution of grammars, plus grammar specific support packages.
π Storage
pt::peg::container
π Export
pt::peg::exportpt::peg::export::containerpt::peg::export::jsonpt::peg::export::pegpt::peg::to::containerpt::peg::to::jsonpt::peg::to::pegpt::peg::to::parampt::peg::to::tclparampt::peg::to::cparam
π«Ά Import
pt::peg::importpt::peg::import::containerpt::peg::import::jsonpt::peg::import::pegpt::peg::from::containerpt::peg::from::jsonpt::peg::from::peg
β Transformation
no cap, this section is literally empty in the original β it's giving "reserved for later" energy, the heading is there and then nothing. not me pointing it out, but there you go. π
π₯ Execution
pt::peg::interppt::rde
π Support
pt::tclparam::configuration::snitpt::tclparam::configuration::tcloopt::cparam::configuration::critclpt::astpt::pept::peg
π SUPPORT PACKAGES π
pt::peg::container::pegtext::writeconfigurationpathschar
π 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 [http://core.tcl.tk/tcllib/reportlist]. 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. (this is the polite way of saying "pls don't dump a giant patch in the comment box bestie" π)
β¨ KEYWORDS β¨
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
π CATEGORY π
Parsing and Grammars
π COPYRIGHT π
Copyright (c) 2009 Andreas Kupries <andreas_kupries@users.sourceforge.net>
okay that's the whole page, you ate it up, go build a parser π«Ά
this was pt_introduction(3tcl) from the tcllib docs, version 1.1 β mwah, bye bestie π β¨
π¦ where this page comes from
- debian trixie: tcllib 2.0+dfsg-4 Β· Tcl
- ubuntu questing: tcllib 2.0+dfsg-4
- ubuntu resolute: tcllib 2.0+dfsg-5 Β· Tcl
- ubuntu stonking: tcllib 2.0+dfsg-6 Β· Tcl
- Copyright (c) 2009 Andreas Kupries <andreas_kupries@users\&.sourceforge\&.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms