home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!netsys!agate!ames!biosci!uwm.edu!rpi!batcomputer!theory.TC.Cornell.EDU!mdw
- From: mdw@theory.TC.Cornell.EDU (Matt Welsh)
- Newsgroups: alt.hackers
- Subject: Here's the Chef (was Re: Yodaspeak (was TV show))
- Message-ID: <1992Nov11.224713.21809@tc.cornell.edu>
- Date: 11 Nov 92 22:47:13 GMT
- References: <EMERICK.92Oct28210041@csa.bu.edu> <1992Oct30.141057.1024@davidge.com> <BIANCO.92Nov11151433@crocus.cs.odu.edu>
- Sender: news@tc.cornell.edu
- Distribution: usa
- Organization: Cornell Theory Center
- Lines: 83
- Approved: Bork! Bork! Bork!
- Nntp-Posting-Host: theory.tc.cornell.edu
-
- In article <BIANCO.92Nov11151433@crocus.cs.odu.edu> bianco@crocus.cs.odu.edu (David J. Bianco) writes:
- >if you could let me know where I might find other filters.
- >'Specially the swedish chef! 8)
-
- Since you're all clamoring for it, I'll post my copy of the Swedish Chef
- lex filter "chef.x". This is the funniest lex filter I've seen so far. No
- I didn't write it, and if it doesn't work don't complain to me. :)
-
- Here ya go. Just save it to 'chef.x' and execute
-
- lex chef.x
- cc -o chef lex.yy.c -ll
-
- Have fun!
- mdw
-
- ------snip snip bork bork bork-----------
- %{
- /* chef.x - convert English on stdin to Mock Swedish on stdout
- *
- * The WC definition matches any word character, and the NW definition matches
- * any non-word character. Two start conditions are maintained: INW (in word)
- * and NIW (not in word). The first rule passes TeX commands without change.
- *
- * HISTORY
- *
- * Apr 15, 1992; John Hagerman: Created.
- */
-
- static int i_seen = 0;
- %}
-
- WC [A-Za-z']
- NW [^A-Za-z']
-
- %start INW NIW
-
- %%
-
- \\[^ \n]+ ECHO;
-
- {NW} { BEGIN NIW; i_seen = 0; ECHO; }
- "."$ { BEGIN NIW; i_seen = 0; printf(".\nBork Bork Bork!"); }
-
- <NIW>"bork"/{NW} ECHO;
- <NIW>"Bork"/{NW} ECHO;
-
- "an" { BEGIN INW; printf("un"); }
- "An" { BEGIN INW; printf("Un"); }
- "au" { BEGIN INW; printf("oo"); }
- "Au" { BEGIN INW; printf("Oo"); }
- "a"/{WC} { BEGIN INW; printf("e"); }
- "A"/{WC} { BEGIN INW; printf("E"); }
- "en"/{NW} { BEGIN INW; printf("ee"); }
- <INW>"ew" { BEGIN INW; printf("oo"); }
- <INW>"e"/{NW} { BEGIN INW; printf("e-a"); }
- <NIW>"e" { BEGIN INW; printf("i"); }
- <NIW>"E" { BEGIN INW; printf("I"); }
- <INW>"f" { BEGIN INW; printf("ff"); }
- <INW>"ir" { BEGIN INW; printf("ur"); }
- <INW>"i" { BEGIN INW; printf(i_seen++ ? "i" : "ee"); }
- <INW>"ow" { BEGIN INW; printf("oo"); }
- <NIW>"o" { BEGIN INW; printf("oo"); }
- <NIW>"O" { BEGIN INW; printf("Oo"); }
- <INW>"o" { BEGIN INW; printf("u"); }
- "the" { BEGIN INW; printf("zee"); }
- "The" { BEGIN INW; printf("Zee"); }
- "th"/{NW} { BEGIN INW; printf("t"); }
- <INW>"tion" { BEGIN INW; printf("shun"); }
- <INW>"u" { BEGIN INW; printf("oo"); }
- <INW>"U" { BEGIN INW; printf("Oo"); }
- "v" { BEGIN INW; printf("f"); }
- "V" { BEGIN INW; printf("F"); }
- "w" { BEGIN INW; printf("v"); }
- "W" { BEGIN INW; printf("V"); }
-
- . { BEGIN INW; ECHO; }
- -----snip snip bork bork bork------------------
-
- --
- Matt Welsh mdw@tc.cornell.edu +1 607 253 2737
- Systems Programmer, Cornell Theory Center
- "She's like jelly roll, like sculpture!"
-