File: ken.l

package info (click to toggle)
filters 2.52
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 264 kB
  • ctags: 47
  • sloc: lex: 1,880; perl: 1,018; ansic: 214; makefile: 83; sh: 10
file content (288 lines) | stat: -rw-r--r-- 7,728 bytes parent folder | download | duplicates (4)
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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
%{
/*
 * ken:
 * will turn English into Cockney, featuring (dubious) rhyming slang for a lot
 * of computer terminology.
 * 
 * Written by Stephen K Mulrine <smulrine%cs.strath.ac.uk@nsfnet-relay.ac.uk>
 * Make copies if you want etc.etc.
 * 
 * Contacted author in June 2001, asked him to clarify the license, he replied
 * with some improvements and placed the program in the public domain.
 *         -- Edward Betts <edward@debian.org> Mon, 11 Jun 2001 12:04:29 +0100
 * 
 * ken is named after Ken the Chirpy Cockney Character from the Viz Comic (tm),
 * who speaks somewhat like that.
 */
%}
%e 3000
%p 6000
%n 1000
%k 500
%a 4000
%o 2000
BW [ 	]
EW [ 	.,;!?]
%{
    char buf[128];
%}

%%

stairs		printf("apples and pears");
Downstairs	printf("Down the apples and pears");
downstairs	printf("down the apples and pears");
Upstairs	printf("Up the apples and pears");
upstairs	printf("up the apples and pears");
[Mm]outh	printf("North and South");
[Ff]ace		printf("Boat Race");
[Tt]rouble	printf("Barney Rubble");
wife		{	switch(rand()%2)
			{
			case 0: printf("trouble and strife"); break;
			case 1: printf("ole lady"); break;
			}
		}
Road		printf("Frog and Toad");
" road"		printf(" frog and toad");
"pub "		printf("rub-a-dub ");
" bar "		printf(" boozer ");
" husband"	printf(" ole man");
Party		printf("Knees-up");
party		printf("knees-up");
Parties		printf("Knees-ups");
parties		printf("knees-ups");
My		printf("Me");
" my"		printf(" me");
Your		printf("Yer");
your		printf("yer");
"You are "      printf("Yer ");
"you are "      printf("yer ");
You		printf("Yer");
you		printf("yer");
Those		printf("Them");
those		printf("them");
" those"	printf(" them");
"(those"	printf("(them");
"The "		{   switch(rand()%5)
		    {
		    case 0: printf("The bleedin' "); break;
		    default: ECHO; break;
		    }
		}
"The"		ECHO;
" the "		{   switch(rand()%5)
		    {
		    case 0: printf(" the bleedin' "); break;
		    default: ECHO; break;
		    }
		}
[" "(]the	ECHO;
"the "		{   switch(rand()%5)
		    {
		    case 0: printf(" the bleedin' "); break;
		    default: ECHO; break;
		    }
		}
[Tt]his		ECHO;
[" "(]this	ECHO;
[Tt]hat		ECHO;
[" "(]that	ECHO;
Thus		printf("So");
" thus"		printf(" so");
"(thus"		printf("(so");
"thus"		printf("so");
[Tt]han		ECHO;
[" "(]than	ECHO;
Who		ECHO;
who		ECHO;
" old "		printf(" ole ");
" to "		printf(" ter ");
"Aren't you "   printf("Aintcha ");
"aren't you "   printf("aintcha ");
"Aren't"	printf("Ain't");
"aren't"	printf("ain't");
"Isn't"		printf("Ain't");
"isn't"		printf("ain't");
"Are not "	printf("Ain't");
"are not "	printf("ain't ");
"Is not "	printf("Ain't ");
" is not "	printf(" ain't ");
"What is th"    printf("Woss");
"what is th"    printf("woss");
"What are you "	printf("Wotcher ");
"what are you "	printf("wotcher ");
"What you are"	printf("Wotcher");
"what you are"	printf("wotcher");
"What you're"	printf("Wotcher");
"what you're"	printf("wotcher");
"What are your"	printf("Wotcher");
"what are your"	printf("wotcher");
"What do you "  printf("Wotcher ");
"what do you "	printf("wotcher ");
"What do your"  printf("Wotcher");
"what do your"	printf("wotcher");
" "H[aeu]llo	printf(" Wotcher");
" "h[aeu]llo	printf(" wotcher");
What		printf("Wot");
what		printf("wot");
Were		printf("Was");
were 		printf("was");
Bother		printf("Ars");
bother		printf("ars");
Mother		printf("Muvver");
Other		printf("Uvver");
other		printf("uvver");
Father		printf("Favver");
father		printf("favver");
Rather		printf("Ravver");
rather		printf("ravver");
Weather		printf("Wevver");
weather		printf("wevver");
Leather		printf("Levver");
leather		printf("levver");
Wither		printf("Wivver");
wither		printf("wivver");
Either		printf("Eever");
either		printf("eever");
With		printf("Wiv");
with		printf("wiv");
Anything	printf("Anyfink");
anything	printf("anyfink");
Something	printf("Sumfink");
something	printf("sumfink");
Nothing		printf("Nuffink");
nothing		printf("nuffink");
guitars		printf("spoons");
guitar		printf("spoons");
drums		printf("spoons");
drum		printf("spoons");
trumpets	printf("spoons");
trumpet		printf("spoons");
violins		printf("spoons");
violin		printf("spoons");
clarinets	printf("spoons");
clarinet	printf("spoons");
trombones	printf("spoons");
trombone	printf("spoons");
oboes		printf("spoons");
oboe		printf("spoons");
flutes		printf("spoons");
flute		printf("spoons");
tubas		printf("spoons");
tuba		printf("spoons");
Data		printf("Info");
data		printf("info");
Directory	printf("Lockup");
directory	printf("lockup");
Directories	printf("Lockups");
directories	printf("lockups");
[Pp]rocess	{   switch(rand()%2)
		    {
		    case 0: printf("Queen Bess"); break;
		    case 1: printf("Rudolf 'Ess"); break;
		    }
		}
[Cc]omputer	printf("French Tutor");
[Bb]yte		printf("Jimmy White");
[Ff]iles	printf("Nobby Stiles");
[Ff]ile		printf("Royal Mile");
[Ll]anguage	printf("'Am Sandwich");
[Zz]ero		printf("Emperor Nero");
[Jj]ob		printf("Uncle Bob");
[Ss]hell	printf("Bow Bell");
[Ss]ave		printf("Chas'n'Dave");
[Ll]oad		printf("Old Kent Road");
[Mm]ouse	printf("Doll's 'Ouse");
[Bb]uffer	printf("Sausage Stuffer");
[Kk]eyboard	printf("Henry Ford");
[Mm]anual	printf("Cocker Spaniel");
[Ss]creen	printf("James Dean");
[Pp]rinter	printf("'Arold Pinter");
[Pp]lotter	printf("Pansy Potter");
[Cc]ompiler	printf("Martin Tyler");
[Ss]tring	printf("Emperor Ming");
[Bb]rain	printf("Michael Caine");
[Pp][Aa][Ss][Cc][Aa][Ll]	{   switch(rand()%2)
				    {
				    case 0: printf("Pall Mall"); break;
				    case 1: printf("Roald Dahl"); break;
				    }
				}
[Aa][Ll][Gg][Oo][Ll]	printf("Johnny Ball");
[Ff][Oo][Rr][Tt][Rr][Aa][Nn]	printf("Manfred Mann");
[Cc][Oo][Bb][Oo][Ll]	printf("Albert Hall");
[Jj]ava		printf("Wot a palavah");
W[aA][pP]	printf("Pony and trap");
" wap"		printf(" pony and trap");
Stopped		printf("'Ad the mockers put on");
stopped		printf("'ad the mockers put on");
Stopping	printf("Putting the mockers on");
stopping	printf("putting the mockers on");
stops		printf("puts the mockers on");
stop		printf("put the mockers on");
STOP		printf("Put The Mockers On");
[Ll]ondoner	printf("Cockney");
friend		{   switch(rand()%3)
		    {
		    case 0: printf("mucker"); break;
		    case 1: printf("mate"); break;
		    case 2: printf("china"); break;
		    }
		}
"a h"		printf("an '");
"A h"		printf("An '");
" h"		printf(" '");
" H"		printf(" '");
" C-"		printf(" Bruce Lee-");
" C "		{        switch(rand()%4)
			 {
			 case 0: printf(" Bruce Lee "); break;
			 case 1: printf(" Circus Flea "); break;
			 case 2: printf(" Bumble Bee "); break;
			 case 3: printf(" Door Key "); break;
			 }
		}
" C."		printf(" Circus Flea.");
Th		printf("F");
Wh		printf("W");
wh		printf("w");
aw		printf("or");
" "[BbKkMmPpRrSsWw]ing	ECHO;
" "[Bb]ring	ECHO;
" "[Ss]ting	ECHO;
" "[Ss]wing	ECHO;
" "[CcFfSs]ling	ECHO;
" Thing"	printf(" Fing");
" thing"	printf(" fing");

"ing "		printf("in' ");
". "		{   switch(rand()%32)
		    {
		    case 0: printf(". I'll get out me spoons. "); break;
		    case 1: printf(". Yer can't 'ave a knees-up wivout a joanna. "); break;
		    case 2: printf(". Cor blimey guv, would I lie to you. "); break;
		    case 3: printf(". I'll make us all a nice cup of tea. "); break;
		    default: ECHO; break;
		    }
		}
"? "		{   switch(rand()%3)
		    {
		    case 0: printf(", mate? "); break;
		    case 1: printf(", guv? "); break;
		    case 2: printf(", squire? "); break;
		    }
		}
"! "		{   switch(rand()%6)
		    {
		    case 0: printf(", cor blimey! "); break;
		    case 1: printf("! Struth! "); break;
		    case 2: printf(", guv! "); break;
		    case 3: printf("! Honest guv! "); break;
		    case 4: printf(", mate! "); break;
		    case 5: ECHO; break;
		    }
		}
.		printf("%s", yytext);
\n		printf("\n");
%%