{"record":{"id":"95619ca237d9d80d","repo":"mono/mono","slug":"s-d-rules-never-reduced","errorCode":null,"errorMessage":"%s: %d rules never reduced\n","messagePattern":"(.+?): (.+?) rules never reduced\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"mcs/jay/mkpar.c","lineNumber":251,"sourceCode":"    for (i = 0; i < nstates; ++i)\n    {\n\tfor (p = parser[i]; p; p = p->next)\n\t{\n\t    if (p->action_code == REDUCE && p->suppressed == 0)\n\t\trules_used[p->number] = 1;\n\t}\n    }\n\n    nunused = 0;\n    for (i = 3; i < nrules; ++i)\n\tif (!rules_used[i]) ++nunused;\n\n    if (nunused)\n    {\n\tif (nunused == 1)\n\t    fprintf(stderr, \"%s: 1 rule never reduced\\n\", myname);\n\telse\n\t    fprintf(stderr, \"%s: %d rules never reduced\\n\", myname, nunused);\n     }\n}\n\nstatic void\nremove_conflicts (void)\n{\n    register int i;\n    register int symbol;\n    register action *p, *pref;\n\n    SRtotal = 0;\n    RRtotal = 0;\n    SRconflicts = NEW2(nstates, short);\n    RRconflicts = NEW2(nstates, short);\n    for (i = 0; i < nstates; i++)\n    {\n\tSRcount = 0;\n\tRRcount = 0;","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/mono/mono/blob/0f53e9e151d92944cacab3e24ac359410c606df6/mcs/jay/mkpar.c#L233-L269","documentation":"Emitted by unused_rules() in mcs/jay/mkpar.c:251 (plural branch) when two or more grammar rules are never selected as a reduction in any parser state. Same mechanism as the singular form: post-table-build scan of `rules_used` counts rules with no reduction action. It is a warning; the parser still generates but carries dead productions.","triggerScenarios":"Multiple productions (or whole nonterminals) unreachable from the start symbol.","commonSituations":"Large grammar after deleting a feature but leaving its rules; importing a grammar subset whose entry points are unused; superseded alternatives accumulating.","solutions":["Remove each unreachable rule, or wire its LHS nonterminal into a reachable production.","Audit the nonterminal graph from the start symbol and prune dead branches.","Re-run jay to confirm the count drops to zero."],"exampleFix":"// before\nstart : a ;\na : 'x' ;\nb : 'y' ;\nc : 'z' ;   /* b and c unreachable -> 2 rules never reduced */\n// after\nstart : a ;\na : 'x' ;","handlingStrategy":"validation","validationCode":"# Treat any 'rules never reduced' line as a build failure.\njay -v -c -o Parser.cs grammar.jay 2>jay.log\ngrep -qE '[0-9]+ rules never reduced' jay.log && { echo 'multiple unreachable rules'; cat jay.log; exit 1; } || true","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prune dead nonterminals after feature removal.","Walk the nonterminal graph from %start and drop unreached branches.","Fail CI on any 'rules never reduced' diagnostic."],"tags":["jay","grammar","unreachable","rules","lalr"],"backgroundTag":null,"analyzedSha":"0f53e9e151d92944cacab3e24ac359410c606df6","analyzedAt":"2026-08-13T18:54:37.190Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}