1/* original parser id follows */
2/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
3/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
4
5#define YYBYACC 1
6#define YYMAJOR 1
7#define YYMINOR 9
8#define YYCHECK "yyyymmdd"
9
10#define YYEMPTY (-1)
11#define yyclearin (yychar = YYEMPTY)
--- 370 unchanged lines hidden (view full) ---
382 262, 263, 264, 265, 266, -1, 259, 269, 261, 262,
383 263, 264, 265, 259, 260, 260, 259, -1, -1, -1,
384 -1, -1, -1, -1, -1, -1, -1, -1, -1, 259,
385 -1, 261, 262, 263, 264, 265, -1, -1, -1, 269,
386};
387#if YYBTYACC
388static const YYINT demo_ctable[] = { -1,
389 1, 10, -1, 21, 4, -1, 23, 29, -1, 1,
390 51, -1, 101, 56, -1,
391};
392#endif
393#define YYFINAL 1
394#ifndef YYDEBUG
395#define YYDEBUG 0
396#endif
397#define YYMAXTOKEN 269
398#define YYUNDFTOKEN 301
--- 230 unchanged lines hidden (view full) ---
629extern Decl * build_function(Decl *decl, Decl_List *dlist, Type *type);
630extern Decl_List * append_dlist(Decl_List *dlist, Decl *decl);
631extern Decl_List * build_dlist(Decl *decl);
632extern Expr * build_expr(Expr *left, enum Operator op, Expr *right);
633extern Expr * var_expr(Scope *scope, char *id);
634extern Code * build_expr_code(Expr *expr);
635extern Code * build_if(Expr *cond_expr, Code *then_stmt, Code *else_stmt);
636extern Code * code_append(Code *stmt_list, Code *stmt);
637#line 638 "btyacc_demo.tab.c"
638
639/* Release memory associated with symbol. */
640#if ! defined YYDESTRUCT_IS_DECLARED
641static void
642YYDESTRUCT_DECL()
643{
644 switch (psymb)
645 {
646 case 43:
647#line 83 "btyacc_demo.y"
648 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
649 msg,
650 (*loc).first_line, (*loc).first_column,
651 (*loc).last_line, (*loc).last_column);
652 /* in this example, we don't know what to do here */ }
653 break;
654#line 655 "btyacc_demo.tab.c"
655 case 45:
656#line 83 "btyacc_demo.y"
657 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
658 msg,
659 (*loc).first_line, (*loc).first_column,
660 (*loc).last_line, (*loc).last_column);
661 /* in this example, we don't know what to do here */ }
662 break;
663#line 664 "btyacc_demo.tab.c"
664 case 42:
665#line 83 "btyacc_demo.y"
666 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
667 msg,
668 (*loc).first_line, (*loc).first_column,
669 (*loc).last_line, (*loc).last_column);
670 /* in this example, we don't know what to do here */ }
671 break;
672#line 673 "btyacc_demo.tab.c"
673 case 47:
674#line 83 "btyacc_demo.y"
675 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
676 msg,
677 (*loc).first_line, (*loc).first_column,
678 (*loc).last_line, (*loc).last_column);
679 /* in this example, we don't know what to do here */ }
680 break;
681#line 682 "btyacc_demo.tab.c"
682 case 37:
683#line 83 "btyacc_demo.y"
684 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
685 msg,
686 (*loc).first_line, (*loc).first_column,
687 (*loc).last_line, (*loc).last_column);
688 /* in this example, we don't know what to do here */ }
689 break;
690#line 691 "btyacc_demo.tab.c"
691 case 257:
692#line 83 "btyacc_demo.y"
693 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
694 msg,
695 (*loc).first_line, (*loc).first_column,
696 (*loc).last_line, (*loc).last_column);
697 /* in this example, we don't know what to do here */ }
698 break;
699#line 700 "btyacc_demo.tab.c"
700 case 258:
701#line 83 "btyacc_demo.y"
702 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
703 msg,
704 (*loc).first_line, (*loc).first_column,
705 (*loc).last_line, (*loc).last_column);
706 /* in this example, we don't know what to do here */ }
707 break;
708#line 709 "btyacc_demo.tab.c"
709 case 40:
710#line 83 "btyacc_demo.y"
711 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
712 msg,
713 (*loc).first_line, (*loc).first_column,
714 (*loc).last_line, (*loc).last_column);
715 /* in this example, we don't know what to do here */ }
716 break;
717#line 718 "btyacc_demo.tab.c"
718 case 91:
719#line 83 "btyacc_demo.y"
720 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
721 msg,
722 (*loc).first_line, (*loc).first_column,
723 (*loc).last_line, (*loc).last_column);
724 /* in this example, we don't know what to do here */ }
725 break;
726#line 727 "btyacc_demo.tab.c"
727 case 46:
728#line 83 "btyacc_demo.y"
729 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
730 msg,
731 (*loc).first_line, (*loc).first_column,
732 (*loc).last_line, (*loc).last_column);
733 /* in this example, we don't know what to do here */ }
734 break;
735#line 736 "btyacc_demo.tab.c"
736 case 259:
737#line 78 "btyacc_demo.y"
738 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
739 msg,
740 (*loc).first_line, (*loc).first_column,
741 (*loc).last_line, (*loc).last_column);
742 free((*val).id); }
743 break;
744#line 745 "btyacc_demo.tab.c"
745 case 260:
746#line 78 "btyacc_demo.y"
747 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
748 msg,
749 (*loc).first_line, (*loc).first_column,
750 (*loc).last_line, (*loc).last_column);
751 free((*val).expr); }
752 break;
753#line 754 "btyacc_demo.tab.c"
754 case 261:
755#line 83 "btyacc_demo.y"
756 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
757 msg,
758 (*loc).first_line, (*loc).first_column,
759 (*loc).last_line, (*loc).last_column);
760 /* in this example, we don't know what to do here */ }
761 break;
762#line 763 "btyacc_demo.tab.c"
763 case 262:
764#line 83 "btyacc_demo.y"
765 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
766 msg,
767 (*loc).first_line, (*loc).first_column,
768 (*loc).last_line, (*loc).last_column);
769 /* in this example, we don't know what to do here */ }
770 break;
771#line 772 "btyacc_demo.tab.c"
772 case 263:
773#line 83 "btyacc_demo.y"
774 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
775 msg,
776 (*loc).first_line, (*loc).first_column,
777 (*loc).last_line, (*loc).last_column);
778 /* in this example, we don't know what to do here */ }
779 break;
780#line 781 "btyacc_demo.tab.c"
781 case 264:
782#line 83 "btyacc_demo.y"
783 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
784 msg,
785 (*loc).first_line, (*loc).first_column,
786 (*loc).last_line, (*loc).last_column);
787 /* in this example, we don't know what to do here */ }
788 break;
789#line 790 "btyacc_demo.tab.c"
790 case 265:
791#line 83 "btyacc_demo.y"
792 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
793 msg,
794 (*loc).first_line, (*loc).first_column,
795 (*loc).last_line, (*loc).last_column);
796 /* in this example, we don't know what to do here */ }
797 break;
798#line 799 "btyacc_demo.tab.c"
799 case 266:
800#line 83 "btyacc_demo.y"
801 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
802 msg,
803 (*loc).first_line, (*loc).first_column,
804 (*loc).last_line, (*loc).last_column);
805 /* in this example, we don't know what to do here */ }
806 break;
807#line 808 "btyacc_demo.tab.c"
808 case 267:
809#line 83 "btyacc_demo.y"
810 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
811 msg,
812 (*loc).first_line, (*loc).first_column,
813 (*loc).last_line, (*loc).last_column);
814 /* in this example, we don't know what to do here */ }
815 break;
816#line 817 "btyacc_demo.tab.c"
817 case 268:
818#line 83 "btyacc_demo.y"
819 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
820 msg,
821 (*loc).first_line, (*loc).first_column,
822 (*loc).last_line, (*loc).last_column);
823 /* in this example, we don't know what to do here */ }
824 break;
825#line 826 "btyacc_demo.tab.c"
826 case 269:
827#line 83 "btyacc_demo.y"
828 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
829 msg,
830 (*loc).first_line, (*loc).first_column,
831 (*loc).last_line, (*loc).last_column);
832 /* in this example, we don't know what to do here */ }
833 break;
834#line 835 "btyacc_demo.tab.c"
835 case 59:
836#line 83 "btyacc_demo.y"
837 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
838 msg,
839 (*loc).first_line, (*loc).first_column,
840 (*loc).last_line, (*loc).last_column);
841 /* in this example, we don't know what to do here */ }
842 break;
843#line 844 "btyacc_demo.tab.c"
844 case 44:
845#line 83 "btyacc_demo.y"
846 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
847 msg,
848 (*loc).first_line, (*loc).first_column,
849 (*loc).last_line, (*loc).last_column);
850 /* in this example, we don't know what to do here */ }
851 break;
852#line 853 "btyacc_demo.tab.c"
853 case 41:
854#line 83 "btyacc_demo.y"
855 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
856 msg,
857 (*loc).first_line, (*loc).first_column,
858 (*loc).last_line, (*loc).last_column);
859 /* in this example, we don't know what to do here */ }
860 break;
861#line 862 "btyacc_demo.tab.c"
862 case 93:
863#line 83 "btyacc_demo.y"
864 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
865 msg,
866 (*loc).first_line, (*loc).first_column,
867 (*loc).last_line, (*loc).last_column);
868 /* in this example, we don't know what to do here */ }
869 break;
870#line 871 "btyacc_demo.tab.c"
871 case 123:
872#line 83 "btyacc_demo.y"
873 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
874 msg,
875 (*loc).first_line, (*loc).first_column,
876 (*loc).last_line, (*loc).last_column);
877 /* in this example, we don't know what to do here */ }
878 break;
879#line 880 "btyacc_demo.tab.c"
880 case 125:
881#line 83 "btyacc_demo.y"
882 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
883 msg,
884 (*loc).first_line, (*loc).first_column,
885 (*loc).last_line, (*loc).last_column);
886 /* in this example, we don't know what to do here */ }
887 break;
888#line 889 "btyacc_demo.tab.c"
889 case 270:
890#line 83 "btyacc_demo.y"
891 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
892 msg,
893 (*loc).first_line, (*loc).first_column,
894 (*loc).last_line, (*loc).last_column);
895 /* in this example, we don't know what to do here */ }
896 break;
897#line 898 "btyacc_demo.tab.c"
898 case 271:
899#line 83 "btyacc_demo.y"
900 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
901 msg,
902 (*loc).first_line, (*loc).first_column,
903 (*loc).last_line, (*loc).last_column);
904 /* in this example, we don't know what to do here */ }
905 break;
906#line 907 "btyacc_demo.tab.c"
907 case 272:
908#line 78 "btyacc_demo.y"
909 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
910 msg,
911 (*loc).first_line, (*loc).first_column,
912 (*loc).last_line, (*loc).last_column);
913 free((*val).expr); }
914 break;
915#line 916 "btyacc_demo.tab.c"
916 case 273:
917#line 67 "btyacc_demo.y"
918 { /* 'msg' is a 'char *' indicating the context of destructor invocation*/
919 printf("%s accessed by symbol \"decl\" (case s.b. 273) @ position[%d,%d..%d,%d]\n",
920 msg,
921 (*loc).first_line, (*loc).first_column,
922 (*loc).last_line, (*loc).last_column);
923 free((*val).decl->scope); free((*val).decl->type); }
924 break;
925#line 926 "btyacc_demo.tab.c"
926 case 274:
927#line 83 "btyacc_demo.y"
928 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
929 msg,
930 (*loc).first_line, (*loc).first_column,
931 (*loc).last_line, (*loc).last_column);
932 /* in this example, we don't know what to do here */ }
933 break;
934#line 935 "btyacc_demo.tab.c"
935 case 275:
936#line 83 "btyacc_demo.y"
937 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
938 msg,
939 (*loc).first_line, (*loc).first_column,
940 (*loc).last_line, (*loc).last_column);
941 /* in this example, we don't know what to do here */ }
942 break;
943#line 944 "btyacc_demo.tab.c"
944 case 276:
945#line 78 "btyacc_demo.y"
946 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
947 msg,
948 (*loc).first_line, (*loc).first_column,
949 (*loc).last_line, (*loc).last_column);
950 free((*val).code); }
951 break;
952#line 953 "btyacc_demo.tab.c"
953 case 277:
954#line 78 "btyacc_demo.y"
955 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
956 msg,
957 (*loc).first_line, (*loc).first_column,
958 (*loc).last_line, (*loc).last_column);
959 free((*val).code); }
960 break;
961#line 962 "btyacc_demo.tab.c"
962 case 278:
963#line 78 "btyacc_demo.y"
964 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
965 msg,
966 (*loc).first_line, (*loc).first_column,
967 (*loc).last_line, (*loc).last_column);
968 free((*val).code); }
969 break;
970#line 971 "btyacc_demo.tab.c"
971 case 279:
972#line 73 "btyacc_demo.y"
973 { printf("%s accessed by symbol with type <decl> (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n",
974 msg,
975 (*loc).first_line, (*loc).first_column,
976 (*loc).last_line, (*loc).last_column);
977 free((*val).decl); }
978 break;
979#line 980 "btyacc_demo.tab.c"
980 case 280:
981#line 73 "btyacc_demo.y"
982 { printf("%s accessed by symbol with type <decl> (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n",
983 msg,
984 (*loc).first_line, (*loc).first_column,
985 (*loc).last_line, (*loc).last_column);
986 free((*val).decl); }
987 break;
988#line 989 "btyacc_demo.tab.c"
989 case 281:
990#line 78 "btyacc_demo.y"
991 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
992 msg,
993 (*loc).first_line, (*loc).first_column,
994 (*loc).last_line, (*loc).last_column);
995 free((*val).type); }
996 break;
997#line 998 "btyacc_demo.tab.c"
998 case 282:
999#line 78 "btyacc_demo.y"
1000 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1001 msg,
1002 (*loc).first_line, (*loc).first_column,
1003 (*loc).last_line, (*loc).last_column);
1004 free((*val).type); }
1005 break;
1006#line 1007 "btyacc_demo.tab.c"
1007 case 283:
1008#line 78 "btyacc_demo.y"
1009 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1010 msg,
1011 (*loc).first_line, (*loc).first_column,
1012 (*loc).last_line, (*loc).last_column);
1013 free((*val).type); }
1014 break;
1015#line 1016 "btyacc_demo.tab.c"
1016 case 284:
1017#line 78 "btyacc_demo.y"
1018 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1019 msg,
1020 (*loc).first_line, (*loc).first_column,
1021 (*loc).last_line, (*loc).last_column);
1022 free((*val).type); }
1023 break;
1024#line 1025 "btyacc_demo.tab.c"
1025 case 285:
1026#line 78 "btyacc_demo.y"
1027 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1028 msg,
1029 (*loc).first_line, (*loc).first_column,
1030 (*loc).last_line, (*loc).last_column);
1031 free((*val).type); }
1032 break;
1033#line 1034 "btyacc_demo.tab.c"
1034 case 286:
1035#line 78 "btyacc_demo.y"
1036 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1037 msg,
1038 (*loc).first_line, (*loc).first_column,
1039 (*loc).last_line, (*loc).last_column);
1040 free((*val).scope); }
1041 break;
1042#line 1043 "btyacc_demo.tab.c"
1043 case 287:
1044#line 78 "btyacc_demo.y"
1045 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1046 msg,
1047 (*loc).first_line, (*loc).first_column,
1048 (*loc).last_line, (*loc).last_column);
1049 free((*val).dlist); }
1050 break;
1051#line 1052 "btyacc_demo.tab.c"
1052 case 288:
1053#line 78 "btyacc_demo.y"
1054 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1055 msg,
1056 (*loc).first_line, (*loc).first_column,
1057 (*loc).last_line, (*loc).last_column);
1058 free((*val).dlist); }
1059 break;
1060#line 1061 "btyacc_demo.tab.c"
1061 case 289:
1062#line 78 "btyacc_demo.y"
1063 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1064 msg,
1065 (*loc).first_line, (*loc).first_column,
1066 (*loc).last_line, (*loc).last_column);
1067 free((*val).scope); }
1068 break;
1069#line 1070 "btyacc_demo.tab.c"
1070 case 290:
1071#line 78 "btyacc_demo.y"
1072 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1073 msg,
1074 (*loc).first_line, (*loc).first_column,
1075 (*loc).last_line, (*loc).last_column);
1076 free((*val).scope); }
1077 break;
1078#line 1079 "btyacc_demo.tab.c"
1079 case 291:
1080#line 78 "btyacc_demo.y"
1081 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1082 msg,
1083 (*loc).first_line, (*loc).first_column,
1084 (*loc).last_line, (*loc).last_column);
1085 free((*val).type); }
1086 break;
1087#line 1088 "btyacc_demo.tab.c"
1088 case 292:
1089#line 78 "btyacc_demo.y"
1090 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1091 msg,
1092 (*loc).first_line, (*loc).first_column,
1093 (*loc).last_line, (*loc).last_column);
1094 free((*val).scope); }
1095 break;
1096#line 1097 "btyacc_demo.tab.c"
1097 case 293:
1098#line 78 "btyacc_demo.y"
1099 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1100 msg,
1101 (*loc).first_line, (*loc).first_column,
1102 (*loc).last_line, (*loc).last_column);
1103 free((*val).scope); }
1104 break;
1105#line 1106 "btyacc_demo.tab.c"
1106 case 294:
1107#line 78 "btyacc_demo.y"
1108 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1109 msg,
1110 (*loc).first_line, (*loc).first_column,
1111 (*loc).last_line, (*loc).last_column);
1112 free((*val).type); }
1113 break;
1114#line 1115 "btyacc_demo.tab.c"
1115 case 295:
1116#line 78 "btyacc_demo.y"
1117 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1118 msg,
1119 (*loc).first_line, (*loc).first_column,
1120 (*loc).last_line, (*loc).last_column);
1121 free((*val).scope); }
1122 break;
1123#line 1124 "btyacc_demo.tab.c"
1124 case 296:
1125#line 78 "btyacc_demo.y"
1126 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1127 msg,
1128 (*loc).first_line, (*loc).first_column,
1129 (*loc).last_line, (*loc).last_column);
1130 free((*val).type); }
1131 break;
1132#line 1133 "btyacc_demo.tab.c"
1133 case 297:
1134#line 78 "btyacc_demo.y"
1135 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1136 msg,
1137 (*loc).first_line, (*loc).first_column,
1138 (*loc).last_line, (*loc).last_column);
1139 free((*val).scope); }
1140 break;
1141#line 1142 "btyacc_demo.tab.c"
1142 case 298:
1143#line 78 "btyacc_demo.y"
1144 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1145 msg,
1146 (*loc).first_line, (*loc).first_column,
1147 (*loc).last_line, (*loc).last_column);
1148 free((*val).scope); }
1149 break;
1150#line 1151 "btyacc_demo.tab.c"
1151 case 299:
1152#line 78 "btyacc_demo.y"
1153 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1154 msg,
1155 (*loc).first_line, (*loc).first_column,
1156 (*loc).last_line, (*loc).last_column);
1157 free((*val).scope); }
1158 break;
1159#line 1160 "btyacc_demo.tab.c"
1160 case 300:
1161#line 78 "btyacc_demo.y"
1162 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1163 msg,
1164 (*loc).first_line, (*loc).first_column,
1165 (*loc).last_line, (*loc).last_column);
1166 free((*val).scope); }
1167 break;
1168#line 1169 "btyacc_demo.tab.c"
1169 }
1170}
1171#define YYDESTRUCT_IS_DECLARED 1
1172#endif
1173
1174/* For use in generated program */
1175#define yydepth (int)(yystack.s_mark - yystack.s_base)
1176#if YYBTYACC
1177#define yytrial (yyps->save)
1178#endif /* YYBTYACC */
1179
1180#if YYDEBUG
1181#include <stdio.h> /* needed for printf */
1182#endif
1183
1184#include <stdlib.h> /* needed for malloc, etc */
1185#include <string.h> /* needed for memset */
1186
1187/* allocate initial stack or double stack size, up to YYMAXDEPTH */
1188static int yygrowstack(YYSTACKDATA *data)
1189{
1190 int i;
1191 unsigned newsize;
1192 short *newss;
1193 YYSTYPE *newvs;
--- 167 unchanged lines hidden (view full) ---
1361 yychar = *yylexp++;
1362 break;
1363 }
1364 if (yyps->save)
1365 {
1366 /* in trial mode; save scanner results for future parse attempts */
1367 if (yylvp == yylvlim)
1368 { /* Enlarge lexical value queue */
1369 int p = yylvp - yylvals;
1370 int s = yylvlim - yylvals;
1371
1372 s += YYLVQUEUEGROWTH;
1373 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
1374 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
1375#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1376 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
1377#endif
1378 yylvp = yylve = yylvals + p;
--- 79 unchanged lines hidden (view full) ---
1458 }
1459#endif
1460 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1461 if (save == NULL) goto yyenomem;
1462 save->save = yyps->save;
1463 save->state = yystate;
1464 save->errflag = yyerrflag;
1465 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
1466 memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1467 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
1468 memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1469#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1470 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
1471 memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1472#endif
1473 ctry = yytable[yyn];
1474 if (yyctable[ctry] == -1)
1475 {
1476#if YYDEBUG
1477 if (yydebug && yychar >= YYEOF)
1478 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
1479#endif
--- 38 unchanged lines hidden (view full) ---
1518 {
1519 yylvp--;
1520#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1521 yylpp--;
1522#endif
1523 yylexp--;
1524 yychar = YYEMPTY;
1525 }
1526 save->lexeme = yylvp - yylvals;
1527 yyps->save = save;
1528 }
1529 if (yytable[yyn] == ctry)
1530 {
1531#if YYDEBUG
1532 if (yydebug)
1533 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1534 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
--- 77 unchanged lines hidden (view full) ---
1612 if (yyerrctx) yyFreeState(yyerrctx);
1613 /* Create and fill out new saved error context state */
1614 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1615 if (yyerrctx == NULL) goto yyenomem;
1616 yyerrctx->save = yyps->save;
1617 yyerrctx->state = yystate;
1618 yyerrctx->errflag = yyerrflag;
1619 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
1620 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1621 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
1622 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1623#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1624 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
1625 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1626#endif
1627 yyerrctx->lexeme = yylvp - yylvals;
1628 }
1629 yylvp = yylvals + save->lexeme;
1630#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1631 yylpp = yylpsns + save->lexeme;
1632#endif
1633 yylexp = yylexemes + save->lexeme;
1634 yychar = YYEMPTY;
1635 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
1636 memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1637 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
1638 memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1639#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1640 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
1641 memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1642#endif
1643 ctry = ++save->ctry;
1644 yystate = save->state;
1645 /* We tried shift, try reduce now */
1646 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
1647 yyps->save = save->save;
1648 save->save = NULL;
1649 yyFreeState(save);
--- 13 unchanged lines hidden (view full) ---
1663#endif
1664 yylexp = yylexemes + yyerrctx->lexeme;
1665 yychar = yylexp[-1];
1666 yylval = yylvp[-1];
1667#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1668 yylloc = yylpp[-1];
1669#endif
1670 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1671 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1672 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1673 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1674#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1675 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1676 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1677#endif
1678 yystate = yyerrctx->state;
1679 yyFreeState(yyerrctx);
1680 yyerrctx = NULL;
1681 }
1682 yynewerrflag = 1;
1683 }
1684 if (yynewerrflag == 0) goto yyinrecovery;
--- 403 unchanged lines hidden (view full) ---
2088#line 193 "btyacc_demo.y"
2089 { yyval.code = code_append(yystack.l_mark[-2].code, yystack.l_mark[0].code); }
2090break;
2091case 61:
2092 if (!yytrial)
2093#line 197 "btyacc_demo.y"
2094 { yyval.code = yystack.l_mark[-1].code; }
2095break;
2096#line 2097 "btyacc_demo.tab.c"
2097 default:
2098 break;
2099 }
2100 yystack.s_mark -= yym;
2101 yystate = *yystack.s_mark;
2102 yystack.l_mark -= yym;
2103#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2104 yystack.p_mark -= yym;
--- 34 unchanged lines hidden (view full) ---
2139 yychar = *yylexp++;
2140 break;
2141 }
2142 if (yyps->save)
2143 {
2144 /* in trial mode; save scanner results for future parse attempts */
2145 if (yylvp == yylvlim)
2146 { /* Enlarge lexical value queue */
2147 int p = yylvp - yylvals;
2148 int s = yylvlim - yylvals;
2149
2150 s += YYLVQUEUEGROWTH;
2151 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
2152 goto yyenomem;
2153 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
2154 goto yyenomem;
2155#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2156 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
--- 86 unchanged lines hidden (view full) ---
2243 }
2244 yylvp = yylvals + yypath->lexeme;
2245#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2246 yylpp = yylpsns + yypath->lexeme;
2247#endif
2248 yylexp = yylexemes + yypath->lexeme;
2249 yychar = YYEMPTY;
2250 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
2251 memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
2252 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
2253 memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
2254#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2255 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
2256 memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
2257#endif
2258 yystate = yypath->state;
2259 goto yyloop;
2260#endif /* YYBTYACC */
2261
2262yyoverflow:
2263 YYERROR_CALL("yacc stack overflow");
2264#if YYBTYACC
--- 67 unchanged lines hidden ---
2/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
3/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
4
5#define YYBYACC 1
6#define YYMAJOR 1
7#define YYMINOR 9
8#define YYCHECK "yyyymmdd"
9
10#define YYEMPTY (-1)
11#define yyclearin (yychar = YYEMPTY)
--- 370 unchanged lines hidden (view full) ---
382 262, 263, 264, 265, 266, -1, 259, 269, 261, 262,
383 263, 264, 265, 259, 260, 260, 259, -1, -1, -1,
384 -1, -1, -1, -1, -1, -1, -1, -1, -1, 259,
385 -1, 261, 262, 263, 264, 265, -1, -1, -1, 269,
386};
387#if YYBTYACC
388static const YYINT demo_ctable[] = { -1,
389 1, 10, -1, 21, 4, -1, 23, 29, -1, 1,
390 51, -1, 101, 56, -1,
391};
392#endif
393#define YYFINAL 1
394#ifndef YYDEBUG
395#define YYDEBUG 0
396#endif
397#define YYMAXTOKEN 269
398#define YYUNDFTOKEN 301
--- 230 unchanged lines hidden (view full) ---
629extern Decl * build_function(Decl *decl, Decl_List *dlist, Type *type);
630extern Decl_List * append_dlist(Decl_List *dlist, Decl *decl);
631extern Decl_List * build_dlist(Decl *decl);
632extern Expr * build_expr(Expr *left, enum Operator op, Expr *right);
633extern Expr * var_expr(Scope *scope, char *id);
634extern Code * build_expr_code(Expr *expr);
635extern Code * build_if(Expr *cond_expr, Code *then_stmt, Code *else_stmt);
636extern Code * code_append(Code *stmt_list, Code *stmt);
637#line 638 "btyacc_demo.tab.c"
638
639/* Release memory associated with symbol. */
640#if ! defined YYDESTRUCT_IS_DECLARED
641static void
642YYDESTRUCT_DECL()
643{
644 switch (psymb)
645 {
646 case 43:
647#line 83 "btyacc_demo.y"
648 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
649 msg,
650 (*loc).first_line, (*loc).first_column,
651 (*loc).last_line, (*loc).last_column);
652 /* in this example, we don't know what to do here */ }
653 break;
654#line 655 "btyacc_demo.tab.c"
655 case 45:
656#line 83 "btyacc_demo.y"
657 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
658 msg,
659 (*loc).first_line, (*loc).first_column,
660 (*loc).last_line, (*loc).last_column);
661 /* in this example, we don't know what to do here */ }
662 break;
663#line 664 "btyacc_demo.tab.c"
664 case 42:
665#line 83 "btyacc_demo.y"
666 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
667 msg,
668 (*loc).first_line, (*loc).first_column,
669 (*loc).last_line, (*loc).last_column);
670 /* in this example, we don't know what to do here */ }
671 break;
672#line 673 "btyacc_demo.tab.c"
673 case 47:
674#line 83 "btyacc_demo.y"
675 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
676 msg,
677 (*loc).first_line, (*loc).first_column,
678 (*loc).last_line, (*loc).last_column);
679 /* in this example, we don't know what to do here */ }
680 break;
681#line 682 "btyacc_demo.tab.c"
682 case 37:
683#line 83 "btyacc_demo.y"
684 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
685 msg,
686 (*loc).first_line, (*loc).first_column,
687 (*loc).last_line, (*loc).last_column);
688 /* in this example, we don't know what to do here */ }
689 break;
690#line 691 "btyacc_demo.tab.c"
691 case 257:
692#line 83 "btyacc_demo.y"
693 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
694 msg,
695 (*loc).first_line, (*loc).first_column,
696 (*loc).last_line, (*loc).last_column);
697 /* in this example, we don't know what to do here */ }
698 break;
699#line 700 "btyacc_demo.tab.c"
700 case 258:
701#line 83 "btyacc_demo.y"
702 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
703 msg,
704 (*loc).first_line, (*loc).first_column,
705 (*loc).last_line, (*loc).last_column);
706 /* in this example, we don't know what to do here */ }
707 break;
708#line 709 "btyacc_demo.tab.c"
709 case 40:
710#line 83 "btyacc_demo.y"
711 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
712 msg,
713 (*loc).first_line, (*loc).first_column,
714 (*loc).last_line, (*loc).last_column);
715 /* in this example, we don't know what to do here */ }
716 break;
717#line 718 "btyacc_demo.tab.c"
718 case 91:
719#line 83 "btyacc_demo.y"
720 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
721 msg,
722 (*loc).first_line, (*loc).first_column,
723 (*loc).last_line, (*loc).last_column);
724 /* in this example, we don't know what to do here */ }
725 break;
726#line 727 "btyacc_demo.tab.c"
727 case 46:
728#line 83 "btyacc_demo.y"
729 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
730 msg,
731 (*loc).first_line, (*loc).first_column,
732 (*loc).last_line, (*loc).last_column);
733 /* in this example, we don't know what to do here */ }
734 break;
735#line 736 "btyacc_demo.tab.c"
736 case 259:
737#line 78 "btyacc_demo.y"
738 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
739 msg,
740 (*loc).first_line, (*loc).first_column,
741 (*loc).last_line, (*loc).last_column);
742 free((*val).id); }
743 break;
744#line 745 "btyacc_demo.tab.c"
745 case 260:
746#line 78 "btyacc_demo.y"
747 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
748 msg,
749 (*loc).first_line, (*loc).first_column,
750 (*loc).last_line, (*loc).last_column);
751 free((*val).expr); }
752 break;
753#line 754 "btyacc_demo.tab.c"
754 case 261:
755#line 83 "btyacc_demo.y"
756 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
757 msg,
758 (*loc).first_line, (*loc).first_column,
759 (*loc).last_line, (*loc).last_column);
760 /* in this example, we don't know what to do here */ }
761 break;
762#line 763 "btyacc_demo.tab.c"
763 case 262:
764#line 83 "btyacc_demo.y"
765 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
766 msg,
767 (*loc).first_line, (*loc).first_column,
768 (*loc).last_line, (*loc).last_column);
769 /* in this example, we don't know what to do here */ }
770 break;
771#line 772 "btyacc_demo.tab.c"
772 case 263:
773#line 83 "btyacc_demo.y"
774 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
775 msg,
776 (*loc).first_line, (*loc).first_column,
777 (*loc).last_line, (*loc).last_column);
778 /* in this example, we don't know what to do here */ }
779 break;
780#line 781 "btyacc_demo.tab.c"
781 case 264:
782#line 83 "btyacc_demo.y"
783 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
784 msg,
785 (*loc).first_line, (*loc).first_column,
786 (*loc).last_line, (*loc).last_column);
787 /* in this example, we don't know what to do here */ }
788 break;
789#line 790 "btyacc_demo.tab.c"
790 case 265:
791#line 83 "btyacc_demo.y"
792 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
793 msg,
794 (*loc).first_line, (*loc).first_column,
795 (*loc).last_line, (*loc).last_column);
796 /* in this example, we don't know what to do here */ }
797 break;
798#line 799 "btyacc_demo.tab.c"
799 case 266:
800#line 83 "btyacc_demo.y"
801 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
802 msg,
803 (*loc).first_line, (*loc).first_column,
804 (*loc).last_line, (*loc).last_column);
805 /* in this example, we don't know what to do here */ }
806 break;
807#line 808 "btyacc_demo.tab.c"
808 case 267:
809#line 83 "btyacc_demo.y"
810 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
811 msg,
812 (*loc).first_line, (*loc).first_column,
813 (*loc).last_line, (*loc).last_column);
814 /* in this example, we don't know what to do here */ }
815 break;
816#line 817 "btyacc_demo.tab.c"
817 case 268:
818#line 83 "btyacc_demo.y"
819 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
820 msg,
821 (*loc).first_line, (*loc).first_column,
822 (*loc).last_line, (*loc).last_column);
823 /* in this example, we don't know what to do here */ }
824 break;
825#line 826 "btyacc_demo.tab.c"
826 case 269:
827#line 83 "btyacc_demo.y"
828 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
829 msg,
830 (*loc).first_line, (*loc).first_column,
831 (*loc).last_line, (*loc).last_column);
832 /* in this example, we don't know what to do here */ }
833 break;
834#line 835 "btyacc_demo.tab.c"
835 case 59:
836#line 83 "btyacc_demo.y"
837 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
838 msg,
839 (*loc).first_line, (*loc).first_column,
840 (*loc).last_line, (*loc).last_column);
841 /* in this example, we don't know what to do here */ }
842 break;
843#line 844 "btyacc_demo.tab.c"
844 case 44:
845#line 83 "btyacc_demo.y"
846 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
847 msg,
848 (*loc).first_line, (*loc).first_column,
849 (*loc).last_line, (*loc).last_column);
850 /* in this example, we don't know what to do here */ }
851 break;
852#line 853 "btyacc_demo.tab.c"
853 case 41:
854#line 83 "btyacc_demo.y"
855 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
856 msg,
857 (*loc).first_line, (*loc).first_column,
858 (*loc).last_line, (*loc).last_column);
859 /* in this example, we don't know what to do here */ }
860 break;
861#line 862 "btyacc_demo.tab.c"
862 case 93:
863#line 83 "btyacc_demo.y"
864 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
865 msg,
866 (*loc).first_line, (*loc).first_column,
867 (*loc).last_line, (*loc).last_column);
868 /* in this example, we don't know what to do here */ }
869 break;
870#line 871 "btyacc_demo.tab.c"
871 case 123:
872#line 83 "btyacc_demo.y"
873 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
874 msg,
875 (*loc).first_line, (*loc).first_column,
876 (*loc).last_line, (*loc).last_column);
877 /* in this example, we don't know what to do here */ }
878 break;
879#line 880 "btyacc_demo.tab.c"
880 case 125:
881#line 83 "btyacc_demo.y"
882 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
883 msg,
884 (*loc).first_line, (*loc).first_column,
885 (*loc).last_line, (*loc).last_column);
886 /* in this example, we don't know what to do here */ }
887 break;
888#line 889 "btyacc_demo.tab.c"
889 case 270:
890#line 83 "btyacc_demo.y"
891 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
892 msg,
893 (*loc).first_line, (*loc).first_column,
894 (*loc).last_line, (*loc).last_column);
895 /* in this example, we don't know what to do here */ }
896 break;
897#line 898 "btyacc_demo.tab.c"
898 case 271:
899#line 83 "btyacc_demo.y"
900 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
901 msg,
902 (*loc).first_line, (*loc).first_column,
903 (*loc).last_line, (*loc).last_column);
904 /* in this example, we don't know what to do here */ }
905 break;
906#line 907 "btyacc_demo.tab.c"
907 case 272:
908#line 78 "btyacc_demo.y"
909 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
910 msg,
911 (*loc).first_line, (*loc).first_column,
912 (*loc).last_line, (*loc).last_column);
913 free((*val).expr); }
914 break;
915#line 916 "btyacc_demo.tab.c"
916 case 273:
917#line 67 "btyacc_demo.y"
918 { /* 'msg' is a 'char *' indicating the context of destructor invocation*/
919 printf("%s accessed by symbol \"decl\" (case s.b. 273) @ position[%d,%d..%d,%d]\n",
920 msg,
921 (*loc).first_line, (*loc).first_column,
922 (*loc).last_line, (*loc).last_column);
923 free((*val).decl->scope); free((*val).decl->type); }
924 break;
925#line 926 "btyacc_demo.tab.c"
926 case 274:
927#line 83 "btyacc_demo.y"
928 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
929 msg,
930 (*loc).first_line, (*loc).first_column,
931 (*loc).last_line, (*loc).last_column);
932 /* in this example, we don't know what to do here */ }
933 break;
934#line 935 "btyacc_demo.tab.c"
935 case 275:
936#line 83 "btyacc_demo.y"
937 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
938 msg,
939 (*loc).first_line, (*loc).first_column,
940 (*loc).last_line, (*loc).last_column);
941 /* in this example, we don't know what to do here */ }
942 break;
943#line 944 "btyacc_demo.tab.c"
944 case 276:
945#line 78 "btyacc_demo.y"
946 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
947 msg,
948 (*loc).first_line, (*loc).first_column,
949 (*loc).last_line, (*loc).last_column);
950 free((*val).code); }
951 break;
952#line 953 "btyacc_demo.tab.c"
953 case 277:
954#line 78 "btyacc_demo.y"
955 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
956 msg,
957 (*loc).first_line, (*loc).first_column,
958 (*loc).last_line, (*loc).last_column);
959 free((*val).code); }
960 break;
961#line 962 "btyacc_demo.tab.c"
962 case 278:
963#line 78 "btyacc_demo.y"
964 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
965 msg,
966 (*loc).first_line, (*loc).first_column,
967 (*loc).last_line, (*loc).last_column);
968 free((*val).code); }
969 break;
970#line 971 "btyacc_demo.tab.c"
971 case 279:
972#line 73 "btyacc_demo.y"
973 { printf("%s accessed by symbol with type <decl> (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n",
974 msg,
975 (*loc).first_line, (*loc).first_column,
976 (*loc).last_line, (*loc).last_column);
977 free((*val).decl); }
978 break;
979#line 980 "btyacc_demo.tab.c"
980 case 280:
981#line 73 "btyacc_demo.y"
982 { printf("%s accessed by symbol with type <decl> (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n",
983 msg,
984 (*loc).first_line, (*loc).first_column,
985 (*loc).last_line, (*loc).last_column);
986 free((*val).decl); }
987 break;
988#line 989 "btyacc_demo.tab.c"
989 case 281:
990#line 78 "btyacc_demo.y"
991 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
992 msg,
993 (*loc).first_line, (*loc).first_column,
994 (*loc).last_line, (*loc).last_column);
995 free((*val).type); }
996 break;
997#line 998 "btyacc_demo.tab.c"
998 case 282:
999#line 78 "btyacc_demo.y"
1000 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1001 msg,
1002 (*loc).first_line, (*loc).first_column,
1003 (*loc).last_line, (*loc).last_column);
1004 free((*val).type); }
1005 break;
1006#line 1007 "btyacc_demo.tab.c"
1007 case 283:
1008#line 78 "btyacc_demo.y"
1009 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1010 msg,
1011 (*loc).first_line, (*loc).first_column,
1012 (*loc).last_line, (*loc).last_column);
1013 free((*val).type); }
1014 break;
1015#line 1016 "btyacc_demo.tab.c"
1016 case 284:
1017#line 78 "btyacc_demo.y"
1018 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1019 msg,
1020 (*loc).first_line, (*loc).first_column,
1021 (*loc).last_line, (*loc).last_column);
1022 free((*val).type); }
1023 break;
1024#line 1025 "btyacc_demo.tab.c"
1025 case 285:
1026#line 78 "btyacc_demo.y"
1027 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1028 msg,
1029 (*loc).first_line, (*loc).first_column,
1030 (*loc).last_line, (*loc).last_column);
1031 free((*val).type); }
1032 break;
1033#line 1034 "btyacc_demo.tab.c"
1034 case 286:
1035#line 78 "btyacc_demo.y"
1036 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1037 msg,
1038 (*loc).first_line, (*loc).first_column,
1039 (*loc).last_line, (*loc).last_column);
1040 free((*val).scope); }
1041 break;
1042#line 1043 "btyacc_demo.tab.c"
1043 case 287:
1044#line 78 "btyacc_demo.y"
1045 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1046 msg,
1047 (*loc).first_line, (*loc).first_column,
1048 (*loc).last_line, (*loc).last_column);
1049 free((*val).dlist); }
1050 break;
1051#line 1052 "btyacc_demo.tab.c"
1052 case 288:
1053#line 78 "btyacc_demo.y"
1054 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1055 msg,
1056 (*loc).first_line, (*loc).first_column,
1057 (*loc).last_line, (*loc).last_column);
1058 free((*val).dlist); }
1059 break;
1060#line 1061 "btyacc_demo.tab.c"
1061 case 289:
1062#line 78 "btyacc_demo.y"
1063 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1064 msg,
1065 (*loc).first_line, (*loc).first_column,
1066 (*loc).last_line, (*loc).last_column);
1067 free((*val).scope); }
1068 break;
1069#line 1070 "btyacc_demo.tab.c"
1070 case 290:
1071#line 78 "btyacc_demo.y"
1072 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1073 msg,
1074 (*loc).first_line, (*loc).first_column,
1075 (*loc).last_line, (*loc).last_column);
1076 free((*val).scope); }
1077 break;
1078#line 1079 "btyacc_demo.tab.c"
1079 case 291:
1080#line 78 "btyacc_demo.y"
1081 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1082 msg,
1083 (*loc).first_line, (*loc).first_column,
1084 (*loc).last_line, (*loc).last_column);
1085 free((*val).type); }
1086 break;
1087#line 1088 "btyacc_demo.tab.c"
1088 case 292:
1089#line 78 "btyacc_demo.y"
1090 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1091 msg,
1092 (*loc).first_line, (*loc).first_column,
1093 (*loc).last_line, (*loc).last_column);
1094 free((*val).scope); }
1095 break;
1096#line 1097 "btyacc_demo.tab.c"
1097 case 293:
1098#line 78 "btyacc_demo.y"
1099 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1100 msg,
1101 (*loc).first_line, (*loc).first_column,
1102 (*loc).last_line, (*loc).last_column);
1103 free((*val).scope); }
1104 break;
1105#line 1106 "btyacc_demo.tab.c"
1106 case 294:
1107#line 78 "btyacc_demo.y"
1108 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1109 msg,
1110 (*loc).first_line, (*loc).first_column,
1111 (*loc).last_line, (*loc).last_column);
1112 free((*val).type); }
1113 break;
1114#line 1115 "btyacc_demo.tab.c"
1115 case 295:
1116#line 78 "btyacc_demo.y"
1117 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1118 msg,
1119 (*loc).first_line, (*loc).first_column,
1120 (*loc).last_line, (*loc).last_column);
1121 free((*val).scope); }
1122 break;
1123#line 1124 "btyacc_demo.tab.c"
1124 case 296:
1125#line 78 "btyacc_demo.y"
1126 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1127 msg,
1128 (*loc).first_line, (*loc).first_column,
1129 (*loc).last_line, (*loc).last_column);
1130 free((*val).type); }
1131 break;
1132#line 1133 "btyacc_demo.tab.c"
1133 case 297:
1134#line 78 "btyacc_demo.y"
1135 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1136 msg,
1137 (*loc).first_line, (*loc).first_column,
1138 (*loc).last_line, (*loc).last_column);
1139 free((*val).scope); }
1140 break;
1141#line 1142 "btyacc_demo.tab.c"
1142 case 298:
1143#line 78 "btyacc_demo.y"
1144 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1145 msg,
1146 (*loc).first_line, (*loc).first_column,
1147 (*loc).last_line, (*loc).last_column);
1148 free((*val).scope); }
1149 break;
1150#line 1151 "btyacc_demo.tab.c"
1151 case 299:
1152#line 78 "btyacc_demo.y"
1153 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1154 msg,
1155 (*loc).first_line, (*loc).first_column,
1156 (*loc).last_line, (*loc).last_column);
1157 free((*val).scope); }
1158 break;
1159#line 1160 "btyacc_demo.tab.c"
1160 case 300:
1161#line 78 "btyacc_demo.y"
1162 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1163 msg,
1164 (*loc).first_line, (*loc).first_column,
1165 (*loc).last_line, (*loc).last_column);
1166 free((*val).scope); }
1167 break;
1168#line 1169 "btyacc_demo.tab.c"
1169 }
1170}
1171#define YYDESTRUCT_IS_DECLARED 1
1172#endif
1173
1174/* For use in generated program */
1175#define yydepth (int)(yystack.s_mark - yystack.s_base)
1176#if YYBTYACC
1177#define yytrial (yyps->save)
1178#endif /* YYBTYACC */
1179
1180#if YYDEBUG
1181#include <stdio.h> /* needed for printf */
1182#endif
1183
1184#include <stdlib.h> /* needed for malloc, etc */
1185#include <string.h> /* needed for memset */
1186
1187/* allocate initial stack or double stack size, up to YYMAXDEPTH */
1188static int yygrowstack(YYSTACKDATA *data)
1189{
1190 int i;
1191 unsigned newsize;
1192 short *newss;
1193 YYSTYPE *newvs;
--- 167 unchanged lines hidden (view full) ---
1361 yychar = *yylexp++;
1362 break;
1363 }
1364 if (yyps->save)
1365 {
1366 /* in trial mode; save scanner results for future parse attempts */
1367 if (yylvp == yylvlim)
1368 { /* Enlarge lexical value queue */
1369 int p = yylvp - yylvals;
1370 int s = yylvlim - yylvals;
1371
1372 s += YYLVQUEUEGROWTH;
1373 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
1374 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
1375#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1376 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
1377#endif
1378 yylvp = yylve = yylvals + p;
--- 79 unchanged lines hidden (view full) ---
1458 }
1459#endif
1460 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1461 if (save == NULL) goto yyenomem;
1462 save->save = yyps->save;
1463 save->state = yystate;
1464 save->errflag = yyerrflag;
1465 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
1466 memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1467 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
1468 memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1469#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1470 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
1471 memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1472#endif
1473 ctry = yytable[yyn];
1474 if (yyctable[ctry] == -1)
1475 {
1476#if YYDEBUG
1477 if (yydebug && yychar >= YYEOF)
1478 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
1479#endif
--- 38 unchanged lines hidden (view full) ---
1518 {
1519 yylvp--;
1520#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1521 yylpp--;
1522#endif
1523 yylexp--;
1524 yychar = YYEMPTY;
1525 }
1526 save->lexeme = yylvp - yylvals;
1527 yyps->save = save;
1528 }
1529 if (yytable[yyn] == ctry)
1530 {
1531#if YYDEBUG
1532 if (yydebug)
1533 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1534 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
--- 77 unchanged lines hidden (view full) ---
1612 if (yyerrctx) yyFreeState(yyerrctx);
1613 /* Create and fill out new saved error context state */
1614 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1615 if (yyerrctx == NULL) goto yyenomem;
1616 yyerrctx->save = yyps->save;
1617 yyerrctx->state = yystate;
1618 yyerrctx->errflag = yyerrflag;
1619 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
1620 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1621 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
1622 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1623#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1624 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
1625 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1626#endif
1627 yyerrctx->lexeme = yylvp - yylvals;
1628 }
1629 yylvp = yylvals + save->lexeme;
1630#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1631 yylpp = yylpsns + save->lexeme;
1632#endif
1633 yylexp = yylexemes + save->lexeme;
1634 yychar = YYEMPTY;
1635 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
1636 memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1637 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
1638 memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1639#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1640 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
1641 memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1642#endif
1643 ctry = ++save->ctry;
1644 yystate = save->state;
1645 /* We tried shift, try reduce now */
1646 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
1647 yyps->save = save->save;
1648 save->save = NULL;
1649 yyFreeState(save);
--- 13 unchanged lines hidden (view full) ---
1663#endif
1664 yylexp = yylexemes + yyerrctx->lexeme;
1665 yychar = yylexp[-1];
1666 yylval = yylvp[-1];
1667#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1668 yylloc = yylpp[-1];
1669#endif
1670 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1671 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1672 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1673 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1674#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1675 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1676 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1677#endif
1678 yystate = yyerrctx->state;
1679 yyFreeState(yyerrctx);
1680 yyerrctx = NULL;
1681 }
1682 yynewerrflag = 1;
1683 }
1684 if (yynewerrflag == 0) goto yyinrecovery;
--- 403 unchanged lines hidden (view full) ---
2088#line 193 "btyacc_demo.y"
2089 { yyval.code = code_append(yystack.l_mark[-2].code, yystack.l_mark[0].code); }
2090break;
2091case 61:
2092 if (!yytrial)
2093#line 197 "btyacc_demo.y"
2094 { yyval.code = yystack.l_mark[-1].code; }
2095break;
2096#line 2097 "btyacc_demo.tab.c"
2097 default:
2098 break;
2099 }
2100 yystack.s_mark -= yym;
2101 yystate = *yystack.s_mark;
2102 yystack.l_mark -= yym;
2103#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2104 yystack.p_mark -= yym;
--- 34 unchanged lines hidden (view full) ---
2139 yychar = *yylexp++;
2140 break;
2141 }
2142 if (yyps->save)
2143 {
2144 /* in trial mode; save scanner results for future parse attempts */
2145 if (yylvp == yylvlim)
2146 { /* Enlarge lexical value queue */
2147 int p = yylvp - yylvals;
2148 int s = yylvlim - yylvals;
2149
2150 s += YYLVQUEUEGROWTH;
2151 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
2152 goto yyenomem;
2153 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
2154 goto yyenomem;
2155#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2156 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
--- 86 unchanged lines hidden (view full) ---
2243 }
2244 yylvp = yylvals + yypath->lexeme;
2245#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2246 yylpp = yylpsns + yypath->lexeme;
2247#endif
2248 yylexp = yylexemes + yypath->lexeme;
2249 yychar = YYEMPTY;
2250 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
2251 memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
2252 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
2253 memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
2254#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2255 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
2256 memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
2257#endif
2258 yystate = yypath->state;
2259 goto yyloop;
2260#endif /* YYBTYACC */
2261
2262yyoverflow:
2263 YYERROR_CALL("yacc stack overflow");
2264#if YYBTYACC
--- 67 unchanged lines hidden ---