Source Listing 31-MAR-2009 13:04:10 HP C V7.3-009-48GBT Page 1 20-APR-1993 05:41:26 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LR0.C;1 1 /* Generate the nondeterministic finite state machine 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 /* See comments in state.h for the data structures that represent it. 22 The entry point is generate_states. */ 23 24 #include 1623 #include "system.h" 4175 #include "machine.h" 4215 #include "new.h" 4247 #include "gram.h" 4368 #include "state.h" 4506 4507 4508 extern char *nullable; 4509 extern short *itemset; 4510 extern short *itemsetend; 4511 4512 4513 int nstates; 4514 int final_state; 4515 core *first_state; 4516 shifts *first_shift; 4517 reductions *first_reduction; 4518 4519 int get_state(); 4520 core *new_state(); 4521 4522 void new_itemsets(); 4523 void append_states(); 4524 void initialize_states(); 4525 void save_shifts(); 4526 void save_reductions(); 4527 void augment_automaton(); 4528 void insert_start_shift(); 4529 extern void initialize_closure(); 4530 extern void closure(); 4531 extern void finalize_closure(); 4532 extern void toomany(); 4533 Source Listing 31-MAR-2009 13:04:10 HP C V7.3-009-48GBT Page 2 20-APR-1993 05:41:26 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LR0.C;1 4534 static core *this_state; 4535 static core *last_state; 4536 static shifts *last_shift; 4537 static reductions *last_reduction; 4538 4539 static int nshifts; 4540 static short *shift_symbol; 4541 4542 static short *redset; 4543 static short *shiftset; 4544 4545 static short **kernel_base; 4546 static short **kernel_end; 4547 static short *kernel_items; 4548 4549 /* hash table for states, to recognize equivalent ones. */ 4550 4551 #define STATE_TABLE_SIZE 1009 4552 static core **state_table; 4553 4554 4555 4556 void 4557 allocate_itemsets() 1 4558 { 1 4559 register short *itemp; 1 4560 register int symbol; 1 4561 register int i; 1 4562 register int count; 1 4563 register short *symbol_count; 1 4564 1 4565 count = 0; 1 4566 symbol_count = NEW2(nsyms, short); 1 4567 1 4568 itemp = ritem; 1 4569 symbol = *itemp++; 1 4570 while (symbol) 2 4571 { 2 4572 if (symbol > 0) 3 4573 { 3 4574 count++; 3 4575 symbol_count[symbol]++; 2 4576 } 2 4577 symbol = *itemp++; 1 4578 } 1 4579 1 4580 /* see comments before new_itemsets. All the vectors of items 1 4581 live inside kernel_items. The number of active items after 1 4582 some symbol cannot be more than the number of times that symbol 1 4583 appears as an item, which is symbol_count[symbol]. 1 4584 We allocate that much space for each symbol. */ 1 4585 1 4586 kernel_base = NEW2(nsyms, short *); 1 4587 kernel_items = NEW2(count, short); 1 4588 1 4589 count = 0; 1 4590 for (i = 0; i < nsyms; i++) Source Listing 31-MAR-2009 13:04:10 HP C V7.3-009-48GBT Page 3 20-APR-1993 05:41:26 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LR0.C;1 2 4591 { 2 4592 kernel_base[i] = kernel_items + count; 2 4593 count += symbol_count[i]; 1 4594 } 1 4595 1 4596 shift_symbol = symbol_count; 1 4597 kernel_end = NEW2(nsyms, short *); 1 4598 } 4599 4600 4601 void 4602 allocate_storage() 1 4603 { 1 4604 allocate_itemsets(); 1 4605 1 4606 shiftset = NEW2(nsyms, short); 1 4607 redset = NEW2(nrules + 1, short); 1 4608 state_table = NEW2(STATE_TABLE_SIZE, core *); 1 4609 } 4610 4611 4612 void 4613 free_storage() 1 4614 { 1 4615 FREE(shift_symbol); 1 4616 FREE(redset); 1 4617 FREE(shiftset); 1 4618 FREE(kernel_base); 1 4619 FREE(kernel_end); 1 4620 FREE(kernel_items); 1 4621 FREE(state_table); 1 4622 } 4623 4624 4625 4626 /* compute the nondeterministic finite state machine (see state.h for details) 4627 from the grammar. */ 4628 void 4629 generate_states() 1 4630 { 1 4631 allocate_storage(); 1 4632 initialize_closure(nitems); 1 4633 initialize_states(); 1 4634 1 4635 while (this_state) 2 4636 { 2 4637 /* Set up ruleset and itemset for the transitions out of this state. 2 4638 ruleset gets a 1 bit for each rule that could reduce now. 2 4639 itemset gets a vector of all the items that could be accepted next. */ 2 4640 closure(this_state->items, this_state->nitems); 2 4641 /* record the reductions allowed out of this state */ 2 4642 save_reductions(); 2 4643 /* find the itemsets of the states that shifts can reach */ 2 4644 new_itemsets(); 2 4645 /* find or create the core structures for those states */ 2 4646 append_states(); 2 4647 Source Listing 31-MAR-2009 13:04:10 HP C V7.3-009-48GBT Page 4 20-APR-1993 05:41:26 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LR0.C;1 2 4648 /* create the shifts structures for the shifts to those states, 2 4649 now that the state numbers transitioning to are known */ 2 4650 if (nshifts > 0) 2 4651 save_shifts(); 2 4652 2 4653 /* states are queued when they are created; process them all */ 2 4654 this_state = this_state->next; 1 4655 } 1 4656 1 4657 /* discard various storage */ 1 4658 finalize_closure(); 1 4659 free_storage(); 1 4660 1 4661 /* set up initial and final states as parser wants them */ 1 4662 augment_automaton(); 1 4663 } 4664 4665 4666 4667 /* Find which symbols can be shifted in the current state, 4668 and for each one record which items would be active after that shift. 4669 Uses the contents of itemset. 4670 shift_symbol is set to a vector of the symbols that can be shifted. 4671 For each symbol in the grammar, kernel_base[symbol] points to 4672 a vector of item numbers activated if that symbol is shifted, 4673 and kernel_end[symbol] points after the end of that vector. */ 4674 void 4675 new_itemsets() 1 4676 { 1 4677 register int i; 1 4678 register int shiftcount; 1 4679 register short *isp; 1 4680 register short *ksp; 1 4681 register int symbol; 1 4682 1X 4683 #ifdef TRACE 1X 4684 fprintf(stderr, "Entering new_itemsets\n"); 1X 4685 #endif 1 4686 1 4687 for (i = 0; i < nsyms; i++) 1 4688 kernel_end[i] = NULL; 1 4689 1 4690 shiftcount = 0; 1 4691 1 4692 isp = itemset; 1 4693 1 4694 while (isp < itemsetend) 2 4695 { 2 4696 i = *isp++; 2 4697 symbol = ritem[i]; 2 4698 if (symbol > 0) 3 4699 { 3 4700 ksp = kernel_end[symbol]; 3 4701 3 4702 if (!ksp) 4 4703 { 4 4704 shift_symbol[shiftcount++] = symbol; Source Listing 31-MAR-2009 13:04:10 HP C V7.3-009-48GBT Page 5 20-APR-1993 05:41:26 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LR0.C;1 4 4705 ksp = kernel_base[symbol]; 3 4706 } 3 4707 3 4708 *ksp++ = i + 1; 3 4709 kernel_end[symbol] = ksp; 2 4710 } 1 4711 } 1 4712 1 4713 nshifts = shiftcount; 1 4714 } 4715 4716 4717 4718 /* Use the information computed by new_itemsets to find the state numbers 4719 reached by each shift transition from the current state. 4720 4721 shiftset is set up as a vector of state numbers of those states. */ 4722 void 4723 append_states() 1 4724 { 1 4725 register int i; 1 4726 register int j; 1 4727 register int symbol; 1 4728 1X 4729 #ifdef TRACE 1X 4730 fprintf(stderr, "Entering append_states\n"); 1X 4731 #endif 1 4732 1 4733 /* first sort shift_symbol into increasing order */ 1 4734 1 4735 for (i = 1; i < nshifts; i++) 2 4736 { 2 4737 symbol = shift_symbol[i]; 2 4738 j = i; 2 4739 while (j > 0 && shift_symbol[j - 1] > symbol) 3 4740 { 3 4741 shift_symbol[j] = shift_symbol[j - 1]; 3 4742 j--; 2 4743 } 2 4744 shift_symbol[j] = symbol; 1 4745 } 1 4746 1 4747 for (i = 0; i < nshifts; i++) 2 4748 { 2 4749 symbol = shift_symbol[i]; 2 4750 shiftset[i] = get_state(symbol); 1 4751 } 1 4752 } 4753 4754 4755 4756 /* find the state number for the state we would get to 4757 (from the current state) by shifting symbol. 4758 Create a new state if no equivalent one exists already. 4759 Used by append_states */ 4760 4761 int Source Listing 31-MAR-2009 13:04:10 HP C V7.3-009-48GBT Page 6 20-APR-1993 05:41:26 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LR0.C;1 4762 get_state(symbol) 4763 int symbol; 1 4764 { 1 4765 register int key; 1 4766 register short *isp1; 1 4767 register short *isp2; 1 4768 register short *iend; 1 4769 register core *sp; 1 4770 register int found; 1 4771 1 4772 int n; 1 4773 1X 4774 #ifdef TRACE 1X 4775 fprintf(stderr, "Entering get_state, symbol = %d\n", symbol); 1X 4776 #endif 1 4777 1 4778 isp1 = kernel_base[symbol]; 1 4779 iend = kernel_end[symbol]; 1 4780 n = iend - isp1; 1 4781 1 4782 /* add up the target state's active item numbers to get a hash key */ 1 4783 key = 0; 1 4784 while (isp1 < iend) 1 4785 key += *isp1++; 1 4786 1 4787 key = key % STATE_TABLE_SIZE; 1 4788 1 4789 sp = state_table[key]; 1 4790 1 4791 if (sp) 2 4792 { 2 4793 found = 0; 2 4794 while (!found) 3 4795 { 3 4796 if (sp->nitems == n) 4 4797 { 4 4798 found = 1; 4 4799 isp1 = kernel_base[symbol]; 4 4800 isp2 = sp->items; 4 4801 4 4802 while (found && isp1 < iend) 5 4803 { 5 4804 if (*isp1++ != *isp2++) 5 4805 found = 0; 4 4806 } 3 4807 } 3 4808 3 4809 if (!found) 4 4810 { 4 4811 if (sp->link) 5 4812 { 5 4813 sp = sp->link; 4 4814 } 4 4815 else /* bucket exhausted and no match */ 5 4816 { 5 4817 sp = sp->link = new_state(symbol); 5 4818 found = 1; Source Listing 31-MAR-2009 13:04:10 HP C V7.3-009-48GBT Page 7 20-APR-1993 05:41:26 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LR0.C;1 4 4819 } 3 4820 } 2 4821 } 1 4822 } 1 4823 else /* bucket is empty */ 2 4824 { 2 4825 state_table[key] = sp = new_state(symbol); 1 4826 } 1 4827 1 4828 return (sp->number); 1 4829 } 4830 4831 4832 4833 /* subroutine of get_state. create a new state for those items, if necessary. */ 4834 4835 core * 4836 new_state(symbol) 4837 int symbol; 1 4838 { 1 4839 register int n; 1 4840 register core *p; 1 4841 register short *isp1; 1 4842 register short *isp2; 1 4843 register short *iend; 1 4844 1X 4845 #ifdef TRACE 1X 4846 fprintf(stderr, "Entering new_state, symbol = %d\n", symbol); 1X 4847 #endif 1 4848 1 4849 if (nstates >= MAXSHORT) 1 4850 toomany("states"); 1 4851 1 4852 isp1 = kernel_base[symbol]; 1 4853 iend = kernel_end[symbol]; 1 4854 n = iend - isp1; 1 4855 1 4856 p = (core *) xmalloc((unsigned) (sizeof(core) + (n - 1) * sizeof(short))); 1 4857 p->accessing_symbol = symbol; 1 4858 p->number = nstates; 1 4859 p->nitems = n; 1 4860 1 4861 isp2 = p->items; 1 4862 while (isp1 < iend) 1 4863 *isp2++ = *isp1++; 1 4864 1 4865 last_state->next = p; 1 4866 last_state = p; 1 4867 1 4868 nstates++; 1 4869 1 4870 return (p); 1 4871 } 4872 4873 4874 void 4875 initialize_states() Source Listing 31-MAR-2009 13:04:10 HP C V7.3-009-48GBT Page 8 20-APR-1993 05:41:26 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LR0.C;1 1 4876 { 1 4877 register core *p; 1 4878 /* register unsigned *rp1; JF unused */ 1 4879 /* register unsigned *rp2; JF unused */ 1 4880 /* register unsigned *rend; JF unused */ 1 4881 1 4882 p = (core *) xmalloc((unsigned) (sizeof(core) - sizeof(short))); 1 4883 first_state = last_state = this_state = p; 1 4884 nstates = 1; 1 4885 } 4886 4887 4888 void 4889 save_shifts() 1 4890 { 1 4891 register shifts *p; 1 4892 register short *sp1; 1 4893 register short *sp2; 1 4894 register short *send; 1 4895 1 4896 p = (shifts *) xmalloc((unsigned) (sizeof(shifts) + 1 4897 (nshifts - 1) * sizeof(short))); 1 4898 1 4899 p->number = this_state->number; 1 4900 p->nshifts = nshifts; 1 4901 1 4902 sp1 = shiftset; 1 4903 sp2 = p->shifts; 1 4904 send = shiftset + nshifts; 1 4905 1 4906 while (sp1 < send) 1 4907 *sp2++ = *sp1++; 1 4908 1 4909 if (last_shift) 2 4910 { 2 4911 last_shift->next = p; 2 4912 last_shift = p; 1 4913 } 1 4914 else 2 4915 { 2 4916 first_shift = p; 2 4917 last_shift = p; 1 4918 } 1 4919 } 4920 4921 4922 4923 /* find which rules can be used for reduction transitions from the current state 4924 and make a reductions structure for the state to record their rule numbers. */ 4925 void 4926 save_reductions() 1 4927 { 1 4928 register short *isp; 1 4929 register short *rp1; 1 4930 register short *rp2; 1 4931 register int item; 1 4932 register int count; Source Listing 31-MAR-2009 13:04:10 HP C V7.3-009-48GBT Page 9 20-APR-1993 05:41:26 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LR0.C;1 1 4933 register reductions *p; 1 4934 1 4935 short *rend; 1 4936 1 4937 /* find and count the active items that represent ends of rules */ 1 4938 1 4939 count = 0; 1 4940 for (isp = itemset; isp < itemsetend; isp++) 2 4941 { 2 4942 item = ritem[*isp]; 2 4943 if (item < 0) 3 4944 { 3 4945 redset[count++] = -item; 2 4946 } 1 4947 } 1 4948 1 4949 /* make a reductions structure and copy the data into it. */ 1 4950 1 4951 if (count) 2 4952 { 2 4953 p = (reductions *) xmalloc((unsigned) (sizeof(reductions) + 2 4954 (count - 1) * sizeof(short))); 2 4955 2 4956 p->number = this_state->number; 2 4957 p->nreds = count; 2 4958 2 4959 rp1 = redset; 2 4960 rp2 = p->rules; 2 4961 rend = rp1 + count; 2 4962 2 4963 while (rp1 < rend) 2 4964 *rp2++ = *rp1++; 2 4965 2 4966 if (last_reduction) 3 4967 { 3 4968 last_reduction->next = p; 3 4969 last_reduction = p; 2 4970 } 2 4971 else 3 4972 { 3 4973 first_reduction = p; 3 4974 last_reduction = p; 2 4975 } 1 4976 } 1 4977 } 4978 4979 4980 4981 /* Make sure that the initial state has a shift that accepts the 4982 grammar's start symbol and goes to the next-to-final state, 4983 which has a shift going to the final state, which has a shift 4984 to the termination state. 4985 Create such states and shifts if they don't happen to exist already. */ 4986 void 4987 augment_automaton() 1 4988 { 1 4989 register int i; Source Listing 31-MAR-2009 13:04:10 HP C V7.3-009-48GBT Page 10 20-APR-1993 05:41:26 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LR0.C;1 1 4990 register int k; 1 4991 /* register int found; JF unused */ 1 4992 register core *statep; 1 4993 register shifts *sp; 1 4994 register shifts *sp2; 1 4995 register shifts *sp1; 1 4996 1 4997 sp = first_shift; 1 4998 1 4999 if (sp) 2 5000 { 2 5001 if (sp->number == 0) 3 5002 { 3 5003 k = sp->nshifts; 3 5004 statep = first_state->next; 3 5005 3 5006 /* The states reached by shifts from first_state are numbered 1...K. 3 5007 Look for one reached by start_symbol. */ 3 5008 while (statep->accessing_symbol < start_symbol 3 5009 && statep->number < k) 3 5010 statep = statep->next; 3 5011 3 5012 if (statep->accessing_symbol == start_symbol) 4 5013 { 4 5014 /* We already have a next-to-final state. 4 5015 Make sure it has a shift to what will be the final state. */ 4 5016 k = statep->number; 4 5017 4 5018 while (sp && sp->number < k) 5 5019 { 5 5020 sp1 = sp; 5 5021 sp = sp->next; 4 5022 } 4 5023 4 5024 if (sp && sp->number == k) 5 5025 { 5 5026 sp2 = (shifts *) xmalloc((unsigned) (sizeof(shifts) 5 5027 + sp->nshifts * sizeof(short))); 5 5028 sp2->number = k; 5 5029 sp2->nshifts = sp->nshifts + 1; 5 5030 sp2->shifts[0] = nstates; 5 5031 for (i = sp->nshifts; i > 0; i--) 5 5032 sp2->shifts[i] = sp->shifts[i - 1]; 5 5033 5 5034 /* Patch sp2 into the chain of shifts in place of sp, 5 5035 following sp1. */ 5 5036 sp2->next = sp->next; 5 5037 sp1->next = sp2; 5 5038 if (sp == last_shift) 5 5039 last_shift = sp2; 5 5040 FREE(sp); 4 5041 } 4 5042 else 5 5043 { 5 5044 sp2 = NEW(shifts); 5 5045 sp2->number = k; 5 5046 sp2->nshifts = 1; Source Listing 31-MAR-2009 13:04:10 HP C V7.3-009-48GBT Page 11 20-APR-1993 05:41:26 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LR0.C;1 5 5047 sp2->shifts[0] = nstates; 5 5048 5 5049 /* Patch sp2 into the chain of shifts between sp1 and sp. */ 5 5050 sp2->next = sp; 5 5051 sp1->next = sp2; 5 5052 if (sp == 0) 5 5053 last_shift = sp2; 4 5054 } 3 5055 } 3 5056 else 4 5057 { 4 5058 /* There is no next-to-final state as yet. */ 4 5059 /* Add one more shift in first_shift, 4 5060 going to the next-to-final state (yet to be made). */ 4 5061 sp = first_shift; 4 5062 4 5063 sp2 = (shifts *) xmalloc(sizeof(shifts) 4 5064 + sp->nshifts * sizeof(short)); 4 5065 sp2->nshifts = sp->nshifts + 1; 4 5066 4 5067 /* Stick this shift into the vector at the proper place. */ 4 5068 statep = first_state->next; 4 5069 for (k = 0, i = 0; i < sp->nshifts; k++, i++) 5 5070 { 5 5071 if (statep->accessing_symbol > start_symbol && i == k) 5 5072 sp2->shifts[k++] = nstates; 5 5073 sp2->shifts[k] = sp->shifts[i]; 5 5074 statep = statep->next; 4 5075 } 4 5076 if (i == k) 4 5077 sp2->shifts[k++] = nstates; 4 5078 4 5079 /* Patch sp2 into the chain of shifts 4 5080 in place of sp, at the beginning. */ 4 5081 sp2->next = sp->next; 4 5082 first_shift = sp2; 4 5083 if (last_shift == sp) 4 5084 last_shift = sp2; 4 5085 4 5086 FREE(sp); 4 5087 4 5088 /* Create the next-to-final state, with shift to 4 5089 what will be the final state. */ 4 5090 insert_start_shift(); 3 5091 } 2 5092 } 2 5093 else 3 5094 { 3 5095 /* The initial state didn't even have any shifts. 3 5096 Give it one shift, to the next-to-final state. */ 3 5097 sp = NEW(shifts); 3 5098 sp->nshifts = 1; 3 5099 sp->shifts[0] = nstates; 3 5100 3 5101 /* Patch sp into the chain of shifts at the beginning. */ 3 5102 sp->next = first_shift; 3 5103 first_shift = sp; Source Listing 31-MAR-2009 13:04:10 HP C V7.3-009-48GBT Page 12 20-APR-1993 05:41:26 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LR0.C;1 3 5104 3 5105 /* Create the next-to-final state, with shift to 3 5106 what will be the final state. */ 3 5107 insert_start_shift(); 2 5108 } 1 5109 } 1 5110 else 2 5111 { 2 5112 /* There are no shifts for any state. 2 5113 Make one shift, from the initial state to the next-to-final state. */ 2 5114 2 5115 sp = NEW(shifts); 2 5116 sp->nshifts = 1; 2 5117 sp->shifts[0] = nstates; 2 5118 2 5119 /* Initialize the chain of shifts with sp. */ 2 5120 first_shift = sp; 2 5121 last_shift = sp; 2 5122 2 5123 /* Create the next-to-final state, with shift to 2 5124 what will be the final state. */ 2 5125 insert_start_shift(); 1 5126 } 1 5127 1 5128 /* Make the final state--the one that follows a shift from the 1 5129 next-to-final state. 1 5130 The symbol for that shift is 0 (end-of-file). */ 1 5131 statep = (core *) xmalloc((unsigned) (sizeof(core) - sizeof(short))); 1 5132 statep->number = nstates; 1 5133 last_state->next = statep; 1 5134 last_state = statep; 1 5135 1 5136 /* Make the shift from the final state to the termination state. */ 1 5137 sp = NEW(shifts); 1 5138 sp->number = nstates++; 1 5139 sp->nshifts = 1; 1 5140 sp->shifts[0] = nstates; 1 5141 last_shift->next = sp; 1 5142 last_shift = sp; 1 5143 1 5144 /* Note that the variable `final_state' refers to what we sometimes call 1 5145 the termination state. */ 1 5146 final_state = nstates; 1 5147 1 5148 /* Make the termination state. */ 1 5149 statep = (core *) xmalloc((unsigned) (sizeof(core) - sizeof(short))); 1 5150 statep->number = nstates++; 1 5151 last_state->next = statep; 1 5152 last_state = statep; 1 5153 } 5154 5155 5156 /* subroutine of augment_automaton. 5157 Create the next-to-final state, to which a shift has already been made in 5158 the initial state. */ 5159 void 5160 insert_start_shift() Source Listing 31-MAR-2009 13:04:10 HP C V7.3-009-48GBT Page 13 20-APR-1993 05:41:26 _$1$DGA712:[LAISHEV.TOOLS.BISON-1_22]LR0.C;1 1 5161 { 1 5162 register core *statep; 1 5163 register shifts *sp; 1 5164 1 5165 statep = (core *) xmalloc((unsigned) (sizeof(core) - sizeof(short))); 1 5166 statep->number = nstates; 1 5167 statep->accessing_symbol = start_symbol; 1 5168 1 5169 last_state->next = statep; 1 5170 last_state = statep; 1 5171 1 5172 /* Make a shift from this state to (what will be) the final state. */ 1 5173 sp = NEW(shifts); 1 5174 sp->number = nstates++; 1 5175 sp->nshifts = 1; 1 5176 sp->shifts[0] = nstates; 1 5177 1 5178 last_shift->next = sp; 1 5179 last_shift = sp; 1 5180 } Command Line ------- ---- CC/INCLU=[]/LIS LR0.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:10" __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