dc17484a |
1 | %{ |
2 | /* |
3 | * Lex filter to transform plain English into Brooklyn English. |
4 | * No racial or societal slurs are intended. For amusement only. |
5 | * |
6 | * Copyright 1986 by Daniel Klein. |
7 | * |
8 | * Reproduction permitted so long as this notice is retained. |
9 | */ |
10 | %} |
11 | BW [ \t] |
12 | SP [ \t] |
13 | EW [ \t.,;!\?$] |
14 | %% |
fb5da53f |
15 | %{ |
16 | void plastc() { |
17 | yyunput(yytext[yyleng-1], yytext); |
18 | } |
19 | %} |
dc17484a |
20 | ".so ".*$ printf("%s", yytext); |
21 | [ao]ther printf("%cdder", yytext[0]=='a'?'a':'u'); |
22 | [Nn]othing printf("%cuttin'", yytext[0]); |
23 | [Tt]hin printf("%cin", yytext[0]); |
24 | [Tt]hir printf("%coi", yytext[0]); |
25 | [Tt]h[ei] printf("%c%c", caseify('d'), yytext[yyleng-1]); |
26 | [Tt]hat printf("%cat", caseify('d')); |
27 | I'm{SP}going{SP}to printf("I'manna"); |
28 | going{SP}to printf("gonna"); |
29 | want{SP}to printf("wanna"); |
30 | t{SP}you printf("tcha"); |
31 | [Dd]id{SP}you{SP}[eaiou] printf("%c'j%c", yytext[0], yytext[yyleng-1]); |
32 | [Dd]id{SP}you printf("%c'ja", yytext[0]); |
33 | [Yy]ou printf("%cuh", yytext[0]); |
34 | [Hh]ow{SP}are{SP}you printf("%cowahrya", yytext[0]); |
35 | [Ww]ith printf("%cit'", yytext[0]); |
36 | [Dd]on't printf("%coan", yytext[0]); |
37 | ldn't | |
38 | dn't printf("n't"); |
39 | isn't printf("ain't"); |
40 | er{EW} { printf("uh"); plastc(); } |
41 | ing{EW} { printf("in'"); plastc(); } |
42 | [Ww]ord | |
43 | [Hh]eard | |
44 | [BbGgLlPpSs]urg | |
45 | [CcHh][eu]r[ntv] printf("%coi%c", yytext[0], yytext[yyleng-1]); |
46 | [^Mm]mer[^aeiouhrs] printf("%cmoi%c", yytext[0], yytext[yyleng-1]); |
47 | [Oo]re{EW} { printf("%cwh", caseify('a')); plastc(); } |
48 | [Oo]r printf("%cwh", caseify('a')); |
49 | [Oo]f printf("%chv", caseify('u')); |
50 | tion printf("shun"); |
51 | alk | |
52 | our[st] | |
53 | or[st] printf("awh%c", yytext[yyleng-1]); |
54 | ause printf("awze"); |
55 | [Oo]ff printf("%cwhf", caseify('a')); |
56 | [Ss]tupid printf("%ctoopid", yytext[0]); |
57 | {BW}under printf(" unner"); |
58 | {BW}to{EW} { printf(" tuh"); plastc(); } |
59 | [Aa]ctual printf("%cckshul", yytext[0]); |
60 | negro printf("spade"); |
61 | [Pp]uerto{SP}[Rr]ican printf("%cpic", caseify('s')); |
62 | [Ii]talian printf("%creaser", caseify('g')); |
63 | [Jj]ewish printf("%cew boy", yytext[0]); |
64 | [Jj]ew printf("%cebe", caseify('h')); |
65 | [a-z]":" { *(yytext+1) = ','; |
66 | printf("%s like, uhh:",yytext); |
67 | } |
68 | [a-z]"?" { *(yytext+1) = ','; |
69 | printf("%s or what?",yytext); |
70 | } |
71 | ! printf("! Okay?"); |
72 | [a-z]"." { printf("%s", yytext);expletive();} |
73 | %% |
dc17484a |
74 | |
75 | caseify(c) |
76 | char c; |
77 | { |
78 | if (yytext[0] <= 'Z') |
79 | return (c - ' '); |
80 | else |
81 | return (c); |
82 | } |
83 | |
84 | short count = 0; |
85 | short which = 0; |
86 | |
87 | expletive() |
88 | { |
89 | if (count++ % 4 == 0) { |
90 | switch (which++ % 5) { |
91 | case 0: printf(" Okay?"); break; |
92 | case 1: printf(" Right?"); break; |
93 | case 2: printf(" Yuh got me so fahr?"); break; |
94 | case 3: printf(" Ya' dig?"); break; |
95 | case 4: printf(" Yuh with me?"); break; |
96 | } |
97 | } |
98 | } |
7f4e9d5e |
99 | |
100 | main() |
101 | { |
102 | yylex(); |
103 | } |
104 | |
105 | int yywrap() |
106 | { |
107 | return 1; |
108 | } |