#include #include "term.h" #define MAXNUMRULES 300 typedef struct _bindinglist *bindinglist; typedef struct _binding *binding; struct _bindinglist { binding first; bindinglist rest; }; struct _binding { char *var; term binding; }; /* Put your function prototypes here */ int main(int argc, char **argv) { FILE *infile; if (argc != 2) { fprintf(stderr,"usage: %s \n",argv[0]); exit(1); } infile = fopen(argv[1],"r"); if (infile == NULL) { fprintf(stderr,"could not open file: %s\n",argv[1]); exit(1); } /* Read rules into an array using calls to getrule(). You can assume an upper */ /* limit to the number of rules, but use a symbolic (#define) constant */ /* Loop until a halt is read in: */ /* call gettermlist to get a list of input terms */ /* if the term "halt" is at the head of the termlist, stop */ /* try to prove the list of terms, with a call to a "prove" function */ /* if successful, this should produce a binding list */ /* If sucessfully proven : */ /* compact the binding list (so that X/Y Y/a is converted to X/a, Y/a) */ /* remove all variables from binding list that are not in the original term */ /* print out the binding list */ /* print yes */ /* otherwise : */ /* print no */ }