Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 1 21-DEC-1991 00:17:12 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LALR.C;1 1 /* Compute look-ahead criteria for bison, 2 Copyright (C) 1984, 1986, 1989 Free Software Foundation, Inc. 3 4 This file is part of Bison, the GNU Compiler Compiler. 5 6 Bison is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 Bison is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with Bison; see the file COPYING. If not, write to 18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 19 20 21 /* Compute how to make the finite state machine deterministic; 22 find which rules need lookahead in each state, and which lookahead tokens they accept. 23 24 lalr(), the entry point, builds these data structures: 25 26 goto_map, from_state and to_state 27 record each shift transition which accepts a variable (a nonterminal). 28 ngotos is the number of such transitions. 29 from_state[t] is the state number which a transition leads from 30 and to_state[t] is the state number it leads to. 31 All the transitions that accept a particular variable are grouped together and 32 goto_map[i - ntokens] is the index in from_state and to_state of the first of them. 33 34 consistent[s] is nonzero if no lookahead is needed to decide what to do in state s. 35 36 LAruleno is a vector which records the rules that need lookahead in various states. 37 The elements of LAruleno that apply to state s are those from 38 lookaheads[s] through lookaheads[s+1]-1. 39 Each element of LAruleno is a rule number. 40 41 If lr is the length of LAruleno, then a number from 0 to lr-1 42 can specify both a rule and a state where the rule might be applied. 43 44 LA is a lr by ntokens matrix of bits. 45 LA[l, i] is 1 if the rule LAruleno[l] is applicable in the appropriate state 46 when the next token is symbol i. 47 If LA[l, i] and LA[l, j] are both 1 for i != j, it is a conflict. 48 */ 49 50 #include 1649 #include "system.h" 4201 #include "machine.h" 4241 #include "types.h" 4269 #include "state.h" 4407 #include "new.h" 4439 #include "gram.h" 4560 Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 2 21-DEC-1991 00:17:12 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LALR.C;1 4561 4562 extern short **derives; 4563 extern char *nullable; 4564 4565 4566 int tokensetsize; 4567 short *lookaheads; 4568 short *LAruleno; 4569 unsigned *LA; 4570 short *accessing_symbol; 4571 char *consistent; 4572 core **state_table; 4573 shifts **shift_table; 4574 reductions **reduction_table; 4575 short *goto_map; 4576 short *from_state; 4577 short *to_state; 4578 4579 short **transpose(); 4580 void set_state_table(); 4581 void set_accessing_symbol(); 4582 void set_shift_table(); 4583 void set_reduction_table(); 4584 void set_maxrhs(); 4585 void initialize_LA(); 4586 void set_goto_map(); 4587 void initialize_F(); 4588 void build_relations(); 4589 void add_lookback_edge(); 4590 void compute_FOLLOWS(); 4591 void compute_lookaheads(); 4592 void digraph(); 4593 void traverse(); 4594 4595 extern void toomany(); 4596 extern void berror(); 4597 4598 static int infinity; 4599 static int maxrhs; 4600 static int ngotos; 4601 static unsigned *F; 4602 static short **includes; 4603 static shorts **lookback; 4604 static short **R; 4605 static short *INDEX; 4606 static short *VERTICES; 4607 static int top; 4608 4609 4610 void 4611 lalr() 1 4612 { 1 4613 tokensetsize = WORDSIZE(ntokens); 1 4614 1 4615 set_state_table(); 1 4616 set_accessing_symbol(); 1 4617 set_shift_table(); Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 3 21-DEC-1991 00:17:12 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LALR.C;1 1 4618 set_reduction_table(); 1 4619 set_maxrhs(); 1 4620 initialize_LA(); 1 4621 set_goto_map(); 1 4622 initialize_F(); 1 4623 build_relations(); 1 4624 compute_FOLLOWS(); 1 4625 compute_lookaheads(); 1 4626 } 4627 4628 4629 void 4630 set_state_table() 1 4631 { 1 4632 register core *sp; 1 4633 1 4634 state_table = NEW2(nstates, core *); 1 4635 1 4636 for (sp = first_state; sp; sp = sp->next) 1 4637 state_table[sp->number] = sp; 1 4638 } 4639 4640 4641 void 4642 set_accessing_symbol() 1 4643 { 1 4644 register core *sp; 1 4645 1 4646 accessing_symbol = NEW2(nstates, short); 1 4647 1 4648 for (sp = first_state; sp; sp = sp->next) 1 4649 accessing_symbol[sp->number] = sp->accessing_symbol; 1 4650 } 4651 4652 4653 void 4654 set_shift_table() 1 4655 { 1 4656 register shifts *sp; 1 4657 1 4658 shift_table = NEW2(nstates, shifts *); 1 4659 1 4660 for (sp = first_shift; sp; sp = sp->next) 1 4661 shift_table[sp->number] = sp; 1 4662 } 4663 4664 4665 void 4666 set_reduction_table() 1 4667 { 1 4668 register reductions *rp; 1 4669 1 4670 reduction_table = NEW2(nstates, reductions *); 1 4671 1 4672 for (rp = first_reduction; rp; rp = rp->next) 1 4673 reduction_table[rp->number] = rp; 1 4674 } Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 4 21-DEC-1991 00:17:12 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LALR.C;1 4675 4676 4677 void 4678 set_maxrhs() 1 4679 { 1 4680 register short *itemp; 1 4681 register int length; 1 4682 register int max; 1 4683 1 4684 length = 0; 1 4685 max = 0; 1 4686 for (itemp = ritem; *itemp; itemp++) 2 4687 { 2 4688 if (*itemp > 0) 3 4689 { 3 4690 length++; 2 4691 } 2 4692 else 3 4693 { 3 4694 if (length > max) max = length; 3 4695 length = 0; 2 4696 } 1 4697 } 1 4698 1 4699 maxrhs = max; 1 4700 } 4701 4702 4703 void 4704 initialize_LA() 1 4705 { 1 4706 register int i; 1 4707 register int j; 1 4708 register int count; 1 4709 register reductions *rp; 1 4710 register shifts *sp; 1 4711 register short *np; 1 4712 1 4713 consistent = NEW2(nstates, char); 1 4714 lookaheads = NEW2(nstates + 1, short); 1 4715 1 4716 count = 0; 1 4717 for (i = 0; i < nstates; i++) 2 4718 { 2 4719 register int k; 2 4720 2 4721 lookaheads[i] = count; 2 4722 2 4723 rp = reduction_table[i]; 2 4724 sp = shift_table[i]; 2 4725 if (rp && (rp->nreds > 1 2 4726 || (sp && ! ISVAR(accessing_symbol[sp->shifts[0]])))) 2 4727 count += rp->nreds; 2 4728 else 2 4729 consistent[i] = 1; 2 4730 2 4731 if (sp) Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 5 21-DEC-1991 00:17:12 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LALR.C;1 2 4732 for (k = 0; k < sp->nshifts; k++) 3 4733 { 3 4734 if (accessing_symbol[sp->shifts[k]] == error_token_number) 4 4735 { 4 4736 consistent[i] = 0; 4 4737 break; 3 4738 } 2 4739 } 1 4740 } 1 4741 1 4742 lookaheads[nstates] = count; 1 4743 1 4744 if (count == 0) 2 4745 { 2 4746 LA = NEW2(1 * tokensetsize, unsigned); 2 4747 LAruleno = NEW2(1, short); 2 4748 lookback = NEW2(1, shorts *); 1 4749 } 1 4750 else 2 4751 { 2 4752 LA = NEW2(count * tokensetsize, unsigned); 2 4753 LAruleno = NEW2(count, short); 2 4754 lookback = NEW2(count, shorts *); 1 4755 } 1 4756 1 4757 np = LAruleno; 1 4758 for (i = 0; i < nstates; i++) 2 4759 { 2 4760 if (!consistent[i]) 3 4761 { 3 4762 if (rp = reduction_table[i]) 3 4763 for (j = 0; j < rp->nreds; j++) 3 4764 *np++ = rp->rules[j]; 2 4765 } 1 4766 } 1 4767 } 4768 4769 4770 void 4771 set_goto_map() 1 4772 { 1 4773 register shifts *sp; 1 4774 register int i; 1 4775 register int symbol; 1 4776 register int k; 1 4777 register short *temp_map; 1 4778 register int state2; 1 4779 register int state1; 1 4780 1 4781 goto_map = NEW2(nvars + 1, short) - ntokens; 1 4782 temp_map = NEW2(nvars + 1, short) - ntokens; 1 4783 1 4784 ngotos = 0; 1 4785 for (sp = first_shift; sp; sp = sp->next) 2 4786 { 2 4787 for (i = sp->nshifts - 1; i >= 0; i--) 3 4788 { Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 6 21-DEC-1991 00:17:12 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LALR.C;1 3 4789 symbol = accessing_symbol[sp->shifts[i]]; 3 4790 3 4791 if (ISTOKEN(symbol)) break; 3 4792 3 4793 if (ngotos == MAXSHORT) 3 4794 toomany("gotos"); 3 4795 3 4796 ngotos++; 3 4797 goto_map[symbol]++; 2 4798 } 1 4799 } 1 4800 1 4801 k = 0; 1 4802 for (i = ntokens; i < nsyms; i++) 2 4803 { 2 4804 temp_map[i] = k; 2 4805 k += goto_map[i]; 1 4806 } 1 4807 1 4808 for (i = ntokens; i < nsyms; i++) 1 4809 goto_map[i] = temp_map[i]; 1 4810 1 4811 goto_map[nsyms] = ngotos; 1 4812 temp_map[nsyms] = ngotos; 1 4813 1 4814 from_state = NEW2(ngotos, short); 1 4815 to_state = NEW2(ngotos, short); 1 4816 1 4817 for (sp = first_shift; sp; sp = sp->next) 2 4818 { 2 4819 state1 = sp->number; 2 4820 for (i = sp->nshifts - 1; i >= 0; i--) 3 4821 { 3 4822 state2 = sp->shifts[i]; 3 4823 symbol = accessing_symbol[state2]; 3 4824 3 4825 if (ISTOKEN(symbol)) break; 3 4826 3 4827 k = temp_map[symbol]++; 3 4828 from_state[k] = state1; 3 4829 to_state[k] = state2; 2 4830 } 1 4831 } 1 4832 1 4833 FREE(temp_map + ntokens); 1 4834 } 4835 4836 4837 4838 /* Map_goto maps a state/symbol pair into its numeric representation. */ 4839 4840 int 4841 map_goto(state, symbol) 4842 int state; 4843 int symbol; 1 4844 { 1 4845 register int high; Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 7 21-DEC-1991 00:17:12 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LALR.C;1 1 4846 register int low; 1 4847 register int middle; 1 4848 register int s; 1 4849 1 4850 low = goto_map[symbol]; 1 4851 high = goto_map[symbol + 1] - 1; 1 4852 1 4853 while (low <= high) 2 4854 { 2 4855 middle = (low + high) / 2; 2 4856 s = from_state[middle]; 2 4857 if (s == state) 2 4858 return (middle); 2 4859 else if (s < state) 2 4860 low = middle + 1; 2 4861 else 2 4862 high = middle - 1; 1 4863 } 1 4864 1 4865 berror("map_goto"); 1 4866 /* NOTREACHED */ 1 4867 return 0; 1 4868 } 4869 4870 4871 void 4872 initialize_F() 1 4873 { 1 4874 register int i; 1 4875 register int j; 1 4876 register int k; 1 4877 register shifts *sp; 1 4878 register short *edge; 1 4879 register unsigned *rowp; 1 4880 register short *rp; 1 4881 register short **reads; 1 4882 register int nedges; 1 4883 register int stateno; 1 4884 register int symbol; 1 4885 register int nwords; 1 4886 1 4887 nwords = ngotos * tokensetsize; 1 4888 F = NEW2(nwords, unsigned); 1 4889 1 4890 reads = NEW2(ngotos, short *); 1 4891 edge = NEW2(ngotos + 1, short); 1 4892 nedges = 0; 1 4893 1 4894 rowp = F; 1 4895 for (i = 0; i < ngotos; i++) 2 4896 { 2 4897 stateno = to_state[i]; 2 4898 sp = shift_table[stateno]; 2 4899 2 4900 if (sp) 3 4901 { 3 4902 k = sp->nshifts; Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 8 21-DEC-1991 00:17:12 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LALR.C;1 3 4903 3 4904 for (j = 0; j < k; j++) 4 4905 { 4 4906 symbol = accessing_symbol[sp->shifts[j]]; 4 4907 if (ISVAR(symbol)) 4 4908 break; 4 4909 SETBIT(rowp, symbol); 3 4910 } 3 4911 3 4912 for (; j < k; j++) 4 4913 { 4 4914 symbol = accessing_symbol[sp->shifts[j]]; 4 4915 if (nullable[symbol]) 4 4916 edge[nedges++] = map_goto(stateno, symbol); 3 4917 } 3 4918 3 4919 if (nedges) 4 4920 { 4 4921 reads[i] = rp = NEW2(nedges + 1, short); 4 4922 4 4923 for (j = 0; j < nedges; j++) 4 4924 rp[j] = edge[j]; 4 4925 4 4926 rp[nedges] = -1; 4 4927 nedges = 0; 3 4928 } 2 4929 } 2 4930 2 4931 rowp += tokensetsize; 1 4932 } 1 4933 1 4934 digraph(reads); 1 4935 1 4936 for (i = 0; i < ngotos; i++) 2 4937 { 2 4938 if (reads[i]) 2 4939 FREE(reads[i]); 1 4940 } 1 4941 1 4942 FREE(reads); 1 4943 FREE(edge); 1 4944 } 4945 4946 4947 void 4948 build_relations() 1 4949 { 1 4950 register int i; 1 4951 register int j; 1 4952 register int k; 1 4953 register short *rulep; 1 4954 register short *rp; 1 4955 register shifts *sp; 1 4956 register int length; 1 4957 register int nedges; 1 4958 register int done; 1 4959 register int state1; Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 9 21-DEC-1991 00:17:12 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LALR.C;1 1 4960 register int stateno; 1 4961 register int symbol1; 1 4962 register int symbol2; 1 4963 register short *shortp; 1 4964 register short *edge; 1 4965 register short *states; 1 4966 register short **new_includes; 1 4967 1 4968 includes = NEW2(ngotos, short *); 1 4969 edge = NEW2(ngotos + 1, short); 1 4970 states = NEW2(maxrhs + 1, short); 1 4971 1 4972 for (i = 0; i < ngotos; i++) 2 4973 { 2 4974 nedges = 0; 2 4975 state1 = from_state[i]; 2 4976 symbol1 = accessing_symbol[to_state[i]]; 2 4977 2 4978 for (rulep = derives[symbol1]; *rulep > 0; rulep++) 3 4979 { 3 4980 length = 1; 3 4981 states[0] = state1; 3 4982 stateno = state1; 3 4983 3 4984 for (rp = ritem + rrhs[*rulep]; *rp > 0; rp++) 4 4985 { 4 4986 symbol2 = *rp; 4 4987 sp = shift_table[stateno]; 4 4988 k = sp->nshifts; 4 4989 4 4990 for (j = 0; j < k; j++) 5 4991 { 5 4992 stateno = sp->shifts[j]; 5 4993 if (accessing_symbol[stateno] == symbol2) break; 4 4994 } 4 4995 4 4996 states[length++] = stateno; 3 4997 } 3 4998 3 4999 if (!consistent[stateno]) 3 5000 add_lookback_edge(stateno, *rulep, i); 3 5001 3 5002 length--; 3 5003 done = 0; 3 5004 while (!done) 4 5005 { 4 5006 done = 1; 4 5007 rp--; 4 5008 /* JF added rp>=ritem && I hope to god its right! */ 4 5009 if (rp>=ritem && ISVAR(*rp)) 5 5010 { 5 5011 stateno = states[--length]; 5 5012 edge[nedges++] = map_goto(stateno, *rp); 5 5013 if (nullable[*rp]) done = 0; 4 5014 } 3 5015 } 2 5016 } Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 10 21-DEC-1991 00:17:12 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LALR.C;1 2 5017 2 5018 if (nedges) 3 5019 { 3 5020 includes[i] = shortp = NEW2(nedges + 1, short); 3 5021 for (j = 0; j < nedges; j++) 3 5022 shortp[j] = edge[j]; 3 5023 shortp[nedges] = -1; 2 5024 } 1 5025 } 1 5026 1 5027 new_includes = transpose(includes, ngotos); 1 5028 1 5029 for (i = 0; i < ngotos; i++) 1 5030 if (includes[i]) 1 5031 FREE(includes[i]); 1 5032 1 5033 FREE(includes); 1 5034 1 5035 includes = new_includes; 1 5036 1 5037 FREE(edge); 1 5038 FREE(states); 1 5039 } 5040 5041 5042 void 5043 add_lookback_edge(stateno, ruleno, gotono) 5044 int stateno; 5045 int ruleno; 5046 int gotono; 1 5047 { 1 5048 register int i; 1 5049 register int k; 1 5050 register int found; 1 5051 register shorts *sp; 1 5052 1 5053 i = lookaheads[stateno]; 1 5054 k = lookaheads[stateno + 1]; 1 5055 found = 0; 1 5056 while (!found && i < k) 2 5057 { 2 5058 if (LAruleno[i] == ruleno) 2 5059 found = 1; 2 5060 else 2 5061 i++; 1 5062 } 1 5063 1 5064 if (found == 0) 1 5065 berror("add_lookback_edge"); 1 5066 1 5067 sp = NEW(shorts); 1 5068 sp->next = lookback[i]; 1 5069 sp->value = gotono; 1 5070 lookback[i] = sp; 1 5071 } 5072 5073 Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 11 21-DEC-1991 00:17:12 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LALR.C;1 5074 5075 short ** 5076 transpose(R_arg, n) 5077 short **R_arg; 5078 int n; 1 5079 { 1 5080 register short **new_R; 1 5081 register short **temp_R; 1 5082 register short *nedges; 1 5083 register short *sp; 1 5084 register int i; 1 5085 register int k; 1 5086 1 5087 nedges = NEW2(n, short); 1 5088 1 5089 for (i = 0; i < n; i++) 2 5090 { 2 5091 sp = R_arg[i]; 2 5092 if (sp) 3 5093 { 3 5094 while (*sp >= 0) 3 5095 nedges[*sp++]++; 2 5096 } 1 5097 } 1 5098 1 5099 new_R = NEW2(n, short *); 1 5100 temp_R = NEW2(n, short *); 1 5101 1 5102 for (i = 0; i < n; i++) 2 5103 { 2 5104 k = nedges[i]; 2 5105 if (k > 0) 3 5106 { 3 5107 sp = NEW2(k + 1, short); 3 5108 new_R[i] = sp; 3 5109 temp_R[i] = sp; 3 5110 sp[k] = -1; 2 5111 } 1 5112 } 1 5113 1 5114 FREE(nedges); 1 5115 1 5116 for (i = 0; i < n; i++) 2 5117 { 2 5118 sp = R_arg[i]; 2 5119 if (sp) 3 5120 { 3 5121 while (*sp >= 0) 3 5122 *temp_R[*sp++]++ = i; 2 5123 } 1 5124 } 1 5125 1 5126 FREE(temp_R); 1 5127 1 5128 return (new_R); 1 5129 } 5130 Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 12 21-DEC-1991 00:17:12 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LALR.C;1 5131 5132 void 5133 compute_FOLLOWS() 1 5134 { 1 5135 register int i; 1 5136 1 5137 digraph(includes); 1 5138 1 5139 for (i = 0; i < ngotos; i++) 2 5140 { 2 5141 if (includes[i]) FREE(includes[i]); 1 5142 } 1 5143 1 5144 FREE(includes); 1 5145 } 5146 5147 5148 void 5149 compute_lookaheads() 1 5150 { 1 5151 register int i; 1 5152 register int n; 1 5153 register unsigned *fp1; 1 5154 register unsigned *fp2; 1 5155 register unsigned *fp3; 1 5156 register shorts *sp; 1 5157 register unsigned *rowp; 1 5158 /* register short *rulep; JF unused */ 1 5159 /* register int count; JF unused */ 1 5160 register shorts *sptmp;/* JF */ 1 5161 1 5162 rowp = LA; 1 5163 n = lookaheads[nstates]; 1 5164 for (i = 0; i < n; i++) 2 5165 { 2 5166 fp3 = rowp + tokensetsize; 2 5167 for (sp = lookback[i]; sp; sp = sp->next) 3 5168 { 3 5169 fp1 = rowp; 3 5170 fp2 = F + tokensetsize * sp->value; 3 5171 while (fp1 < fp3) 3 5172 *fp1++ |= *fp2++; 2 5173 } 2 5174 2 5175 rowp = fp3; 1 5176 } 1 5177 1 5178 for (i = 0; i < n; i++) 2 5179 {/* JF removed ref to freed storage */ 3 5180 for (sp = lookback[i]; sp; sp = sptmp) { 3 5181 sptmp=sp->next; 3 5182 FREE(sp); 2 5183 } 1 5184 } 1 5185 1 5186 FREE(lookback); 1 5187 FREE(F); Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 13 21-DEC-1991 00:17:12 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LALR.C;1 1 5188 } 5189 5190 5191 void 5192 digraph(relation) 5193 short **relation; 1 5194 { 1 5195 register int i; 1 5196 1 5197 infinity = ngotos + 2; 1 5198 INDEX = NEW2(ngotos + 1, short); 1 5199 VERTICES = NEW2(ngotos + 1, short); 1 5200 top = 0; 1 5201 1 5202 R = relation; 1 5203 1 5204 for (i = 0; i < ngotos; i++) 1 5205 INDEX[i] = 0; 1 5206 1 5207 for (i = 0; i < ngotos; i++) 2 5208 { 2 5209 if (INDEX[i] == 0 && R[i]) 2 5210 traverse(i); 1 5211 } 1 5212 1 5213 FREE(INDEX); 1 5214 FREE(VERTICES); 1 5215 } 5216 5217 5218 void 5219 traverse(i) 5220 register int i; 1 5221 { 1 5222 register unsigned *fp1; 1 5223 register unsigned *fp2; 1 5224 register unsigned *fp3; 1 5225 register int j; 1 5226 register short *rp; 1 5227 1 5228 int height; 1 5229 unsigned *base; 1 5230 1 5231 VERTICES[++top] = i; 1 5232 INDEX[i] = height = top; 1 5233 1 5234 base = F + i * tokensetsize; 1 5235 fp3 = base + tokensetsize; 1 5236 1 5237 rp = R[i]; 1 5238 if (rp) 2 5239 { 2 5240 while ((j = *rp++) >= 0) 3 5241 { 3 5242 if (INDEX[j] == 0) 3 5243 traverse(j); 3 5244 Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 14 21-DEC-1991 00:17:12 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LALR.C;1 3 5245 if (INDEX[i] > INDEX[j]) 3 5246 INDEX[i] = INDEX[j]; 3 5247 3 5248 fp1 = base; 3 5249 fp2 = F + j * tokensetsize; 3 5250 3 5251 while (fp1 < fp3) 3 5252 *fp1++ |= *fp2++; 2 5253 } 1 5254 } 1 5255 1 5256 if (INDEX[i] == height) 2 5257 { 2 5258 for (;;) 3 5259 { 3 5260 j = VERTICES[top--]; 3 5261 INDEX[j] = infinity; 3 5262 3 5263 if (i == j) 3 5264 break; 3 5265 3 5266 fp1 = base; 3 5267 fp2 = F + j * tokensetsize; 3 5268 3 5269 while (fp1 < fp3) 3 5270 *fp2++ = *fp1++; 2 5271 } 1 5272 } 1 5273 } Command Line ------- ---- CC/INCLU=[]/LIS LALR.C Hardware: /ARCHITECTURE=GENERIC /OPTIMIZE=TUNE=GENERIC These macros are in effect at the start of the compilation. ----- ------ --- -- ------ -- --- ----- -- --- ------------ __G_FLOAT=1 __DECC=1 vms=1 VMS=1 __32BITS=1 __PRAGMA_ENVIRONMENT=1 __CRTL_VER=80300000 __vms_version="V8.3 " CC$gfloat=1 __X_FLOAT=1 vms_version="V8.3 " __DATE__="Mar 31 2009" __STDC_VERSION__=199901L __DECC_MODE_RELAXED=1 __DECC_VER=70390009 __VMS=1 __ALPHA=1 VMS_VERSION="V8.3 " __IEEE_FLOAT=0 __VMS_VERSION="V8.3 " __TIME__="13:04:13" __Alpha_AXP=1 __VMS_VER=80300022 __BIASED_FLT_ROUNDS=2 __INITIAL_POINTER_SIZE=0 __STDC__=2 __LANGUAGE_C__=1 __vms=1 __alpha=1 __D_FLOAT=0