I’m sick :-(

The summer has gone and autumn has arrived — it’s terrible cold outside these days. And this has made me sick: I’ve got myself a bad throat.

I went to the University today at 8:00 in the morning as usual, but got back already at 10:00 because my head started to ache. So Thoooms and Termos had to handle our group assignment in dArkOS themselves — which they did without a problem, of course. I went home to lie down on my couch.

Some hours later, I started working on the [LaTeX][] code that will become our report for our project in dPaSS. I’ve made a pretty cool document already by teaching the listings package to highlight BETA code. I’ll post the code here at GimpsterDotCom when we’ve tested it some more.

We’re working on your mandatory project for a week now. The task is to program a calendar system using the rather strange programming language BETA. To give your a taste of how BETA looks like, take a look at this Hello World example:

Origin '~beta/basiclib/betaenv';
--- Program: Descriptor ---
(# do 'Hello World!' -> putLine; #)

That was an easy example: It declares a fragment that will be inserted into the Program slot in betaenv which is the top level in all BETA programs. BETA programs consist of a lot of fragments which are inserted into slots in other fragments.

We can complicate things a bit this way:

Origin '~beta/basiclib/betaenv';
Include '~beta/containers/list';
--- Program: Descriptor ---
(# a, b: ^Text;
   l: @List(# element:: Text #);
do 'Hello ' -> a[];
   ‘World!’ -> b[];
   a[] -> l.Append;
   b[] -> l.Append;
   l.Scan(# do current[] -> putText; #);
   newLine;
#)

This will also output Hello World! to the terminal, but this time it’s done by storing each word in a variable, putting the variables into a list, and then running through the list — of course this is only to demonstrate the way you can further-bind Scan in the List pattern. The code in (# do ... #) is executed once for each element in the list, and the current element is available in the current variable. The brackets [] indicate that we’re working with references instead of the actual objects, just like & is used in C.

Programming in BETA is a mixed blessing: there’s a lot of nice things in the language like the way you specify take a general List pattern above and makes a subtype that can only contain Text patterns, but there’s also a lot of stupid things that you have to deal with using various hacks.

Leave a comment