[OT-ish] GOTO in Euphoria;-)

new topic     » topic index » view thread      » older message » newer message

Just a bit of fun.
Counts the number of times the word goto appears in a source file.
(prints 57 if you don't supply a file, the number of gotos in itself)
If anyone's interested I'll post this laid out properly, showing some
really funky scope rules. Anyway, enjoy:


-- goto.exw: usage exw goto.exw <file>
constant togo="goto" type 
goto(integer 
goto) return 
goto=
goto end type type
goto_s(sequence
goto) return equal(
goto,
goto) end type
goto 
goto_t, 
goto_u procedure 
goto_a(
goto 
goto) 
goto_t+=
goto if 
goto then 
goto_u=
goto end if end procedure procedure 
goto_b(
goto 
goto) 
goto_u=
goto_u*
goto+1 
goto_a(
goto_u=
goto*5) end procedure function 
goto_c(
goto 
goto) 
goto_b(
goto=togo[
goto_u]) return 
goto!=-1 end function procedure 
goto_d(
goto 
goto) 
goto_u=
goto!=1 
goto_t=
goto=0 while 
goto_c(getc(
goto)) do end while close(
goto) printf(1,"%d goto \'s\n",
goto_t) end procedure procedure 
goto_x(
goto_s
goto) 
goto_d(open(
goto[length(
goto)],"r")) end procedure
goto_x(command_line())

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu