File: analysis_peg_minimize.tcl

package info (click to toggle)
tcllib 1.8-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 13,628 kB
  • ctags: 4,897
  • sloc: tcl: 88,012; sh: 7,856; ansic: 4,174; xml: 1,765; yacc: 753; perl: 84; f90: 84; makefile: 60; python: 33; ruby: 13; php: 11
file content (49 lines) | stat: -rw-r--r-- 1,495 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- tcl -*-
# Transform - Minimize the grammar, through the removal of the
# unreachable and not useful nonterminals (and expressions).

# This package assumes to be used from within a PAGE plugin. It uses
# the API commands listed below. These are identical across the major
# types of PAGE plugins, allowing this package to be used in reader,
# transform, and writer plugins. It cannot be used in a configuration
# plugin, and this makes no sense either.
#
# To ensure that our assumption is ok we require the relevant pseudo
# package setup by the PAGE plugin management code.
#
# -----------------+--
# page_info        | Reporting to the user.
# page_warning     |
# page_error       |
# -----------------+--
# page_log_error   | Reporting of internals.
# page_log_warning |
# page_log_info    |
# -----------------+--

# ### ### ### ######### ######### #########
## Requisites

package require page::plugin ; # S.a. pseudo-package.
package require page::analysis::peg::reachable
package require page::analysis::peg::useful

namespace eval ::page::analysis::peg {}

# ### ### ### ######### ######### #########
## API

proc ::page::analysis::peg::minimize {t} {
    page_info {[PEG Minimization]}
    page_log_info ..Reachability ; ::page::analysis::peg::reachable::remove!
    page_log_info ..Usefulness   ; ::page::analysis::peg::useful::remove!

    page_log_info Ok
    return
}

# ### ### ### ######### ######### #########
## Ready

package provide page::analysis::peg::minimize 0.1