PDA

View Full Version : Go-flavored Pascal: now with Raylib bindings



VTereshkov
27-03-2020, 02:47 PM
By replacing the heavyweight Delphi-style OOP with a much simpler method/interface model inspired by Go, I have written an extremely compact (~10000 lines) self-hosting Pascal compiler (https://github.com/vtereshkov/xdpw) for Windows. It can be viewed as an implementation of Russ Cox's thought:

"If I could export one feature of Go into other languages, it would be interfaces."

The compiler directly emits native x86 code and doesn't require any external assembler or linker. It can be easily embedded into larger software systems and used for educational purposes, e.g., as a playground for language design amateurs.

Integration (https://github.com/vtereshkov/raylib-xdpw) with the Raylib (https://www.raylib.com/) 2D/3D game development library has become the first sign of maturity for my compiler.

1549

Ñuño Martínez
30-03-2020, 11:26 AM
Cool.

Is it able to use DLL files? If so maybe it can use Allegro.pas as well...

VTereshkov
30-03-2020, 02:01 PM
Cool.

Is it able to use DLL files? If so maybe it can use Allegro.pas as well...
Surely it is able to use them, since both Windows kernel and Raylib are given as DLLs. But XD Pascal does not currently support Int64, so I cannot use Allegro.pas right now.

JernejL
01-04-2020, 06:07 AM
I've seen the compiler posted on reddit, it is impressive in its own right. What would you say is so useful in interfaces in pascal? what do they make better?

VTereshkov
01-04-2020, 09:59 AM
I've seen the compiler posted on reddit, it is impressive in its own right. What would you say is so useful in interfaces in pascal? what do they make better?
If compared to the original, non-OOP Pascal, interfaces provide virtual functions. If compared to OOP versions of Pascal like Delphi or FPC, interfaces are much simpler yet almost as powerful as the inheritance-based OOP model.