/* * ACCENT * * A Compiler Compiler for the Entire Class of Context-Free Languages * * Copyright (C) 1999 Friedrich Wilhelm Schroeer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
for (i = 1; i <= n_of_nonterms; i++) {
TRANSPARENT[i] = 0;
}
do {
rulelist rl;
memberlist ml;
member lhs;
changed = 0;
/* for all rules */
rl = cur_rule_list; while (rl) {
ml = rl->head;
rl = rl->tail;
lhs = ml->head;
if (! TRANSPARENT[lhs]) { if (ml-> tail == 0) { /* empty rhs */
TRANSPARENT[lhs] = 1;
changed = 1;
} else { /* for all members of rhs */
ml = ml->tail; while (ml) {
member m; int is_still_trans = 1;
m = ml->head; if (m <= 0) { /* m is token */
is_still_trans = 0; break;
} if (TRANSPARENT[m]) {
; /* continue with rhs */
} else {
is_still_trans = 0; break;
}
if (is_still_trans) {
TRANSPARENT[lhs] = 1;
changed = 1;
}
PRIVATEvoid process_rhs(ml)
memberlist ml;
{
member m;
if (ml == 0) return;
process_rhs(ml->tail);
m = ml->head;
if (m <= 0) { /* m is a token */
right_context = empty_set();
into_set_include_elem(&right_context, - m);
} else { /* m is a nonterm */
changed = 0;
into_set_include_set(&FOLLOW[m], right_context); if (changed) true_change = 1;
PUBLIC get_transparent(n, ref_val) int n; int *ref_val;
{
*ref_val = TRANSPARENT[n];
} /*----------------------------------------------------------------------------*/
PUBLIC get_max_char(ref_n) int *ref_n;
{
*ref_n = max_char;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.