# Last edited on 2005-01-08 15:02:44 by stolfi The input to the SELVA grammar reducer and reorderer is a list of rules, one per line, of the form "{H} -> {L} {R}" where {H}, {L}, {R} are strings matching the pattern [*$_(){},A_Za-z0-9]+. The part {R} or both {L} and {R} may be omitted. The output is a reduced grammar in numeric format, suitable for the SELVA parser (cfp). begin grammar (format of 2004-11-01) symbols = {NS} rules = {NR} {IS}: {SNAME} ... {IR}: {IH} {IL} {IR} # {H} -> {L} {R} ... end grammar where {NS} and {NR} are the symbol and rule counts; {IS} and {IR} are sequential symbol and rule indices, in sequence (ranging from 1 to {NS} or {NR}); {SNAME} is a symbol's name (a string of nonblank chars); {IH}, {IL}, {IR} are the left-hand symbol and the two parts of the right-hand side of a rule. The symbol {IL} is 0 for unary rules. {H} -> {L} {R} is the rule in symbolic form.