|
|
1.1 root 1:
2:
3:
4: CSGEN(1) Icon Program Library CSGEN(1)
5:
6:
7:
8: NNNNAAAAMMMMEEEE
9: csgen - context-sensitive sentences
10:
11: SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
12: ccccssssggggeeeennnn [----tttt]
13:
14: DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
15: _C_s_g_e_n accepts a context sensitive production grammar from
16: standard input and generates randomly selected sentences
17: from the corresponding language.
18:
19: Uppercase letters stand for nonterminal symbols, ---->>>> indi-
20: cates the lefthand side can be rewritten by the righthand
21: side. Other characters are considered to be terminal sym-
22: bols. Lines beginning with #### are considered to be comments
23: and are ignored. A line consisting of a nonterminal symbol
24: followed by a colon and a nonnegative integer iiii is a genera-
25: tion specification for _i instances of sentences for the
26: language defined by the nonterminal (goal) symbol. An exam-
27: ple is:
28:
29: # a(n)b(n)c(n)
30: # Salomaa, p. 11. Attributed to M. Soittola.
31: #
32: X
33: X->abc
34: X->aYbc
35: Yb->bY
36: Yc->Zbcc
37: bZ->Zb
38: aZ->aaY
39: aZ->aa
40: X:10
41:
42: A positive integer followed by a colon can be prefixed to a
43: production to replicate that production, making its selec-
44: tion more likely. For example,
45:
46: 3:X->abc
47:
48: is equivalent to
49:
50: X->abc
51: X->abc
52: X->abc
53:
54:
55: The ----tttt option writes a trace of the derivations to standard
56: error output.
57:
58: LLLLIIIIMMMMIIIITTTTAAAATTTTIIIIOOOONNNNSSSS
59: Nonterminal symbols can only be represented by single
60:
61:
62:
63: Version 5.9 The University of Arizona - 6/28/83 1
64:
65:
66:
67:
68:
69:
70: CSGEN(1) Icon Program Library CSGEN(1)
71:
72:
73:
74: uppercase letters and there is no way to represent uppercase
75: terminal symbols.
76:
77: There can be only one generation specification and it must
78: appear as the last line of input.
79:
80: Generation of context-sensitive strings is a slow process.
81: It may not terminate, either because of a loop in the
82: rewriting rules of the grammar or because of the progressive
83: accumulation of nonterminal symbols. _C_s_g_e_n, however, avoids
84: deadlock, in which there are no possible rewrites for a
85: string in the derivation.
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129: Version 5.9 The University of Arizona - 6/28/83 2
130:
131:
132:
133:
134:
135:
136: CSGEN(1) Icon Program Library CSGEN(1)
137:
138:
139:
140: SSSSEEEEEEEE AAAALLLLSSSSOOOO
141: Salomaa, Arto. _F_o_r_m_a_l _L_a_n_g_u_a_g_e_s, Academic Press, New York,
142: 1973.
143:
144: AAAAUUUUTTTTHHHHOOOORRRR
145: Ralph E. Griswold
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195: Version 5.9 The University of Arizona - 6/28/83 3
196:
197:
198:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.