New Version of ECX

Leif Salomonsson has just released a new version of the Amiga E compiler, ECX.

ECX is an E Compiler written from scratch in E, it supports 68020+FPU and PowerPC CPUs, AmigaOS3, MorphOS and (experimental) AmigaOS4 operating systems. High source as well as binary compatibility, together with many improvements over previous implementations of the language.

The new version is 2.1.0 and you can download it from the ECX web site. You can read the changes in the 2.1.0 readme here..

Mozilla Labs Bespin and Jetpack

jetpackIn the first half of this decade I was working as a web developer and really enjoyed it. I mainly used Microsoft ASP at that time. Sadly the company I worked for was slowly getting out of the web business as new management stepped in and after surviving many lay-offs, I finally fell victim. This left a bad taste in my mouth about web programming and I now have a position where I don’t do much web at all. I’ve done some XHTML here and there, but for the most part I have stayed away from it.

So the other day I was browsing programming news and ran across news about Jetpack from Mozilla Labs. I thought, hmmm….that sounds cool, what is it? I followed the link to the Jetpack site and read up. From the site: “In short, Jetpack is an API for allowing you to write Firefox add-ons using the web technologies you already know.” I read comments about it being like Grease Monkey, but it is a little more than that. Not only can you enhance the web site, but the FireFox browser itself. Jetpack allows you to use Javascript, HTML and CSS to do this. That is very cool!

While going through the Jetpack tutorial I was editing code in the browser. I had Firebug running, so I used it to find out how this was possible. The code said Bespin. After researching this I found out that Bespin was an experimental code editor that worked inside the browser and was launched months ago. How I missed the launch of that I have no idea! This baby is in it’s infancy also, but wow, what potential! Check out the video and play with it yourself at the official Bespin web site. It is using javascript for the front end and it is fast! I love it and I can’t wait for them to improve it further. You can play with Bespin by registering at the web site, but you can also download the code and install it locally. But you will need to build it. All that information is found in the Bespin developer’s guide.

I found these two projects so awesome that I forgot all about the web programming funk I was in. I want to follow and work with these two projects more! They help put the fun back into the web!

DeafGrandma program in PortablE

I have been using small programming exercises from a book about another language and coding them in PortablE. One of the programs was called DeafGrandma. I thought it sounded fun, so I chose it to code. This is a simple program, but you can learn some valuable things you will be using over and over. First, here is the description of what they wanted the program to do.

Write a Deaf Grandma program. Whatever you say to grandma (whatever you type in), she should respond with HUH?! SPEAK UP, SONNY!, unless you shout it (type in all capitals). If you shout, she can hear you (or at least she thinks so) and yells back, NO, NOT SINCE 1938! You can’t stop talking to grandma until you shout BYE.

The most difficult obstacle I had writing this program was how to use E-strings. This is a special feature of the Amiga E language. I thought I understood them, but I found out I wasn’t at all sure how to compare them with each other or normal strings. For a good explanation of E-strings check out this page of the Amiga E Beginner’s Guide.
Ok, so here is the code for DeafGrandma.e


/* DeafGrandma program 5-27-09 */

PROC main()
    DEF say[80]:STRING, upperSay[80]:STRING

    REPEAT
      Print('What would you like to say to Grandma?\n')
      ReadStr(stdin,say)
      SetStr(say, EstrLen(say) - 1)

      StrCopy(upperSay, say)
      UpperStr(upperSay)		->make uppercase version of "say"

      IF StrCmp(say, upperSay) = FALSE
        Print('HUH?! SPEAK UP, SONNY!\n')
      ELSE
        Print('NO, NOT SINCE 1938!\n')
      ENDIF
    UNTIL StrCmp(say, 'BYE') = TRUE
ENDPROC

To test this just go to the command line and use PortablE to compile it first.
PortablE DeafGrandma.e
This will give you a .cpp file that you can use a c++ compiler to compile to give you an executable. Like so.
g++ DeafGrandma.cpp -o DeafGrandma
Now you can just type the name DeafGrandma to run the program. On to the code.
/* DeafGrandma program 5-27-09 */
This first line is just a comment. I wanted to show what they look like, so here is one type. I have the other type down a few lines.
PROC main()
This next line is the main procedure of our program. Every PortablE program must have a main() procedure.
DEF say[80]:STRING, upperSay[80]:STRING
Now things start getting interesting. Here we define our E-strings. We have two fixed E-strings here named say and upperSay. Both have a max length of 80.
REPEAT
This is the start of our loop. A WHILE loop could have worked in this instance, but I went with REPEAT.
Print('What would you like to say to Grandma?\n')
Of course this displays the text. The \n adds a return on the end and sends the cursor to the next line.
ReadStr(stdin,say)
SetStr(say, EstrLen(say) - 1)

The first line here is waiting for input from the keyboard or user. It places what is typed into the “say” E-string we created earlier. It also saves the return that is pressed. The next line removes this return from the E-string.
StrCopy(upperSay, say)
Basically, this copies the content of the say E-string to UpperSay.
UpperStr(upperSay) ->make uppercase version of "say"
The UpperStr() function here makes all the characters in the upperSay E-string all caps. The -> out to the side is a way to place a comment on the same line as your code.
IF StrCmp(say, upperSay) = FALSE
This is the start of your IF statement. It is using the StrCmp() function to compare the two E-Strings. This is so we can test whether someone entered something in all caps or not. Because the only way Grandma is going to hear you is by yelling using all caps. The ELSE that follows is what happens if something is typed in lower case or mixed case.
UNTIL StrCmp(say, 'BYE') = TRUE
This is the condition test of our REPEAT loop. It just tests to see if BYE is typed in all caps. If it is, the program stops right here.
Finally the ENDPROC just finishes off our main PROC() that was stated earlier.

Since this was a very small program, I thought it would be good to go through each line of the program to explain everything. Hopefully beginners will find it useful. When I first tried to write this program I tried to compare E-strings using operators like and :=. This will not work, so this is why the functions are used. I think it makes it nice and easy to read as well.

Amiga E Useful Resources

As I was coding today I realized it might be a good idea to post a list of useful resources if you are interested in programming in Amiga E. I have mentioned different items here and there in this blog, but haven’t listed a nice list in one post. I’ll try to do that here and explain if it needs to be explained.

If you are programming on an Amiga or are using WinUAE to run an Amiga environment to program in, you have many choices since Amiga E originated on the Amiga. (duh!) Besides PortablE, there is the excellent compiler ECX by Leif Salomonsson. It is still being maintained! You can find it at http://www.blubbedev.net/ecx/. There are versions for AmigaOS 4.0 and MorphOS as well.

PortablE – PortablE language and compiler
AmigaE IRC Channel – irc.freenode.net at #amigaE
Wouter’s AmigaE page – The original Amiga E web site by creator Wouter van Oortmerssen.
Beginner’s Guide to Amiga E by Jason R. Hulance
Amiga E Mailing List
Amiga E programs available at Aminet – http://aminet.net/dev/e
Amiga E at Wikipedia – http://en.wikipedia.org/wiki/AmigaE
UtilityBase – Active web site with a lot of Amiga developer information including Amiga E of course.
AmiDevCpp – nice Windows IDE with Amiga cross compilers included.

The most complete Amiga E language reference you will find is at Wouter’s Amiga E page. Just download the main archive from that site even if you are using Windows. The language reference is in AmigaGuide format. To read this in Windows go to Safalra’s web site and download WinGuide 4.0 and install it. You will then be able to open the Amiga E reference guide that Wouter provides in the main archive. This and the beginner’s guide that I mention above will be your main references while coding Amiga E.

EDIT: I have just been informed that Wouter’s guide is now available online here.

Also, if you haven’t heard, PortablE for Windows is in beta. So we will soon be able to use Amiga E in Windows.
So now that you have all of that, there is no excuse not to become an Amiga E programmer!

Emacs, Editors and Stuff

I was thinking about a primary programming editor to use to write PortablE code in Windows. There are many out there. SciTE, Vim, Crimson Editor, and Notepad++ to name a few. Notepad++ is a popular editor and has some very nice features. I hate the name though! C’mon use some imagination when you create a good editor like that! It does have a nice way to create syntax highlighting for user defined languages, which I would like to have for PortablE.

There is a programming editor for Amiga OS4 called Annotate. It already has syntax highlighting for the Amiga E language. It has a GPL license. It might be kind of cool if someone ported it to Windows. Check out more about Annotate at it’s homepage.

Being a Lisp lover, Emacs came to mind quickly. But I didn’t want a big install headache. After a bit of research I found EmacsW32. Wow, I am so glad I did! One file has everything you need to run Emacs in Windows. This includes the latest Emacs version, 23.0. I downloaded the “patched” version. It worked fine in Windows XP and Vista. So I am now using Emacs as my editor of choice.
I would eventually like to have syntax highlighting for my PortablE/Amiga E code. To do this in Emacs you need to create a mode for it. I have never done this before, but I was reading about it. You can concentrate on just creating a mode that handles the syntax highlighting and comments. This is exactly what I need. I found a tutorial about it and it didn’t look too bad, but it might be tricky. Maybe I can find the time to tackle it at some point.

Nimrod Programming Language

While reading the reddit programming section the other day I read about a new programming language named Nimrod. It looks pretty cool. I ran through the first tutorial to check it out. On Nimrod’s web site it states that Nimrod is a language which combines Lisp’s power with Python’s readability and C’s performance.

I like what it combines and thought of Amiga E since Amiga E combines three different languages, Lisp, Ada and C++. There is plenty of documentation to get you started and it sounds like a fast language. So you might check it out at the Nimrod web site.

Next Page »