Saturday 28 June 2014

Installing Red on Raspberry Pi

The Red programming language is still in the bootstrap phase using a compiler written in Rebol 2. Rebol 2 doesn't run on ARM processors so at the moment programs for ARM computers have to be cross-compiled on an Intel computer.

The Red REPL (known as "console") is simply a Red program that sits on top of the Red runtime. The Red runtime is written in the low-level Red/System dialect and can be cross-complied for Linux running on ARM.

The source of the console program is included in the Red Github Repository. Assuming that a Rebol interpreter is available, cross-compiling the console takes a single terminal command:

     rebol -qs red.r -t Linux-ARM  runtime/console/console.red

One of the many things that I like about Red is how simple it is to compile for different targets. The output from the compiler looks like this:

-=== Red Compiler 0.4.2 ===- 

Compiling /Users/peter/VMShare/Languages/Red/runtime/console/console.red ...
...compilation time : 395 ms

Compiling to native code...
...compilation time : 20029 ms
...linking time     : 245 ms
...output file size : 618544 bytes
...output file      : /Users/peter/VMShare/Languages/Red/console

I followed the excellent advice from Milliways on the Raspberry Pi Stack Exchange and installed netatalk on my Pi. I can now connect to my Pi from my MacBook. I simply copied the compiled Red console program over to it using OS X Finder.

Red doesn't have to be installed on the Raspberry Pi, simply type its path on the command line to run it. (The Red compiler even sets the execute bit!)

Red on Raspberry Pi
Click to enlarge



Friday 27 June 2014

3 million and nth Raspberry Pi

I made up my mind to buy a Raspberry Pi after more than 3 million have been sold. As they cost less than a decent meal in Western countries, I wouldn't be at all surprised if more than 2 million of them lay idle. Mine certainly wasn't an impulse purchase but it remains to be seen whether I'll actually make good use of it.
Raspian

At the time I ordered my Raspberry Pi, I had a choice of a Model A or waiting for more Model Bs to arrive. My impatience got the better of me. After the Raspberry Pi arrived, I went out and bought a power supply and a USB hub to go with it. I borrowed the keyboard and mouse from an old desktop computer, the TV and HDMI lead from the bedroom and the USB to Ethernet converter that I have for my laptop.

Although, the Raspberry Pi foundation recommends using a powered hub, the warnings about "back feeds" in the Raspberry Pi FAQs put me off. (I probably try to get a powered hub that has been specially designed for the Raspberry Pi later on). The power supply that I bought is rated at 1v and the Model A consumed up to half of that. There is plenty left to power the keyboard, mouse and ethernet connection. I've yet to try adding a USB memory stick but I'm hopeful there will be sufficient power for one of them too.

I bought a Noobs SD Card with the Raspberry Pi so installation was easy. I backed up the Noobs card on my laptop (which thankfully has a builtin SD card slot) and simply followed the onscreen instructions. I chose to install Raspian. My Raspberry Pi was up and running in the time it takes to enjoy a good cup of coffee.


Friday 13 June 2014

Unicode Out of the Box tests

I've been helping out a little with the development of the Red language since the day It was announced. One of the things that I've done is to look into what supporting Unicode in Red would involve and what level of support should be provided in the binary distribution. As part of this, I wanted to understand the capabilities of other languages.

Rather than simply search the web and browse a few documents, I decided to put languages to the test. So I developed a set of tests that would give a more substantial indication of a language's Unicode ability with invaluable help from Anton of The Red Team.

The 25 tests have been completed in 15 languages written by members of the Rebol community, Anton and myself. (Red is heavily inspired by Rebol). 

Coming up with the tests took some work but it was interesting and I've learnt a lot in the process. Writing the code was fun though it was quite slow in the languages that I am not very familiar.

Why don't you take a look at the Unicode Out of the Box Tests?