I am currently (whenever not updating Box2D or ViewGUI) developing a precompiler in VB.net to allow the use of OOP in DBP.
Currently, the precompiler takes in two parts: The class definitions and the actual code.
Here is a small demonstration of what it will do:
Class definition:
class MyRandomClass
Value as Integer
Name as Byte
endclass
Source:
MyVariable as myrandomclaSS
MyVariable2 as myrandomclaSS
do
MyVariable2.Value = MyVariable.Value + MyVariable.Name
loop
Output:
MyVariable as integer : myvariable = alloc zeroed(5)
MyVariable2 as integer : myvariable2 = alloc zeroed(5)
do
poke integer myvariable2+0, peek integer(myvariable+0) + peek byte(myvariable+4)
loop
I have tried to keep the syntax the same as DBP as much as possible (Case insensitive, endclass as one word, no 'dim' before a member, etc.
Currently, the precompiler can't even do as much as UDTs (members can only be of the standard types), but eventually I hope to expand the functionality to inherited classes, function members and arrays in classes.
This was partially inspired by Milkman's attempt at an OOP precompiler, which was sadly never finished