Showing posts with label Raspberry Red. Show all posts
Showing posts with label Raspberry Red. Show all posts

Monday, 29 December 2014

Raspberry Shoes Update

I haven't written anything about Raspberry Shoes in a while. The reason is that Raspberry Shoes still feels a long, long way away.

The route that was most attractive for me was Shoes 4 which is written for JRuby and the SWT cross-platform GUI toolkit. Last time I wrote I was quite optimistic, I had JRuby working on the Raspberry Pi. Shortly before then, the Shoes 4 team announced a pre-release Gem that would have made installing Shoes quite straightforward on Raspberry Pi. However, after installing the Gem I found that the Ruby SWT Gem upon which Shoes 4 relies only installs Intel versions of SWT. It seems there isn't an official ARM version of SWT. So, for the foreseeable future, it is unlikely that Shoes 4 will run on Raspberry Pi.

As an alternative, I installed the Green Shoes Gem. Green Shoes is a version of Shoes that uses the GTK2 GUI toolkit. It didn't work and so far I haven't spent anytime trying to figure out why. That's because Green Shoes is understandably no longer maintained in the light of Shoes 4.

One option that came to mind is that I could build Raspberry Shoes by forking Green Shoes and convert it to use GTK+3 (which, in the long term, I presume will be better supported on Raspberry Pi than GTK2). However, I very much doubt that I have the necessary skill to get it done in the time I have available. (I'm confident that I could do it if I put enough time into it.)

I even had a "if you can't beat them, join them" moment and thought that perhaps taking the easy choice, Python, would be better than trying to use Ruby. Then I saw a couple of Raspberry Pi Python code snippets. They were enough to convince me that Ruby will be much easier for a child to learn.

At the moment, I am undecided on what to do. Another language which can be even easier for beginners and in which I am more fluent than Ruby will be coming to Raspberry Pi soon. The language is Red. It is very highly influenced by Rebol. It is currently at the "alpha" stage and is expected to reach "beta" stage sometime next year. 

In the meantime, I'll try to spend a little time with Ruby and GTK+3 to see if I can come up with something for our seven year-old to follow on from Hello Ruby when it eventually arrives.

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