File: analysis_peg_minimize.tcl

package info (click to toggle)
tcllib 1.20%2Bdfsg-1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 68,064 kB
  • sloc: tcl: 216,842; ansic: 14,250; sh: 2,846; xml: 1,766; yacc: 1,145; pascal: 881; makefile: 107; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (51 lines) | stat: -rw-r--r-- 1,535 bytes parent folder | download | duplicates (8)
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
50
51
# -*- 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

# @mdgen NODEP: page::plugin

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

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 ..Realizability ; ::page::analysis::peg::realizable::remove!

    page_log_info Ok
    return
}

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

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