home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / alt / hackers / 1655 < prev    next >
Encoding:
Internet Message Format  |  1992-11-11  |  3.0 KB

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!netsys!agate!ames!biosci!uwm.edu!rpi!batcomputer!theory.TC.Cornell.EDU!mdw
  2. From: mdw@theory.TC.Cornell.EDU (Matt Welsh)
  3. Newsgroups: alt.hackers
  4. Subject: Here's the Chef (was Re: Yodaspeak (was TV show))
  5. Message-ID: <1992Nov11.224713.21809@tc.cornell.edu>
  6. Date: 11 Nov 92 22:47:13 GMT
  7. References: <EMERICK.92Oct28210041@csa.bu.edu> <1992Oct30.141057.1024@davidge.com> <BIANCO.92Nov11151433@crocus.cs.odu.edu>
  8. Sender: news@tc.cornell.edu
  9. Distribution: usa
  10. Organization: Cornell Theory Center
  11. Lines: 83
  12. Approved: Bork! Bork! Bork!
  13. Nntp-Posting-Host: theory.tc.cornell.edu
  14.  
  15. In article <BIANCO.92Nov11151433@crocus.cs.odu.edu> bianco@crocus.cs.odu.edu (David J. Bianco) writes:
  16. >if you could let me know where I might find other filters.
  17. >'Specially the swedish chef! 8)
  18.  
  19. Since you're all clamoring for it, I'll post my copy of the Swedish Chef
  20. lex filter "chef.x". This is the funniest lex filter I've seen so far. No
  21. I didn't write it, and if it doesn't work don't complain to me. :)
  22.  
  23. Here ya go. Just save it to 'chef.x' and execute
  24.  
  25.     lex chef.x
  26.     cc -o chef lex.yy.c -ll
  27.  
  28. Have fun!
  29. mdw
  30.  
  31. ------snip snip bork bork bork-----------
  32. %{
  33. /* chef.x - convert English on stdin to Mock Swedish on stdout
  34.  *
  35.  * The WC definition matches any word character, and the NW definition matches
  36.  * any non-word character.  Two start conditions are maintained: INW (in word)
  37.  * and NIW (not in word).  The first rule passes TeX commands without change.
  38.  *
  39.  * HISTORY
  40.  *
  41.  * Apr 15, 1992; John Hagerman: Created.
  42.  */
  43.  
  44. static int i_seen = 0;
  45. %}
  46.  
  47. WC        [A-Za-z']
  48. NW        [^A-Za-z']
  49.  
  50. %start        INW NIW
  51.  
  52. %%
  53.  
  54. \\[^ \n]+    ECHO;
  55.  
  56. {NW}        { BEGIN NIW; i_seen = 0; ECHO; }
  57. "."$        { BEGIN NIW; i_seen = 0; printf(".\nBork Bork Bork!"); }
  58.  
  59. <NIW>"bork"/{NW} ECHO;
  60. <NIW>"Bork"/{NW} ECHO;
  61.  
  62. "an"        { BEGIN INW; printf("un"); }
  63. "An"        { BEGIN INW; printf("Un"); }
  64. "au"        { BEGIN INW; printf("oo"); }
  65. "Au"        { BEGIN INW; printf("Oo"); }
  66. "a"/{WC}    { BEGIN INW; printf("e"); }
  67. "A"/{WC}    { BEGIN INW; printf("E"); }
  68. "en"/{NW}    { BEGIN INW; printf("ee"); }
  69. <INW>"ew"    { BEGIN INW; printf("oo"); }
  70. <INW>"e"/{NW}    { BEGIN INW; printf("e-a"); }
  71. <NIW>"e"    { BEGIN INW; printf("i"); }
  72. <NIW>"E"    { BEGIN INW; printf("I"); }
  73. <INW>"f"    { BEGIN INW; printf("ff"); }
  74. <INW>"ir"    { BEGIN INW; printf("ur"); }
  75. <INW>"i"    { BEGIN INW; printf(i_seen++ ? "i" : "ee"); }
  76. <INW>"ow"    { BEGIN INW; printf("oo"); }
  77. <NIW>"o"    { BEGIN INW; printf("oo"); }
  78. <NIW>"O"    { BEGIN INW; printf("Oo"); }
  79. <INW>"o"    { BEGIN INW; printf("u"); }
  80. "the"        { BEGIN INW; printf("zee"); }
  81. "The"        { BEGIN INW; printf("Zee"); }
  82. "th"/{NW}    { BEGIN INW; printf("t"); }
  83. <INW>"tion"    { BEGIN INW; printf("shun"); }
  84. <INW>"u"    { BEGIN INW; printf("oo"); }
  85. <INW>"U"    { BEGIN INW; printf("Oo"); }
  86. "v"        { BEGIN INW; printf("f"); }
  87. "V"        { BEGIN INW; printf("F"); }
  88. "w"        { BEGIN INW; printf("v"); }
  89. "W"        { BEGIN INW; printf("V"); }
  90.  
  91. .        { BEGIN INW; ECHO; }
  92. -----snip snip bork bork bork------------------
  93.  
  94. -- 
  95. Matt Welsh    mdw@tc.cornell.edu        +1 607 253 2737
  96. Systems Programmer, Cornell Theory Center
  97.   "She's like jelly roll, like sculpture!"
  98.