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 Synergy/DE

(DIBOL with enhancements)

Date:12/27/06
Author:Chip Camden
URL:http://chipstips.com
Comments:1
Info:http://synergex.com
Score: (2.75 in 4 votes)
.main beer99

;Synergy/DE example of 99 bottles

.align
local record
	nmbottles	,D_NATINT, 99	;Native integer, initially 99
	group msg	,a30		;The longest line in the song
	  group msg2	,a18		;The abbreviated form
	    nmalpha	,a2		;Alpha version of the number
	    msg3	,a16, " bottles of beer"
	    the_s	,a1 @msg3+7	;The "s" in "bottles"
	  endgroup
	      		,a12, " on the wall"
	endgroup
.proc
	open(1,o,"TT:")			;Open stdout on channel 1
	nmalpha = nmbottles
	repeat
	  begin
    	    writes(1, msg + ",")
	    writes(1, msg2 + ",")
	    writes(1, "take one down, pass it around,")
	    if (!(nmbottles -= 1))
	      exitloop
	    if (nmbottles == 1)
	      clear the_s
    	    nmalpha = nmbottles
	    writes(1, msg + ".")
	    writes(1, "")		;Skip a line
	  end
	writes(1, "")
	writes(1, "Hey the beer's gone ... I'm outta here.")
	stop
.end

Download Source | Write Comment

Alternative Versions

Comments

>>  Chip Camden said on 03/21/08 19:48:35

Chip Camden This example demonstrates how the COBOLish structured data in DIBOL can still be useful.

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: