Language SNOBOL
(Produces the correct output)
Date: | 04/16/09 |
Author: | Steve Byers |
URL: | n/a |
Comments: | 0 |
Info: | n/a |
Score: | (2.93 in 14 votes) |
* Here is a little bit better implementation that produces the correct output. * It has been tested with Catspaw's SNOBOL4 interpreter. * * Author: Steve Byers * Company: EDS an HP Company * B = 99 LOOP SENTENCE1 = "?? BOTTLES OF BEER ON THE WALL, ?? BOTTLES OF BEER" SENTENCE2 = "TAKE ON AND DOWN PASS IT AROUND, ?? BOTTLES OF BEER ON THE WALL." S1 SENTENCE1 "??" = B :S(S1) S2 SENTENCE1 "BOTTLES" = EQ(B,1) "BOTTLE" :S(S2) OUTPUT = SENTENCE1 B = B - 1 EQ(B,0) :S(FINISH) SENTENCE2 "??" = B SENTENCE2 "BOTTLES" = EQ(B,1) "BOTTLE" OUTPUT = SENTENCE2 OUTPUT = " " GT(B,0) :S(LOOP) FINISH OUTPUT = "TAKE ONE DOWN AND PASS IT AROUND, NO MORE BOTTLES OF BEER ON THE WALL." OUTPUT = " " OUTPUT = "NO MORE BOTTLES OF BEER ON THE WALL, NO MORE BOTTLES OF BEER" OUTPUT = "GO TO THE STORE AND BUY SOME MORE, 99 BOTTLES OF BEER ON THE WALL." END
Download Source | Write Comment
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!
Comments