Code sample: Befunge

Befunge Inside parody logo Befunge is a synthetic language which may be useful for something one day, but I never hope to see any such day myself. The befunge interpreter starts reading the program at the upper left corner and moves toward the right, but it may be reversed with a < or sent upwards ^ and down v at will. Arithmetic operations use direct operands and a single stack that reminds me of the unix utility dc.

This program prints out the stirring lyrics of the famous camp song "99 Bottles of Beer on the Wall":

>310p0","     >"llaw eht no "v  >#v_ ^
^_210p0"--:"                 v  ,  
 :    v     " of beer"       <  :  
 -                >"selttob"00g.^ <     <
 1         >00g1-#^_$" elttob erom enO" ^
      >00g#^_$" selttob erom oN"        ^
 ^_110p0",dnuora ti ssap ,nwod eno ekaT"^
      ^             <

Return to language index.

A publication of the School of Tyrannus

Copyright © 1998-2000, The School of Tyrannus
All rights reserved