Skip to content
Browse files

Separating external/internal grammar: t+

  • Loading branch information...
1 parent ca8861e commit e00675c36fe796b1089552721439413db3366a77 Jeffrey Kegler committed Apr 19, 2012
Showing with 20 additions and 6 deletions.
  1. +20 −6 r2/libmarpa/dev/marpa.w
View
26 r2/libmarpa/dev/marpa.w
@@ -2884,7 +2884,7 @@ the pre-CHAF rule count.
@<Mark and skip unused rules@>@;
@<Calculate CHAF rule statistics@>@;
/* If there is no proper nullable in this rule, I am done */
- if (factor_count > 0) goto NEXT_CHAF_CANDIDATE;
+ if (factor_count <= 0) goto NEXT_CHAF_CANDIDATE;
@<Factor the rule into CHAF rules@>@;
NEXT_CHAF_CANDIDATE: ;
}
@@ -2895,11 +2895,25 @@ Marpa_Rule_ID rule_id;
int pre_chaf_rule_count;
@ @<Mark and skip unused rules@> =
-if (!XRL_is_BNF(rule)) { goto NEXT_CHAF_CANDIDATE; }
-if (!RULE_is_Used(rule)) { goto NEXT_CHAF_CANDIDATE; }
-if (rule_is_nulling(g, rule)) { RULE_is_Used(rule) = 0; goto NEXT_CHAF_CANDIDATE; }
-if (!rule_is_accessible(g, rule)) { RULE_is_Used(rule) = 0; goto NEXT_CHAF_CANDIDATE; }
-if (!rule_is_productive(g, rule)) { RULE_is_Used(rule) = 0; goto NEXT_CHAF_CANDIDATE; }
+if (!RULE_is_Used (rule))
+ {
+ goto NEXT_CHAF_CANDIDATE;
+ }
+if (rule_is_nulling (g, rule))
+ {
+ RULE_is_Used (rule) = 0;
+ goto NEXT_CHAF_CANDIDATE;
+ }
+if (!rule_is_accessible (g, rule))
+ {
+ RULE_is_Used (rule) = 0;
+ goto NEXT_CHAF_CANDIDATE;
+ }
+if (!rule_is_productive (g, rule))
+ {
+ RULE_is_Used (rule) = 0;
+ goto NEXT_CHAF_CANDIDATE;
+ }
@ For every accessible and productive proper nullable which
is not already aliased, alias it.

0 comments on commit e00675c

Please sign in to comment.
Something went wrong with that request. Please try again.