summaryrefslogtreecommitdiff
path: root/ipl/docs/pt.man
blob: 2f14d02aab785ea6e0ca7d91297f468b6f1b9032 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
PT


NAME
     pt - canonical LR(1) parse (action and goto) table generator.
		  The input grammar productions with added enumerations,
			needed as part of the reduction in the action
			table, is also part of the output.
		  (Various optional outputs are possible:-
			terminal sets
			nonterminal sets
			first sets for nonterminals
			items in each state)

SYNOPSIS
     pt [ option | option | ... ]
 
DESCRIPTION
     Pt reads the grammar from the file called grammar, if one exists,
     else it will read from standard input.  The grammar MUST conform
     to the following:-

	1.  It must be a context-free grammar, augmented or unaugmented.
        2.  Each production is of the form:-

 			  	A -> B ; C a 

		The arrow separates the left side of the production
		    from the right side.
		The left side of the production consists of only one
		    nonterminal.
		The right side of the production consists of a sequence
		    of symbols (terminals, nonterminals) with one or 
		    more white spaces (blanks and tabs) separating them.
		A symbol is thus either a terminal or a nonterminal but
		    not both.
		
	3.  One production per line; no alternation allowed.  Thus, 
	    represent the following 2 productions:-

 			  	A -> B ; C a   |   b
	    by:-
 			  	A -> B ; C a 
				A -> b
	
	4.  Newline character, tab and blank cannot be a grammar token
	    (terminal or nonterminal).

	5.  The left hand side symbol of the very first production
	    represents the starting symbol of the grammar.
 
	6.  The following are "reserved" words:-

				START
				EOI

	    and cannot be used as a terminal or nonterminal.

	7.  EPSILON is considered another "reserved" word and can be
		used to represent an empty production, viz.
				
				H -> EPSILON

	No error messages will be issued if the input grammar does not
     	conform to the above specifications.

     The options, which can appear in any order, are:-

	-t	Print the list of terminals in the grammar.

	-nt	Print the list of nonterminals in the grammar.

	-f	Print the list of first sets of the nonterminals 
		in the grammar.

	-e	Print the list of items (i.e. closure) in each state.


FILES
     grammar	  	grammar file with format specified above.

SEE ALSO
     yacc
     Aho A.V., Sethi, R. and Ullman, J.D., Compilers: Principles,
	Techniques, and Tools.  Addison-Wesley, 1986.

DIAGNOSTICS
     All shift/reduce conflicts will be reported (to errout).  In the 
        table form, only shift will be shown.
     To avoid reduce/reduce conflict the grammar should be unambiguous 
	with left-factoring performed if necessary.
     Unrecognized options or arguments in the command line will be
        ignored.

BUGS
     No known bugs!

AUTHOR
     Deeporn H. Beardsley