1# -*- tcl -*- 2# Transform - Minimize the grammar, through the removal of the 3# unreachable and not useful nonterminals (and expressions). 4 5# This package assumes to be used from within a PAGE plugin. It uses 6# the API commands listed below. These are identical across the major 7# types of PAGE plugins, allowing this package to be used in reader, 8# transform, and writer plugins. It cannot be used in a configuration 9# plugin, and this makes no sense either. 10# 11# To ensure that our assumption is ok we require the relevant pseudo 12# package setup by the PAGE plugin management code. 13# 14# -----------------+-- 15# page_info | Reporting to the user. 16# page_warning | 17# page_error | 18# -----------------+-- 19# page_log_error | Reporting of internals. 20# page_log_warning | 21# page_log_info | 22# -----------------+-- 23 24# ### ### ### ######### ######### ######### 25## Requisites 26 27# @mdgen NODEP: page::plugin 28 29package require page::plugin ; # S.a. pseudo-package. 30package require page::analysis::peg::reachable 31package require page::analysis::peg::realizable 32 33namespace eval ::page::analysis::peg {} 34 35# ### ### ### ######### ######### ######### 36## API 37 38proc ::page::analysis::peg::minimize {t} { 39 page_info {[PEG Minimization]} 40 page_log_info ..Reachability ; ::page::analysis::peg::reachable::remove! 41 page_log_info ..Realizability ; ::page::analysis::peg::realizable::remove! 42 43 page_log_info Ok 44 return 45} 46 47# ### ### ### ######### ######### ######### 48## Ready 49 50package provide page::analysis::peg::minimize 0.1 51 52