Initial revision
[filters.git] / aust.l
CommitLineData
7e3afbba 1%e 3000
2%p 8000
3%n 2000
4%k 2000
5%a 3000
6%o 2000
7BW [ ]
8EW [ .,:;!?_]
9ES [.:;!?]
10VO [aeiouy]
11CO [bcdfghjklmnpqrstvwxz]
12CC [cdfgjklmnprtz]
13SC [cg]
14HC [bdfhjklmnpqrstvwxz]
15ST [pbtdkg]
16LE [a-zA-Z]
17
18%{
19
20 /* English to australian translator */
21
22 /* to build with standard at&t lex
23 * lex aust.l
24 * cc lex.yy.c -ll -o aust
25 *
26 * to build with flex
27 * flex -I aust.l
28 * cc lex.yy.c -o aust
29 *
30 * (flex is a pd version of lex that runs under Unix, VMS and MSDOS.)
31 */
32
33 /* 16Jan90 - wb - first version, based on biffa.l by
34 * Stephen K Mulrine <smulrine@cs.strath.ac.uk> */
35 /* 30Jan90 - wb - added more words */
36 /* 16Feb90 - wb - converted from jive to aust */
37 /* 12Mar90 - wb - added some randomness */
38
39
40 /* BW = begin word */
41 /* EW = end word */
42 /* ES = end sentence */
43 /* VO = vowel */
44 /* CO = consonant */
45 /* CC = end of consonant cluster */
46 /* SC = soft consonant (need an 'e') */
47 /* HC = hard consonant (does not need an 'e') */
48 /* ST = stop */
49 /* LE = any letter */
50
51bloody(n)
52int n;
53{
54 if (n == 0 || rand() < n)
55 printf((rand() < 20000)? "bloody ": "bleedin' ");
56}
57
58say(msg, n)
59char *msg;
60int n;
61{
62 if (rand() < n)
63 printf("%s", msg);
64}
65
66oi(n)
67int n;
68{
69 say(" Blimey!", n);
70 while (rand() < n)
71 printf(" OI!");
72}
73
74
75%}
76
77%%
78"That is" |
79"That's" printf("Thaz");
80"that is" |
81"that's" printf("thaz");
82bathroom |
83toilet printf("loo");
84{BW}john{EW} printf("%cloo%c", yytext[0], yytext[5]);
85[Aa]lright printf("%clrighty", yytext[0]);
86{BW}mad{EW} printf("%cpissed%c", yytext[0], yytext[4]);
87angry |
88annoyed printf("pissed");
89drunk printf("loaded");
90drank printf("swilled");
91drink printf("swill");
92{BW}beer printf("%cFoster's", yytext[0]); /* Australian for beer, mate */
93"ught to" printf("ughta");
94{BW}train printf("%cland train", yytext[0]);
95ough{EW} printf("o%c", yytext[4]);
96Hello{EW} |
97"Good day"{EW} printf("G'day!");
98hello{EW} |
99"good day"{EW} printf("g'day!");
100"in Austrailia" |
101"to Austrailia" printf("down under");
102{BW}bit{EW} printf("%ctad%c", yytext[0], yytext[4]);
103
104{CO}{CC}{EW} printf("%c'%c", yytext[0], yytext[2]);
105{CO}{CC}ed{EW} printf("%c%s", yytext[0], yytext+2);
106of{EW} printf("o'%c", yytext[2]);
107
108Some{BW}one |
109Someone |
110Guy printf("Dude");
111some{BW}one |
112someone |
113guy printf("dude");
114
115[Ww]ha printf("%co", yytext[0]);
116{BW}esp printf("'sp");
117{BW}Esp printf("'Sp");
118
119{BW}h{LE} printf("%c'%c", yytext[0], yytext[2]);
120off{BW}of printf("offa");
121
122[Yy]our printf("%cer", yytext[0]);
123you{EW} printf("ya%c", yytext[3]);
124my printf("me");
125
126{CO}[ai]{SC}e printf("%coi%ce", yytext[0], yytext[2]);
127{CO}[ai]{HC}e printf("%coi%c", yytext[0], yytext[2]);
128{CO}[ai]{CO}[aiouy] printf("%coi%c%c", yytext[0], yytext[2], yytext[3]);
129r[ai]{CO}{CO} printf("%coi%c%c", yytext[0], yytext[2], yytext[3]);
130{CO}igh{LE} printf("%coi%c", yytext[0], yytext[4]);
131extremely |
132really |
133very printf("roit");
134Extremely |
135Really |
136Very printf("Roit");
137that printf("wot");
138Well printf("Welp");
139baseball |
140football |
141hockey printf("cricket");
142{VO}th({EW}|{VO}) printf("%ct%c", yytext[0], yytext[3]);
143Who printf("Oo");
144{BW}who printf("%c'oo", yytext[0]);
145{LE}{CO}er{EW} printf("%c%ca%c", yytext[0], yytext[1], yytext[4]);
146{VO}{CO}e{BW}to printf("%c%ceda", yytext[0], yytext[1]);
147{VO}{CO}{BW}to printf("%c%c%ca", yytext[0], yytext[1], yytext[1]);
148{BW}[Bb]e{CO}{LE} printf("%c'%s", yytext[0], yytext+3);
149{BW}[Aa]{CO}{LE} printf("%c'%s", yytext[0], yytext+2);
150{BW}[Oo]ne? printf("%c'un", yytext[0]);
151
152{LE}\, {ECHO; say(" moit,", 10000);}
153{BW}an?{EW} {if(rand()<12000){printf(" a ");bloody(0);}else printf("%s",yytext);}
154An?{EW} {if(rand()<12000){printf("A ");bloody(0);}else printf("%s",yytext);}
155(T|({BW}t))he{EW} |
156(T|({BW}t))hose{EW} {ECHO; bloody(12000);}
157
158\!|\? {say(", moit", 6000); ECHO; oi(12000);}
159\. {say(", moit", 2000); ECHO; oi(6000);}
160
161{BW}-*[0-9]+" "*("degrees"|([Ff]{LE}*)){EW} {printf("%c%dc%c",*yytext,((atoi(yytext+1)-24)/9)*5,yytext[strlen(yytext)-1]);}
162
163. printf("%s", yytext);
164\n printf("\n");
165
166%%
167main()
168{
169 yylex();
170}
171
This page took 0.018813 seconds and 4 git commands to generate.