aboutsummaryrefslogtreecommitdiffstats
path: root/utils/Burg/operator.c
blob: a37bbe15cdbe1df6e4514fcbd62b16c67059cc6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
char rcsid_operator[] = "$Id$";

#include "b.h"
#include <stdio.h>

int max_arity = -1;

List operators;
List leaves;

Operator
newOperator(name, num, arity) char *name; OperatorNum num; ArityNum arity;
{
  Operator op;

  assert(arity <= MAX_ARITY);
  op = (Operator) zalloc(sizeof(struct operator));
  assert(op);
  op->name = name;
  op->num = num;
  op->arity = arity;

  operators = newList(op, operators);

  return op;
}

void
dumpOperator_s(op) Operator op;
{
  printf("Op: %s(%d)=%d\n", op->name, op->arity, op->num);
}

void
dumpOperator(op, full) Operator op; int full;
{
  dumpOperator_s(op);
  if (full) {
    dumpTable(op->table, 0);
  }
}

void
dumpOperator_l(op) Operator op;
{
  dumpOperator(op, 1);
}