dumpcycles.c
资源名称:pccts133.zip [点击查看]
上传用户:itx_2006
上传日期:2007-01-06
资源大小:493k
文件大小:1k
源码类别:
编译器/解释器
开发平台:
Others
- #include <stdio.h>
- #include <ctype.h>
- #include "set.h"
- #include "syn.h"
- #include "hash.h"
- #include "generic.h"
- #ifdef __cplusplus
- #ifndef __STDC__
- #define __STDC__
- #endif
- #endif
- void dumpcycles() {
- Cycle *c;
- CacheEntry *f;
- ListNode *p;
- int i=0;
- int k;
- int degree;
- for (k=1; k <= CLL_k; k++) {
- if (Cycles[k] == NULL) continue;
- for (p = Cycles[k]->next; p!=NULL; p=p->next) {
- c = (Cycle *) p->elem;
- degree=set_deg(c->cyclicDep);
- fprintf(stderr,"Cycle %d: (degree %d) %s -->n", i++, degree, RulePtr[c->croot]->rname);
- fprintf(stderr," *self*n");
- MR_dumpRuleSet(c->cyclicDep);
- fprintf(stderr,"n");
- f = (CacheEntry *)
- hash_get(Fcache,Fkey(RulePtr[c->croot]->rname,'o',k));
- if (f == NULL) {
- fprintf(stderr," *** FOLLOW(%s) must be in cache but isn't ***n",
- RulePtr[c->croot]->rname);
- };
- };
- };
- }
- void dumpfostack(int k) {
- int i=0;
- int *pi;
- fprintf(stderr,"n");
- if (FoStack[k] == NULL) {
- fprintf(stderr,"FoStack[%d] is nulln",k);
- };
- if (FoTOS[k] == NULL) {
- fprintf(stderr,"FoTOS[%d] is nulln",k);
- }
- if (FoTOS[k] != NULL && FoStack[k] != NULL) {
- for (pi=FoStack[k]; pi <= FoTOS[k]; pi++) {
- i++;
- fprintf(stderr,"#%d rule %d %sn",i,*pi,RulePtr[*pi]->rname);
- }
- }
- }