Note to mods: If this is on the wrong board, feel free to move it.
OpenDarkBASIC is a re-implementation of the DBPro compiler built on top of
LLVM. The initial goal of this project is to be a drop-in replacement for
DBPCompiler.exe with full support for the existing DBPro SDK and language. If we do our jobs, you should not notice any difference!
@dga has laid all of the ground work for interfacing with the original DBPro DLLs. As of this writing, OpenDarkBASIC is able to produce executables that use the existing DBPro engine. We aim to be backwards compatible with all existing DBPro projects.
It is a cross compiler, meaning, it it is possible to run the compiler on either Windows/Mac/Linux, and compile executables for Windows/Mac/Linux/Web (in theory). Because the DBPro DLLs only work on Windows, it'll be necessary, as a secondary goal, to add a new cross-platform SDK to support a modern graphics API so you can write games for all operating systems. Work on this has not yet been started, aside from some very primitive plugins for printing hello world.
Features
Cross Platform support
Compatible with the original DBPro language
Helpful error and warning messages
Optimizing compiler
Plugin framework for extending the language with new commands
Comes with an editor
In particular, I want to highlight the two main selling points of this project: Error messages and optimizations. A ton of work is being put into generating useful error messages. Example:
var1 = 5
pos# = 3.5
var1 = pos# + var1
print var1
DBPro will happily compile this code and print
8. As most hopefully know, 5+3.5 is NOT 8.
OpenDarkBASIC will also compile this and print 8, but it will output some warning messages:
As you can see, it's warning you that the result of
pos#+var1 is being converted into an integer. You can expect this kind of quality for all types of warnings and errors.
Optimizations: If you were to look at the disassembly of that code produced by the DBPro compiler, it would be longer than the height of your screen. The DBPro compiler may produce machine code but it does a terrible job at it.
OpenDarkBASIC is very different in this regard. Because we are using LLVM, we have access to the last 40 years of compiler optimization research. Here is the compiled code of OpenDarkBASIC, with and without optimizations:
As you can see, it's managed to delete all variables and call
print directly with the value of "8".
What this means is: If you have written algorithms in in DBP such as pathfinding, collision code, or physics, chances are OpenDarkBASIC will be able to optimize them as efficiently as it would C or C++ code.
Progress
It's still in pre-alpha stage at this point and there is a lot to do. The good news is, it is clear how to do it. Here is an overview of the progress:
DBPro Language Support
-
Command calls and plugin support
-
#constant statements
-
Variables
-
Assignments
-
Binary and Unary Operators
- -
Arithmetic operators (+-*/^ mod)
- -
Bitwise operators (<< >> || && ~~ ..)
- -
Logical operators (< <= > >= <> or and xor not)
- -
Increment/Decrement
-
Scope specifiers (Global/Local)
-
Functions
--
Standard functions
--
Polymorphic functions
--
Local/Global functions
--
Nested functions
--
Default arguments
--
Cross-file function calls
-
Subroutines
-
Arrays
-
User-Defined Types (UDTs)
-
For-Loops, While-Loops, Repeat-Loops, Infinite-Loops
-
If-Then statements
-
Goto
-
Select/Case statements
Extended Language Support
-
Matrix types and operators
-
Vector types and operators
-
Quaternion types and operators
-
Imaginary number types and operators
Compiler internals
-
Plugin loader
- -
DBPro core command support
- -
DBPro licensed plugin support
- -
Command cache
-
Code generation
- -
Start and stop DBPro engine
- -
Call DBPro commands
ODB SDK
Editor
DBPCompiler.exe wrapper
Downloads
Coming soon!