
	( Apologies for sending the wrong version here and to mod.sources a
	few days ago. Correct version is listed below. All flames to above
	address. )

	The following source forms the xref program for syntactically correct
Yacc files and runs on UN*X 4.2. All tokens and non-terminals in the grammar
are located, together with a list of the line numbers at which they occur. The
output is a numbered listing of the Yacc grammar upto the second '%%' or EOF,
followed by an alphabetical listing of the xref table.
	Should a syntax error occur before normal termination, the grammar
listing ends and as much of the table as has been constructed is printed. All
comments /* .. */ , %{ .. %} and actions { .. } are ignored, although they
appear in the listing. Overflow in any field of the data structure holding the
table information is reported as it occurs and execution terminates without
printing any xref information.
	Table data is stored in "table[]", which holds MAXINTS terminal/non-
terminal names, each of length <= MAXCHARS. A total of MAXDEFS defining (rhs of
rule) occurances can be held, and a total of MAXOCCS lhs occurances. Each ident-
ifier which may be the start token has the message held in "start_maybe[]"
printed - likewise all possible tokens are accompanied by "token_maybe[]". All
defining occurances are printed following "declared_at_mark[]", and all
other occurances following "occurs_at_mark[]".
	An example of the output is given below.

   1 :	%{
   2 :	
   3 :	
   4 :	%}
   5 :	
   6 :		/*******************************************************\
   7 :		*							*
   8 :		*	Trivial Yacc grammar.				*
   9 :		*	~~~~~~~~~~~~~~~~~~~~~				*
  10 :		*							*
  11 :		\*******************************************************/
  12 :	
  13 :	%token	IDENTIFIER CHARACTER NUMBER
  14 :	
  15 :	%start	start
  16 :	
  17 :	%%
  18 :	
  19 :	start
  20 :		:	begin middle end
  21 :		;
  22 :	
  23 :	begin
  24 :		:	BEGIN
  25 :		;
  26 :	
  27 :	middle
  28 :		:
  29 :		;
  30 :	
  31 :	begin
  32 :		:
  33 :		|	ALT_BEGIN
  34 :		;
  35 :	
  36 :	


' ALT_BEGIN ' -
			is not declared - token?? 1 occurances at lines , 33
' BEGIN ' -
			is not declared - token?? 1 occurances at lines , 24
' begin ' -
			*23 , *31 1 occurances at lines , 20
' end ' -
			is not declared - token?? 1 occurances at lines , 20
' middle ' -
			*27  1 occurances at lines , 20
' start ' -
			*19 , never occurs on rhs of rule - start rule?

	End of X-ref
	~~~~~~~~~~~~

	The text below should be stored in the file
	
	pack.out
	
and can be converted from the single file to the three files

	xref-grammar
	xref-regular_expr
	xref-line.h

by issuing the command

	sh pack.out

	Issue the commands

	lex xref-regular_expr
	yacc -vd xref-grammar
	cc y.tab.c -o xref

to produce an executable version and use as any UN*X command.


<---------------------------------- Cut here ---------------------------------->

