Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 Bragging; small s.c.r.i.p.t.
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message

PostPosted: Thu Aug 08, 2013 3:22 am   Post subject: Bragging; small s.c.r.i.p.t.

A Single Character Read Interpret Programming Toyol.

Way fun.

It could very well be simply that I'm old, but programming in OpenCOBOL is fun. You should try it.

But first, apt-get install open-cobol and configure make a small s.c.r.i.p.t. interpreter. Complete and correct 99 bottles of beer in 238 characters.

I'm behind in documentation, working on it today, adding fetch to immediate and store new source tape location, effectively a bf(**) goto. As an esoteric programming language, it is kinda supposed to be hard, but it's nice when certain constructs are just there, so squiggly bracket false blocks went in too, and a trick for easing text template programming.

Done bragging now.


(**)bf is a shortform name for an infamous turing tarpit, named with a swear. I try not to in formal documentation, as it's COBOL I'm trying to advocate for, but anyway, bf is fun, and tedious. The idea though (actually from P", as well as bf) is brilliant. There are a lot of derivatives, and I just added to the pile. small s.c.r.i.p.t. is bf, cat, Forth and COBOL, so, you know, what can go wrong?

PostPosted: Thu Aug 08, 2013 10:56 pm   Post subject: RE:Bragging; small s.c.r.i.p.t.

Very impressive. That's certainly worth bragging about.

If you have any interest in the hardware side of things, I can't help but think that this would make a great electronics project. I'm picturing a handheld device with an LCD screen and a knob for menus and character entry, powered by a microcontroller or even better, an FPGA that implemets a custom-built CPU that runs your language natively. Maybe it's an idea for the hardware guys. As far as geeky "toyols" go, that would be hard to beat.

PostPosted: Tue Aug 13, 2013 3:38 am   Post subject: Re: Bragging; small s.c.r.i.p.t.

Thanks chris, it is pretty fun.

Tonight I'm trying to decide if small s.c.r.i.p.t. should assist or let programmers hang when using source tape store (goto).

It'd be pretty easy to scan from current position to new location and unwind any loops, strings, calls, comment blocks etc, so that coders had a safety net, but as I type this, I'm thinking nah, let 'em hang, it's an esolang.

More bragging
With the new 0.6.2, false blocks and goto, 99 bottles is down to 190 bytes.


:S-{3!}s+;:Z{no3!}#;:BbottleS of beer;:Oon the wall;:Mmore;099+[# B O\, # B\.
Take one down and pass it around\, -Z B O\.10.
]No M B O\, no M B\.
Go to the store and buy some M4\, 99 B O\.

Describing the first colon definition of S. When S is evaluated, instead of echoing it runs the colon definition instead.


In this case, subtract one from current memory cell with -, enter the false block if (and only if) the current cell is zero with the open brace, in which case the value used to be 1, and we don't want to pluralize the word "bottle" so set the source tape position up 3 characters to the +. It's safe to jump past the end of a false block as there is nothing to unwind, the closing brace is really only a marker used to skip over the block on non-zero. If the value wasn't one (subtracted for the zero test), then we print the small 's' (all undefined characters are echoed) which then hits the plus and puts the test value back to where it was. Semicolon tells small s.c.r.i.p.t. to return from the current colon def (S) which is back into the B definition to display the ' of beer' part. Fun toyol.

Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to: