Language Cool
Date: | 04/20/05 |
Author: | Kirsten Chevalier |
URL: | n/a |
Comments: | 1 |
Info: | http://www.cs.berkeley.edu/~aiken/cool/ |
Score: | (3.00 in 3 votes) |
-- Cool, a language used for teaching compilers -- http://www.cs.berkeley.edu/~aiken/cool/ -- By Kirsten Chevalier -- krc AT cs DOT berkeley DOT edu class Beer inherits IO { numberOfBeers : Int <- 99; song () : Object { if (numberOfBeers = 0) then out_string("Time to buy more beer!\n") else { out_int(numberOfBeers); out_string(" bottles of beer on the wall,\n"); out_int(numberOfBeers); out_string(" bottles of beer\nTake one down, pass it around\n"); out_int(numberOfBeers); out_string(" bottles of beer on the wall.\n"); numberOfBeers <- numberOfBeers - 1; song(); } fi }; }; class Main { main () : Object { (new Beer).song() }; };
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
Constantin++ said on 08/29/07 21:19:36
cool ^^