Also close bug
[filters.git] / ken.l
1 %{
2 /*
3 * ken:
4 * will turn English into Cockney, featuring (dubious) rhyming slang for a lot
5 * of computer terminology.
6 *
7 * Written by Stephen K Mulrine <smulrine%cs.strath.ac.uk@nsfnet-relay.ac.uk>
8 * Make copies if you want etc.etc.
9 *
10 * Contacted author in June 2001, asked him to clarify the license, he replied
11 * with some improvements and placed the program in the public domain.
12 * -- Edward Betts <edward@debian.org> Mon, 11 Jun 2001 12:04:29 +0100
13 *
14 * ken is named after Ken the Chirpy Cockney Character from the Viz Comic (tm),
15 * who speaks somewhat like that.
16 */
17 %}
18 %e 3000
19 %p 6000
20 %n 1000
21 %k 500
22 %a 4000
23 %o 2000
24 BW [ ]
25 EW [ .,;!?]
26 %{
27 char buf[128];
28 %}
29
30 %%
31
32 stairs printf("apples and pears");
33 Downstairs printf("Down the apples and pears");
34 downstairs printf("down the apples and pears");
35 Upstairs printf("Up the apples and pears");
36 upstairs printf("up the apples and pears");
37 [Mm]outh printf("North and South");
38 [Ff]ace printf("Boat Race");
39 [Tt]rouble printf("Barney Rubble");
40 wife { switch(rand()%2)
41 {
42 case 0: printf("trouble and strife"); break;
43 case 1: printf("ole lady"); break;
44 }
45 }
46 Road printf("Frog and Toad");
47 " road" printf(" frog and toad");
48 "pub " printf("rub-a-dub ");
49 " bar " printf(" boozer ");
50 " husband" printf(" ole man");
51 Party printf("Knees-up");
52 party printf("knees-up");
53 Parties printf("Knees-ups");
54 parties printf("knees-ups");
55 My printf("Me");
56 " my" printf(" me");
57 Your printf("Yer");
58 your printf("yer");
59 "You are " printf("Yer ");
60 "you are " printf("yer ");
61 You printf("Yer");
62 you printf("yer");
63 Those printf("Them");
64 those printf("them");
65 " those" printf(" them");
66 "(those" printf("(them");
67 "The " { switch(rand()%5)
68 {
69 case 0: printf("The bleedin' "); break;
70 default: ECHO; break;
71 }
72 }
73 "The" ECHO;
74 " the " { switch(rand()%5)
75 {
76 case 0: printf(" the bleedin' "); break;
77 default: ECHO; break;
78 }
79 }
80 [" "(]the ECHO;
81 "the " { switch(rand()%5)
82 {
83 case 0: printf(" the bleedin' "); break;
84 default: ECHO; break;
85 }
86 }
87 [Tt]his ECHO;
88 [" "(]this ECHO;
89 [Tt]hat ECHO;
90 [" "(]that ECHO;
91 Thus printf("So");
92 " thus" printf(" so");
93 "(thus" printf("(so");
94 "thus" printf("so");
95 [Tt]han ECHO;
96 [" "(]than ECHO;
97 Who ECHO;
98 who ECHO;
99 " old " printf(" ole ");
100 " to " printf(" ter ");
101 "Aren't you " printf("Aintcha ");
102 "aren't you " printf("aintcha ");
103 "Aren't" printf("Ain't");
104 "aren't" printf("ain't");
105 "Isn't" printf("Ain't");
106 "isn't" printf("ain't");
107 "Are not " printf("Ain't");
108 "are not " printf("ain't ");
109 "Is not " printf("Ain't ");
110 " is not " printf(" ain't ");
111 "What is th" printf("Woss");
112 "what is th" printf("woss");
113 "What are you " printf("Wotcher ");
114 "what are you " printf("wotcher ");
115 "What you are" printf("Wotcher");
116 "what you are" printf("wotcher");
117 "What you're" printf("Wotcher");
118 "what you're" printf("wotcher");
119 "What are your" printf("Wotcher");
120 "what are your" printf("wotcher");
121 "What do you " printf("Wotcher ");
122 "what do you " printf("wotcher ");
123 "What do your" printf("Wotcher");
124 "what do your" printf("wotcher");
125 " "H[aeu]llo printf(" Wotcher");
126 " "h[aeu]llo printf(" wotcher");
127 What printf("Wot");
128 what printf("wot");
129 Were printf("Was");
130 were printf("was");
131 Bother printf("Ars");
132 bother printf("ars");
133 Mother printf("Muvver");
134 Other printf("Uvver");
135 other printf("uvver");
136 Father printf("Favver");
137 father printf("favver");
138 Rather printf("Ravver");
139 rather printf("ravver");
140 Weather printf("Wevver");
141 weather printf("wevver");
142 Leather printf("Levver");
143 leather printf("levver");
144 Wither printf("Wivver");
145 wither printf("wivver");
146 Either printf("Eever");
147 either printf("eever");
148 With printf("Wiv");
149 with printf("wiv");
150 Anything printf("Anyfink");
151 anything printf("anyfink");
152 Something printf("Sumfink");
153 something printf("sumfink");
154 Nothing printf("Nuffink");
155 nothing printf("nuffink");
156 guitars printf("spoons");
157 guitar printf("spoons");
158 drums printf("spoons");
159 drum printf("spoons");
160 trumpets printf("spoons");
161 trumpet printf("spoons");
162 violins printf("spoons");
163 violin printf("spoons");
164 clarinets printf("spoons");
165 clarinet printf("spoons");
166 trombones printf("spoons");
167 trombone printf("spoons");
168 oboes printf("spoons");
169 oboe printf("spoons");
170 flutes printf("spoons");
171 flute printf("spoons");
172 tubas printf("spoons");
173 tuba printf("spoons");
174 Data printf("Info");
175 data printf("info");
176 Directory printf("Lockup");
177 directory printf("lockup");
178 Directories printf("Lockups");
179 directories printf("lockups");
180 [Pp]rocess { switch(rand()%2)
181 {
182 case 0: printf("Queen Bess"); break;
183 case 1: printf("Rudolf 'Ess"); break;
184 }
185 }
186 [Cc]omputer printf("French Tutor");
187 [Bb]yte printf("Jimmy White");
188 [Ff]iles printf("Nobby Stiles");
189 [Ff]ile printf("Royal Mile");
190 [Ll]anguage printf("'Am Sandwich");
191 [Zz]ero printf("Emperor Nero");
192 [Jj]ob printf("Uncle Bob");
193 [Ss]hell printf("Bow Bell");
194 [Ss]ave printf("Chas'n'Dave");
195 [Ll]oad printf("Old Kent Road");
196 [Mm]ouse printf("Doll's 'Ouse");
197 [Bb]uffer printf("Sausage Stuffer");
198 [Kk]eyboard printf("Henry Ford");
199 [Mm]anual printf("Cocker Spaniel");
200 [Ss]creen printf("James Dean");
201 [Pp]rinter printf("'Arold Pinter");
202 [Pp]lotter printf("Pansy Potter");
203 [Cc]ompiler printf("Martin Tyler");
204 [Ss]tring printf("Emperor Ming");
205 [Bb]rain printf("Michael Caine");
206 [Pp][Aa][Ss][Cc][Aa][Ll] { switch(rand()%2)
207 {
208 case 0: printf("Pall Mall"); break;
209 case 1: printf("Roald Dahl"); break;
210 }
211 }
212 [Aa][Ll][Gg][Oo][Ll] printf("Johnny Ball");
213 [Ff][Oo][Rr][Tt][Rr][Aa][Nn] printf("Manfred Mann");
214 [Cc][Oo][Bb][Oo][Ll] printf("Albert Hall");
215 [Jj]ava printf("Wot a palavah");
216 W[aA][pP] printf("Pony and trap");
217 " wap" printf(" pony and trap");
218 Stopped printf("'Ad the mockers put on");
219 stopped printf("'ad the mockers put on");
220 Stopping printf("Putting the mockers on");
221 stopping printf("putting the mockers on");
222 stops printf("puts the mockers on");
223 stop printf("put the mockers on");
224 STOP printf("Put The Mockers On");
225 [Ll]ondoner printf("Cockney");
226 friend { switch(rand()%3)
227 {
228 case 0: printf("mucker"); break;
229 case 1: printf("mate"); break;
230 case 2: printf("china"); break;
231 }
232 }
233 "a h" printf("an '");
234 "A h" printf("An '");
235 " h" printf(" '");
236 " H" printf(" '");
237 " C-" printf(" Bruce Lee-");
238 " C " { switch(rand()%4)
239 {
240 case 0: printf(" Bruce Lee "); break;
241 case 1: printf(" Circus Flea "); break;
242 case 2: printf(" Bumble Bee "); break;
243 case 3: printf(" Door Key "); break;
244 }
245 }
246 " C." printf(" Circus Flea.");
247 Th printf("F");
248 Wh printf("W");
249 wh printf("w");
250 aw printf("or");
251 " "[BbKkMmPpRrSsWw]ing ECHO;
252 " "[Bb]ring ECHO;
253 " "[Ss]ting ECHO;
254 " "[Ss]wing ECHO;
255 " "[CcFfSs]ling ECHO;
256 " Thing" printf(" Fing");
257 " thing" printf(" fing");
258
259 "ing " printf("in' ");
260 ". " { switch(rand()%32)
261 {
262 case 0: printf(". I'll get out me spoons. "); break;
263 case 1: printf(". Yer can't 'ave a knees-up wivout a joanna. "); break;
264 case 2: printf(". Cor blimey guv, would I lie to you. "); break;
265 case 3: printf(". I'll make us all a nice cup of tea. "); break;
266 default: ECHO; break;
267 }
268 }
269 "? " { switch(rand()%3)
270 {
271 case 0: printf(", mate? "); break;
272 case 1: printf(", guv? "); break;
273 case 2: printf(", squire? "); break;
274 }
275 }
276 "! " { switch(rand()%6)
277 {
278 case 0: printf(", cor blimey! "); break;
279 case 1: printf("! Struth! "); break;
280 case 2: printf(", guv! "); break;
281 case 3: printf("! Honest guv! "); break;
282 case 4: printf(", mate! "); break;
283 case 5: ECHO; break;
284 }
285 }
286 . printf("%s", yytext);
287 \n printf("\n");
288 %%
This page took 0.02742 seconds and 4 git commands to generate.