4 #include "yaccParser/tree.h"
13 /************** hmodule ******************/
15 tree mkhmodule(PPghname, PPghimplist, PPghexplist, PPghmodlist, PPghmodline)
22 register struct Shmodule *pp =
23 (struct Shmodule *) malloc(sizeof(struct Shmodule));
25 pp -> Xghname = PPghname;
26 pp -> Xghimplist = PPghimplist;
27 pp -> Xghexplist = PPghexplist;
28 pp -> Xghmodlist = PPghmodlist;
29 pp -> Xghmodline = PPghmodline;
37 if(t -> tag != hmodule)
38 fprintf(stderr,"ghname: illegal selection; was %d\n", t -> tag);
39 #endif /* UGEN_DEBUG */
40 return(& t -> Xghname);
47 if(t -> tag != hmodule)
48 fprintf(stderr,"ghimplist: illegal selection; was %d\n", t -> tag);
49 #endif /* UGEN_DEBUG */
50 return(& t -> Xghimplist);
57 if(t -> tag != hmodule)
58 fprintf(stderr,"ghexplist: illegal selection; was %d\n", t -> tag);
59 #endif /* UGEN_DEBUG */
60 return(& t -> Xghexplist);
63 binding *Rghmodlist(t)
67 if(t -> tag != hmodule)
68 fprintf(stderr,"ghmodlist: illegal selection; was %d\n", t -> tag);
69 #endif /* UGEN_DEBUG */
70 return(& t -> Xghmodlist);
77 if(t -> tag != hmodule)
78 fprintf(stderr,"ghmodline: illegal selection; was %d\n", t -> tag);
79 #endif /* UGEN_DEBUG */
80 return(& t -> Xghmodline);
83 /************** ident ******************/
85 tree mkident(PPgident)
88 register struct Sident *pp =
89 (struct Sident *) malloc(sizeof(struct Sident));
91 pp -> Xgident = PPgident;
100 fprintf(stderr,"gident: illegal selection; was %d\n", t -> tag);
101 #endif /* UGEN_DEBUG */
102 return(& t -> Xgident);
105 /************** lit ******************/
110 register struct Slit *pp =
111 (struct Slit *) malloc(sizeof(struct Slit));
113 pp -> Xglit = PPglit;
122 fprintf(stderr,"glit: illegal selection; was %d\n", t -> tag);
123 #endif /* UGEN_DEBUG */
124 return(& t -> Xglit);
127 /************** tuple ******************/
129 tree mktuple(PPgtuplelist)
132 register struct Stuple *pp =
133 (struct Stuple *) malloc(sizeof(struct Stuple));
135 pp -> Xgtuplelist = PPgtuplelist;
143 if(t -> tag != tuple)
144 fprintf(stderr,"gtuplelist: illegal selection; was %d\n", t -> tag);
145 #endif /* UGEN_DEBUG */
146 return(& t -> Xgtuplelist);
149 /************** ap ******************/
151 tree mkap(PPgfun, PPgarg)
155 register struct Sap *pp =
156 (struct Sap *) malloc(sizeof(struct Sap));
158 pp -> Xgfun = PPgfun;
159 pp -> Xgarg = PPgarg;
168 fprintf(stderr,"gfun: illegal selection; was %d\n", t -> tag);
169 #endif /* UGEN_DEBUG */
170 return(& t -> Xgfun);
178 fprintf(stderr,"garg: illegal selection; was %d\n", t -> tag);
179 #endif /* UGEN_DEBUG */
180 return(& t -> Xgarg);
183 /************** lambda ******************/
185 tree mklambda(PPglampats, PPglamexpr, PPglamline)
190 register struct Slambda *pp =
191 (struct Slambda *) malloc(sizeof(struct Slambda));
193 pp -> Xglampats = PPglampats;
194 pp -> Xglamexpr = PPglamexpr;
195 pp -> Xglamline = PPglamline;
203 if(t -> tag != lambda)
204 fprintf(stderr,"glampats: illegal selection; was %d\n", t -> tag);
205 #endif /* UGEN_DEBUG */
206 return(& t -> Xglampats);
213 if(t -> tag != lambda)
214 fprintf(stderr,"glamexpr: illegal selection; was %d\n", t -> tag);
215 #endif /* UGEN_DEBUG */
216 return(& t -> Xglamexpr);
223 if(t -> tag != lambda)
224 fprintf(stderr,"glamline: illegal selection; was %d\n", t -> tag);
225 #endif /* UGEN_DEBUG */
226 return(& t -> Xglamline);
229 /************** let ******************/
231 tree mklet(PPgletvdeflist, PPgletvexpr)
232 binding PPgletvdeflist;
235 register struct Slet *pp =
236 (struct Slet *) malloc(sizeof(struct Slet));
238 pp -> Xgletvdeflist = PPgletvdeflist;
239 pp -> Xgletvexpr = PPgletvexpr;
243 binding *Rgletvdeflist(t)
248 fprintf(stderr,"gletvdeflist: illegal selection; was %d\n", t -> tag);
249 #endif /* UGEN_DEBUG */
250 return(& t -> Xgletvdeflist);
258 fprintf(stderr,"gletvexpr: illegal selection; was %d\n", t -> tag);
259 #endif /* UGEN_DEBUG */
260 return(& t -> Xgletvexpr);
263 /************** casee ******************/
265 tree mkcasee(PPgcaseexpr, PPgcasebody)
269 register struct Scasee *pp =
270 (struct Scasee *) malloc(sizeof(struct Scasee));
272 pp -> Xgcaseexpr = PPgcaseexpr;
273 pp -> Xgcasebody = PPgcasebody;
281 if(t -> tag != casee)
282 fprintf(stderr,"gcaseexpr: illegal selection; was %d\n", t -> tag);
283 #endif /* UGEN_DEBUG */
284 return(& t -> Xgcaseexpr);
291 if(t -> tag != casee)
292 fprintf(stderr,"gcasebody: illegal selection; was %d\n", t -> tag);
293 #endif /* UGEN_DEBUG */
294 return(& t -> Xgcasebody);
297 /************** ife ******************/
299 tree mkife(PPgifpred, PPgifthen, PPgifelse)
304 register struct Sife *pp =
305 (struct Sife *) malloc(sizeof(struct Sife));
307 pp -> Xgifpred = PPgifpred;
308 pp -> Xgifthen = PPgifthen;
309 pp -> Xgifelse = PPgifelse;
318 fprintf(stderr,"gifpred: illegal selection; was %d\n", t -> tag);
319 #endif /* UGEN_DEBUG */
320 return(& t -> Xgifpred);
328 fprintf(stderr,"gifthen: illegal selection; was %d\n", t -> tag);
329 #endif /* UGEN_DEBUG */
330 return(& t -> Xgifthen);
338 fprintf(stderr,"gifelse: illegal selection; was %d\n", t -> tag);
339 #endif /* UGEN_DEBUG */
340 return(& t -> Xgifelse);
343 /************** par ******************/
348 register struct Spar *pp =
349 (struct Spar *) malloc(sizeof(struct Spar));
351 pp -> Xgpare = PPgpare;
360 fprintf(stderr,"gpare: illegal selection; was %d\n", t -> tag);
361 #endif /* UGEN_DEBUG */
362 return(& t -> Xgpare);
365 /************** as ******************/
367 tree mkas(PPgasid, PPgase)
371 register struct Sas *pp =
372 (struct Sas *) malloc(sizeof(struct Sas));
374 pp -> Xgasid = PPgasid;
375 pp -> Xgase = PPgase;
384 fprintf(stderr,"gasid: illegal selection; was %d\n", t -> tag);
385 #endif /* UGEN_DEBUG */
386 return(& t -> Xgasid);
394 fprintf(stderr,"gase: illegal selection; was %d\n", t -> tag);
395 #endif /* UGEN_DEBUG */
396 return(& t -> Xgase);
399 /************** lazyp ******************/
401 tree mklazyp(PPglazyp)
404 register struct Slazyp *pp =
405 (struct Slazyp *) malloc(sizeof(struct Slazyp));
407 pp -> Xglazyp = PPglazyp;
415 if(t -> tag != lazyp)
416 fprintf(stderr,"glazyp: illegal selection; was %d\n", t -> tag);
417 #endif /* UGEN_DEBUG */
418 return(& t -> Xglazyp);
421 /************** plusp ******************/
423 tree mkplusp(PPgplusp, PPgplusi)
427 register struct Splusp *pp =
428 (struct Splusp *) malloc(sizeof(struct Splusp));
430 pp -> Xgplusp = PPgplusp;
431 pp -> Xgplusi = PPgplusi;
439 if(t -> tag != plusp)
440 fprintf(stderr,"gplusp: illegal selection; was %d\n", t -> tag);
441 #endif /* UGEN_DEBUG */
442 return(& t -> Xgplusp);
449 if(t -> tag != plusp)
450 fprintf(stderr,"gplusi: illegal selection; was %d\n", t -> tag);
451 #endif /* UGEN_DEBUG */
452 return(& t -> Xgplusi);
455 /************** wildp ******************/
459 register struct Swildp *pp =
460 (struct Swildp *) malloc(sizeof(struct Swildp));
465 /************** restr ******************/
467 tree mkrestr(PPgrestre, PPgrestrt)
471 register struct Srestr *pp =
472 (struct Srestr *) malloc(sizeof(struct Srestr));
474 pp -> Xgrestre = PPgrestre;
475 pp -> Xgrestrt = PPgrestrt;
483 if(t -> tag != restr)
484 fprintf(stderr,"grestre: illegal selection; was %d\n", t -> tag);
485 #endif /* UGEN_DEBUG */
486 return(& t -> Xgrestre);
493 if(t -> tag != restr)
494 fprintf(stderr,"grestrt: illegal selection; was %d\n", t -> tag);
495 #endif /* UGEN_DEBUG */
496 return(& t -> Xgrestrt);
499 /************** comprh ******************/
501 tree mkcomprh(PPgcexp, PPgcquals)
505 register struct Scomprh *pp =
506 (struct Scomprh *) malloc(sizeof(struct Scomprh));
508 pp -> Xgcexp = PPgcexp;
509 pp -> Xgcquals = PPgcquals;
517 if(t -> tag != comprh)
518 fprintf(stderr,"gcexp: illegal selection; was %d\n", t -> tag);
519 #endif /* UGEN_DEBUG */
520 return(& t -> Xgcexp);
527 if(t -> tag != comprh)
528 fprintf(stderr,"gcquals: illegal selection; was %d\n", t -> tag);
529 #endif /* UGEN_DEBUG */
530 return(& t -> Xgcquals);
533 /************** qual ******************/
535 tree mkqual(PPgqpat, PPgqexp)
539 register struct Squal *pp =
540 (struct Squal *) malloc(sizeof(struct Squal));
542 pp -> Xgqpat = PPgqpat;
543 pp -> Xgqexp = PPgqexp;
552 fprintf(stderr,"gqpat: illegal selection; was %d\n", t -> tag);
553 #endif /* UGEN_DEBUG */
554 return(& t -> Xgqpat);
562 fprintf(stderr,"gqexp: illegal selection; was %d\n", t -> tag);
563 #endif /* UGEN_DEBUG */
564 return(& t -> Xgqexp);
567 /************** guard ******************/
569 tree mkguard(PPggexp)
572 register struct Sguard *pp =
573 (struct Sguard *) malloc(sizeof(struct Sguard));
575 pp -> Xggexp = PPggexp;
583 if(t -> tag != guard)
584 fprintf(stderr,"ggexp: illegal selection; was %d\n", t -> tag);
585 #endif /* UGEN_DEBUG */
586 return(& t -> Xggexp);
589 /************** def ******************/
594 register struct Sdef *pp =
595 (struct Sdef *) malloc(sizeof(struct Sdef));
597 pp -> Xggdef = PPggdef;
606 fprintf(stderr,"ggdef: illegal selection; was %d\n", t -> tag);
607 #endif /* UGEN_DEBUG */
608 return(& t -> Xggdef);
611 /************** tinfixop ******************/
613 tree mktinfixop(PPgdummy)
616 register struct Stinfixop *pp =
617 (struct Stinfixop *) malloc(sizeof(struct Stinfixop));
618 pp -> tag = tinfixop;
619 pp -> Xgdummy = PPgdummy;
623 infixTree *Rgdummy(t)
627 if(t -> tag != tinfixop)
628 fprintf(stderr,"gdummy: illegal selection; was %d\n", t -> tag);
629 #endif /* UGEN_DEBUG */
630 return(& t -> Xgdummy);
633 /************** lsection ******************/
635 tree mklsection(PPglsexp, PPglsop)
639 register struct Slsection *pp =
640 (struct Slsection *) malloc(sizeof(struct Slsection));
641 pp -> tag = lsection;
642 pp -> Xglsexp = PPglsexp;
643 pp -> Xglsop = PPglsop;
651 if(t -> tag != lsection)
652 fprintf(stderr,"glsexp: illegal selection; was %d\n", t -> tag);
653 #endif /* UGEN_DEBUG */
654 return(& t -> Xglsexp);
661 if(t -> tag != lsection)
662 fprintf(stderr,"glsop: illegal selection; was %d\n", t -> tag);
663 #endif /* UGEN_DEBUG */
664 return(& t -> Xglsop);
667 /************** rsection ******************/
669 tree mkrsection(PPgrsop, PPgrsexp)
673 register struct Srsection *pp =
674 (struct Srsection *) malloc(sizeof(struct Srsection));
675 pp -> tag = rsection;
676 pp -> Xgrsop = PPgrsop;
677 pp -> Xgrsexp = PPgrsexp;
685 if(t -> tag != rsection)
686 fprintf(stderr,"grsop: illegal selection; was %d\n", t -> tag);
687 #endif /* UGEN_DEBUG */
688 return(& t -> Xgrsop);
695 if(t -> tag != rsection)
696 fprintf(stderr,"grsexp: illegal selection; was %d\n", t -> tag);
697 #endif /* UGEN_DEBUG */
698 return(& t -> Xgrsexp);
701 /************** eenum ******************/
703 tree mkeenum(PPgefrom, PPgestep, PPgeto)
708 register struct Seenum *pp =
709 (struct Seenum *) malloc(sizeof(struct Seenum));
711 pp -> Xgefrom = PPgefrom;
712 pp -> Xgestep = PPgestep;
713 pp -> Xgeto = PPgeto;
721 if(t -> tag != eenum)
722 fprintf(stderr,"gefrom: illegal selection; was %d\n", t -> tag);
723 #endif /* UGEN_DEBUG */
724 return(& t -> Xgefrom);
731 if(t -> tag != eenum)
732 fprintf(stderr,"gestep: illegal selection; was %d\n", t -> tag);
733 #endif /* UGEN_DEBUG */
734 return(& t -> Xgestep);
741 if(t -> tag != eenum)
742 fprintf(stderr,"geto: illegal selection; was %d\n", t -> tag);
743 #endif /* UGEN_DEBUG */
744 return(& t -> Xgeto);
747 /************** llist ******************/
749 tree mkllist(PPgllist)
752 register struct Sllist *pp =
753 (struct Sllist *) malloc(sizeof(struct Sllist));
755 pp -> Xgllist = PPgllist;
763 if(t -> tag != llist)
764 fprintf(stderr,"gllist: illegal selection; was %d\n", t -> tag);
765 #endif /* UGEN_DEBUG */
766 return(& t -> Xgllist);
769 /************** ccall ******************/
771 tree mkccall(PPgccid, PPgccinfo, PPgccargs)
776 register struct Sccall *pp =
777 (struct Sccall *) malloc(sizeof(struct Sccall));
779 pp -> Xgccid = PPgccid;
780 pp -> Xgccinfo = PPgccinfo;
781 pp -> Xgccargs = PPgccargs;
789 if(t -> tag != ccall)
790 fprintf(stderr,"gccid: illegal selection; was %d\n", t -> tag);
791 #endif /* UGEN_DEBUG */
792 return(& t -> Xgccid);
795 stringId *Rgccinfo(t)
799 if(t -> tag != ccall)
800 fprintf(stderr,"gccinfo: illegal selection; was %d\n", t -> tag);
801 #endif /* UGEN_DEBUG */
802 return(& t -> Xgccinfo);
809 if(t -> tag != ccall)
810 fprintf(stderr,"gccargs: illegal selection; was %d\n", t -> tag);
811 #endif /* UGEN_DEBUG */
812 return(& t -> Xgccargs);
815 /************** scc ******************/
817 tree mkscc(PPgsccid, PPgsccexp)
821 register struct Sscc *pp =
822 (struct Sscc *) malloc(sizeof(struct Sscc));
824 pp -> Xgsccid = PPgsccid;
825 pp -> Xgsccexp = PPgsccexp;
834 fprintf(stderr,"gsccid: illegal selection; was %d\n", t -> tag);
835 #endif /* UGEN_DEBUG */
836 return(& t -> Xgsccid);
844 fprintf(stderr,"gsccexp: illegal selection; was %d\n", t -> tag);
845 #endif /* UGEN_DEBUG */
846 return(& t -> Xgsccexp);
849 /************** negate ******************/
851 tree mknegate(PPgnexp)
854 register struct Snegate *pp =
855 (struct Snegate *) malloc(sizeof(struct Snegate));
857 pp -> Xgnexp = PPgnexp;
865 if(t -> tag != negate)
866 fprintf(stderr,"gnexp: illegal selection; was %d\n", t -> tag);
867 #endif /* UGEN_DEBUG */
868 return(& t -> Xgnexp);