1page_util_peg(n)            Parser generator tools            page_util_peg(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       page_util_peg - page PEG transformation utilities
9

SYNOPSIS

11       package require page::util::peg  ?0.1?
12
13       package require snit
14
15       ::page::util::peg::symbolNodeOf tree node
16
17       ::page::util::peg::symbolOf tree node
18
19       ::page::util::peg::updateUndefinedDueRemoval tree
20
21       ::page::util::peg::flatten treequery tree
22
23       ::page::util::peg::getWarnings tree
24
25       ::page::util::peg::printWarnings msg
26
27       ::page::util::peg::peOf tree eroot
28
29       ::page::util::peg::printTclExpr pe
30
31_________________________________________________________________
32

DESCRIPTION

34       This  package  provides a few common operations to PEG transformations.
35       They assume a Normalized PE Grammar Tree  as  input,  see  the  package
36       page::util::norm::peg,  possibly  augmented with attributes coming from
37       transformations not in conflict with the base definition.
38

API

40       ::page::util::peg::symbolNodeOf tree node
41              Given an arbitrary expression node in the AST tree it determines
42              the node (itself or an ancestor) containing the name of the non‐
43              terminal symbol the node belongs to, and  returns  its  id.  The
44              result  is  either  the  root of the tree (for the start expres‐
45              sion), or a definition node.
46
47       ::page::util::peg::symbolOf tree node
48              As ::page::util::peg::symbolNodeOf, but returns the symbol  name
49              instead of the node.
50
51       ::page::util::peg::updateUndefinedDueRemoval tree
52              The  removal  of nodes in the AST tree can cause symbols to lose
53              one or more users.
54
55                   A used by B and C,
56                   B is reachable,
57                   C is not,
58
59                   so A now loses the node in the expression for C calling it,
60                   or rather, not calling it anymore.
61
62              This command updates the cross-references and which nonterminals
63              are now undefined.
64
65       ::page::util::peg::flatten treequery tree
66              This  commands  flattens nested sequence and choice operators in
67              the AST tree, re-using the treeql object treequery  to  run  the
68              query determining which nodes to cut.
69
70       ::page::util::peg::getWarnings tree
71              This  command  looks at the attributes of the AST tree for prob‐
72              lems with the grammar and issues warnings. They do  not  prevent
73              us  from  writing the grammar, but still represent problems with
74              it the user should be made aware of.
75
76              The result of the command is a  dictionary  mapping  nonterminal
77              names to their associated warnings.
78
79       ::page::util::peg::printWarnings msg
80              The  argument of the command is a dictionary mapping nonterminal
81              names to their associated warnings, as generated by,  for  exam‐
82              ple, the command ::page::util::peg::getWarnings.
83
84              The  warnings  contained  therein are formatted and then printed
85              via the log command page_info. This means that this command  can
86              be  used  only  from  within  a  plugin  managed  by the package
87              page::pluginmgr.
88
89       ::page::util::peg::peOf tree eroot
90              This command converts the parsing  expression  starting  at  the
91              node  eroot in the AST tree into a nested list. The exact syntax
92              of this list specified by the package grammar::peg.
93
94       ::page::util::peg::printTclExpr pe
95              This command converts the parsing expression  contained  in  the
96              nested  list pe into a Tcl string which can be placed into a Tcl
97              script.  See the package grammar::peg for the  exact  syntax  of
98              pe.
99

BUGS, IDEAS, FEEDBACK

101       This  document,  will  undoubtedly  contain  bugs  and  other problems.
102       Please report such in the category  page  of  the  Tcllib  SF  Trackers
103       [http://sourceforge.net/tracker/?group_id=12883].   Please  also report
104       any ideas for enhancements you may have.
105

KEYWORDS

107       PEG, page, parser generator, parsing expression grammar, text  process‐
108       ing, transformation
109
111       Copyright (c) 2007 Andreas Kupries <andreas_kupries@users.sourceforge.net>
112
113
114
115
116page                                  1.0                     page_util_peg(n)
Impressum