I think this is perfectly possible!
Improved: Faster compilation: Instead of tokenizer -> preprocessor -> tokenizer -> analyser ->... it's now tokenizer -> preprocessor -> analyser!
Fixed: Some bugs due to the new preprocessor
Fixed: Array bug (DIM had wrong behaviour when passed a float)
Improved: CAST2INT much faster when casting to integers (uses ~~ in JS)
Fixed: LEN() on uninitialized arrays (LOCAL arr[]; STDOUT LEN(arr[])) failed
Fixed: TYPE TGameObject; ABSTRACT FUNCTION Test:; ENDTYPE <- Failed (needed second function)
Fixed: XML parser can handle now tabs!
Fixed: DOESFILEEXIST / DOESDIREXIST function better
Improved: code cleanup
Fixed: ?IF works better (more robust, can handle NOT and much more)
Improved: Some optimizations compiler side - faster compiling (still too slow...)
Added: New Targetsystem - 100% extensible with XML files - no platform/target specific stuff is hardcoded.
Removed: ?BLACKLIST command - now configurable with XML
Improved: Compile time MUUUUUCH faster - One bootstrap (= compiles its own source code) takes 25s instead of 110s on my pc :) but still: GLBScript is not the fastest compiler...
Fixed: String prototypes in JavaScript
Improved: Ressource handling much (is not embedded into the JavaScript file -> much slimmer!)
Fixed: Really strange compiler crash (did some weird assignments to get rid of the crashes in "CreateExpression")
Fixed: DOESDIREXIST/DOESFILEEXIST returned sometimes wrong results
Added: Little HTTP Server to test your games easily
Fixed: GLOBAL myGlobal = myConstant; CONSTANT myConstant = 100 <- works now (use constants before they are defined)
Fixed: GLOBAL myGlobal = MyFunc(); FUNCTION MyFunc: .... <- works again (use of functions in GLOBAL definitions before they are defined)
Improved: Casting faster
Added: FOR i = 0 UNTIL 10 <- syntactical sugar for: FOR i = 0 TO 10 - 1, useful for things like: FOR i = 0 UNTIL LEN(MyArray[])
Fixed: Late binding with ABSTRACT methods
Added: SPRITE2MEM
Fixed: INC/DEC with floats/strings function now (INC a, 0.5 <- with out cast to integer internally)
Improved: OOP system cleaned up -> more rubust
Added: super.MyFunction() in methods.
Added: MyBaseClass(myDerivedClass) <- Casting!
Fixed: INTEGER(1)/INTEGER(2) returned in JS 0.5 instead of 0
Fixed: If FILESEEK goes beyond the file size it does not throw an error but it sets the position of the file to the last byte!
Fixed: STARTPOLY without POLYNEWSTRIP and mode = -1 works!
In the mean time I was of course spending my time on GLBScript. There are several topics I want to highlight:
Bug fixing and some other improvements!I fixed tons of bugs and did a lot of debugging. I have also rewritten the whole file management under the hood. Before every file got embedded into the JavaScript file and was put into an array. Now there is for every writable/readable file a ".GLBSCRIPT_DATA" file which contains all the bytes of your file as a string representation. This is because JS does not allow a synchronous file access with byte data, so I had to workaround this. Because of this system there is no need of the "?BLACKLIST" preprocessor command anymore, which basically said that the compiler should not embed this file.
Compiling time much improvedInitially compiling of 7000 lines of code took around 130 seconds. I optimized a lot (I even wrote my own HashMap implementation) and was fixing a lot of bottle necks. Now compiling of 7000 lines of code take around 30 seconds. Not the fastest compiler on the world, but much better than the previous time...
Target systemI have rewritten the whole target system and now it's 100% extensible without changing code. So if you want for example running GLBScript via node.js you can write your own target. GLBScript uses XML for defining the targets.
Currently the "settings.xml" looks like this:
<target name="html5" lang="js">
<template path="HTMLTEMPLATE_CONSOLE" name="GLBFile.html" mode="console" />
<template path="HTMLTEMPLATE_GRAPHICS" name="GLBFile.html" mode="2d" />
<lib path="lib.js" mode="console 2d 3d" />
<lib path="array.js" mode="console 2d 3d" />
<lib path="math.js" mode="console 2d 3d" />
<lib path="string.js" mode="console 2d 3d" />
<lib path="file.js" mode="console 2d 3d" />
<lib path="ini.js" mode="console 2d 3d" />
<lib path="2d.js" mode="2d 3d" />
<lib path="sound.js" mode="2d 3d" />
<lib path="input.js" mode="2d 3d" />
<lib path="sprite.js" mode="2d 3d" />
<lib path="collision2d.js" mode="2d 3d" />
<lib path="screen.js" mode="2d 3d" />
<extension name="exe" action="ignore" />
<extension name="png" action="ignore" />
<extension name="bmp" action="ignore" />
<extension name="tga" action="ignore" />
<extension name="jpeg" action="ignore" />
<extension name="mid" action="warning" />
<extension name="ac3" action="mp3 ogg" />
<extension name="wav" action="mp3 ogg" />
<extension name="png" action="ignore" />
<extension name="mp3" action="ogg" />
<extension name="ogg" action="mp3" />
<extension name="ddd" action="ignore" />
<extension name="ddw" action="ignore" />
<extension name="DIR_DATA" action="ignore" />
<extension name="GLBSCRIPT_DATA" action="ignore" />
<file name="GLBScript.js" action="ignore" />
<file name="GLBFile.html" action="ignore" />
<file name="GLBScript_opt.js" action="ignore" />
<file name="GLBScript_unopt.js" action="ignore" />
<file name="GLBScript_beautiful.js" action="ignore" />
<file name=".svn" action="ignore" />
<action type="embeddata" />
<action type="appbeforelibs" />
<action type="optimize" name="closure" />
<action type="save" name="GLBScript.js" />
<action type="run" command="$COMPILERDIRTools/GLBServer/GLBServer.exe '$PROJECTDIRGLBFile.html'" />
</target>
During this I also removed the definition of the built in commands (DRAWSPRITE, SETCURRENTDIR, ...) into an extra file called "Header.gbas" which basically is included into every project you compile with GLBScript.
Improved OOPNow it's much more robust and has many features. "super.myClass()" works in methods. You are able to cast between classes: "(MyClass(DerivedFromMyClass).hello". You can also define ABSTRACT methods. Quite cool I think!
Here is a little demo I've ported to GLBScript:
http://programming-with-design.at/files/GLBScript/Isometric/GLBFile.html