DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

L33t Speak

02.09.2006
| 284 views |
  • submit to reddit
        
/* $Id: leet.l,v 1.1 2003/11/15 22:38:19 rcs Exp rcs $
   flex -oleet.c leet.l; cc -oleet leet.c -lfl  */
%{
   #include<stdlib.h>
   int threshold = RAND_MAX/2;
%}

%%
(c|C)ool         printf("k3wl");
(d|D)ude         printf("d00d");
(d|D)udes        printf("d00dz");
(h|H)acker       printf("hax0r");
(f|F)ucker       printf("fux0r");
(s|S)acker       printf("sux0r");
(c|C)omputer     printf("b0x0r");
(h|H)acked       printf("hax0red");
(e|E)lite        (rand() > threshold) ? printf("l33t") : printf("31337");
(o|O)wn          printf("0wnz0r");
(p|P)orn         printf("pr0n");
mp3s             printf("mp3z");
(r|R)ock         printf("r0x0r");
(r|R)ocks        printf("r0x0rz");
" you "          (rand() > threshold) ? printf(" u ") : printf(" j00 ");
"you "           (rand() > threshold) ? printf("u ") : printf("j00 ");
" why "          printf(" y ");
"why "           printf("y ");
"are "           printf("r ");
" are "          printf(" r ");

o|O              printf("0");
l|L              printf("1");
e|E              printf("3");
a|A              (rand() > threshold) ? printf("4") : printf("@");
t|T              (rand() > threshold) ? printf("+") : printf("7");
^(f|F)           (rand() > threshold) ? printf("f") : printf("ph");
B                (rand() > threshold) ? printf("B") : printf("8");
C                (rand() > threshold) ? printf("C") : printf("(");
g                (rand() > threshold) ? printf("g") : printf("9");
s                (rand() > threshold) ? printf("$") : printf("5");

.|\n      ECHO;
%%

main() {
  yylex();
}