Status 28 Dec 2002
Hello world Worked..
Well, a first compile...
<?
class test {
static int function Main(string[] $args ) {
echo "hello " . " world\n";
return 0;
}
}
?>
notice that it kind of resembles PHP, the Main function in C#, like C is the one that gets called when you run the program, in PHP, the global scope, and the first executable command really takes this responsibility. For the time being, this rather strange syntax for the body will remain, although Obviously exectuting the global scope as Main is probably the way to do BC code... (although you will probably have to add compiler directives like )
#namespace PHP.testing
#class test
echo "hello" . " world";
using PHP # comments as compiler directives will probably solve this...
GnuNET - that other effort...
I've had a few chats with the guys from Portable.NET/Gnu dotNET, It appears that there has already been some interest in developing a PHP compiler, and a rudimentary codebase was started. One of the major differences, other than Gnu dotNET is written in C, is that it has an abstraction layer designed to deal with the tree building that is associated with writing the compiler. This looks interesting and definitily needs examining, especially as the Gnu dotNET compiler is designed (as far as I can gather) to target Java, Parrot and .NET bytecodes..
Where the hell is that defined (or programming with GREP)
Without a cool IDE, that tells you what methods/vars etc. are available, Programming in C#, Java and the like is equivilant to fishing blindfolded.., C and PHP have similar problems, but lxr and PHP_CodeDoc, have helped to make it alot easier. Otherwise you very quickly learn to grep source code for definitions (which is not very effecient). So Partly to get a better understanding of the mono mcs compiler, and partly as a warm-up for compiler, I have made a start on making a backend for PHP_CodeDoc, that uses the cslex code (to generate PHP), and the modified jay (to generate PHP). At this point the first test runs on the design are underway.. - This uses a database backend to store the tokens, class, method and variable etc. definitions.. and does a double pass.. (it also only parses a certian amount of updated code in theory)... - the outcome of this may influnce the final decision to go fully with PHP for the compiler or stick with C#..
|