Sunday, October 29, 2006

Hyper compiler 0.3.30 released

I've just released a new version of the compiler for Hyper. You can download it from here.

A short list of changes in this release:
  • highlighter now uses the same style as the Hyper website
  • copy constructors are now checked and auto-generated if needed
  • 'inout' is now used for parameters that used 'var'
  • the 'this' keyword is now supported in expressions
  • access specifiers in a namespace are no longer supported
And next to these changes, the compiler has been restructured internally a bit as well.

Friday, October 27, 2006

begin specification

Something that is not documented yet on the website is the begin directive. It appears on top of the source file, to indicate the entry point for that file if it is compiled as an executable. You specify the class that should be 'started', the class that contains the static procedure called `main'. This procedure will be called when the executable is run.

It's use was mandatory, but I am now making it optional in one case: when the file contains only one class. Because in that case the user's intention is obvious. This simplifies the Hello World example:
namespace Example
class Hello
static procedure main()
system.out.printLn("Hello, World!")
end
end
end
This Hello World program will change even more later. Namespaces will be removed and some module system, or a system like Java's packages will be adopted. And the function (or 'procedure') to output text to the console will probably be renamed.

Wednesday, October 18, 2006

Concatenation & pass by reference

I am wondering how I will allow strings to be concatenated. The string type currently uses the + operator for this. But I am thinking whether or not to introduce an operator especially for this purpose. I suggest the ~ (tilde) as an operator (as it's not used yet and D also uses it for concatenation). An accompanying ~= operator can be introduced for concatenating to the back of an existing string.
var s : string = "How" ~ " are " ~ "you"
# s = "How are you"
s ~= " today?"
# s = "How are you today?"
This would make an interesting syntax possible for output, like C++ has the << operator. You could have an output stream that has the operators ~ and ~=. This can make the following possible:
procedure writePoint(inout s : FileOutputStream, x & y & z : real)
s ~= s ~ '(' ~ x ~ ", " ~ y ~ ", " ~ z ~ ')'
end
It's not ideal because s is still used twice. But maybe it's a start :-)

I am also thinking about pass by value or by reference for 'in' parameters. As I wrote previously, 'in' parameters cannot be changed at all by the callee. So in my opinion it would be a nice idea to use pass by reference for this. It would make 'in' parameters fit in more, because 'inout' parameters are also passed by reference and 'out' parameters use a reference to write the result directly to the location of the caller.

Sunday, October 08, 2006

Compiler goes public!

Yesterday I put the compiler sources on my website. The compiler is finally available to everyone who wants to take a look. You can download the sources from here. The released version is 0.3.29, a release that already dates from mid-september, but was only available to some limited test audience. I got almost no feedback, so I figured I could make it already available on my website to have a larger potential of testers.

As said on the download page this is a development release so it probably has lots of bugs, and on top of that it doesn't support all 'official' language features yet. It also requires CMake to build. You will have to build it yourself from source because no precompiled binaries are available.
Another thing you need to know is that the compiler only accepts filenames in Unix format. So Windows users will have to use the compiler under Cygwin until Windows filenames are supported in some future release.

If you are a programmer, I hope you will try it and give some feedback! For information about the language, see the language reference on the website. The documentation you find there is not really complete at this time and is sometimes very brief but it will give you a start.