mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-20 11:29:24 +00:00
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21441 91177308-0d34-0410-b5e6-96231b3b80d8
50 lines
757 B
C
50 lines
757 B
C
char rcsid_rule[] = "$Id$";
|
|
|
|
#include "b.h"
|
|
#include <stdio.h>
|
|
|
|
RuleNum max_rule;
|
|
int max_erule_num;
|
|
|
|
struct rule stub_rule;
|
|
|
|
List rules;
|
|
|
|
Rule
|
|
newRule(delta, erulenum, lhs, pat) DeltaPtr delta; ERuleNum erulenum; NonTerminal lhs; Pattern pat;
|
|
{
|
|
Rule p;
|
|
|
|
p = (Rule) zalloc(sizeof(struct rule));
|
|
assert(p);
|
|
ASSIGNCOST(p->delta, delta);
|
|
p->erulenum = erulenum;
|
|
if (erulenum > max_erule_num) {
|
|
max_erule_num = erulenum;
|
|
}
|
|
p->num = max_rule++;
|
|
p->lhs = lhs;
|
|
p->pat = pat;
|
|
|
|
rules = newList(p, rules);
|
|
|
|
return p;
|
|
}
|
|
|
|
void
|
|
dumpRule(p) Rule p;
|
|
{
|
|
dumpNonTerminal(p->lhs);
|
|
printf(" : ");
|
|
dumpPattern(p->pat);
|
|
printf(" ");
|
|
dumpCost(p->delta);
|
|
printf("\n");
|
|
}
|
|
|
|
void
|
|
dumpRuleList(l) List l;
|
|
{
|
|
foreachList((ListFn)dumpRule, l);
|
|
}
|