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