Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language GNUCHILL

Date:03/16/06
Author:Wilfried Moser
URL:n/a
Comments:2
Info:n/a
Score: (2.00 in 5 votes)
--
-- GNUCHILL implemtation of `99 beers on the wall' including correct
-- handling of the lyrics.
--

ninetyninebeersonthewall: MODULE

SYN maxbeersonthewall = 99;

SYNMODE beersrange = INT (0:maxbeersonthewall);
DCL beers BUFFER (1) beersrange;

countbeers: PROCESS ()
   DCL nextbottle beersrange;
   RECEIVE CASE
   (beers in howmuch):
      nextbottle := howmuch - 1
      ON
         (rangefail):
            WRITETEXT (stdout, "No more bottles of beer on the wall, no more bottles of beer.%/");
            WRITETEXT (stdout, "Go to the store and buy some more, 99 bottles of beer on the
wall.%/");
            STOP;
      END;
      WRITETEXT (stdout, "%C bottles of beer on the wall, %C bottles of beer.%/", howmuch,
howmuch);
      WRITETEXT (stdout, "Take one down and pass it around, no more bottles of beer on the
wall.%/");
      SEND beers (nextbottle);
   ESAC;
END countbeers;

DO FOR i IN beersrange;
  START countbeers (-1);
OD;

SEND beers (maxbeersonthewall);
--
-- runtime takes care for remaining processes
-- before exiting.
--
END ninetyninebeersonthewall;

Download Source | Write Comment

Alternative Versions

Comments

>>  king said on 04/06/06 17:05:16

king Ur geil.

>>  Steve Harris said on 10/14/06 00:00:06

Steve Harris I can't get this to compile using gnuchill 2.95.3

Download Source | Write Comment

Add Comment

Please provide a value for the fields Name, Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.

Please don't post large portions of code here! Use the form to submit new examples or updates instead!

Name:

eMail:

URL:

Security Code:
  
Comment: