How an Engineering Company Chose to Migrate to D

Ecstatic Coder ecstatic.coder at gmail.com
Thu Jun 28 08:43:22 UTC 2018


>> IMHO, implementing a EP-to-D source code converter was 
>> probably more risky than simply extending an existing Pascal 
>> Compiler in that case.
>
> Risc is in the eye of the beholder ;-)
>

Indeed :)

But that doesn't mean I'm completely wrong.

I also enjoy A LOT implementing minimalistic transpilers using 
the most simplistic code possible, because implementing manual 
tokenization and a parsing using only "baby code" is really all 
that's needed for my small DSLs.

My Github account is literally full of them ;)

So yes, implementing transpilers is incredibly fun and easy.

But implementing full blown compilers too actually.

And the advantage of compilers which generate assembly code is 
that you don't have to fight with the unavoidable limitations of 
the high-level target language.

For instance I've implemented my first "true" compiler in Basic 
when I was 13 years old, in order to implement my first 3D 
renderer and game for my C64 (a simple 3D wireframe tank game 
using a custom 2x4 pixel charset for rendering), as I quickly 
found out that it was actually much faster and easier to 
implement it in a minimalistic basic-like language with 
integrated fixed point and pointer arithmetic converted into 6502 
machine language, than to implement the game directly in 6502 
assembler.

So if at one moment you hit a wall with the transpiling approach, 
you should consider trusting me if I say that implementing an EP 
compiler which emits IL code could actually be just a matter of 
months.

Look at the code of this tutorial, which shows how to implement a 
very limited closure-based language (i.e. with local functions 
and variable) in C using just Flex and Bison :

https://github.com/senselogic/COMPILER_TUTORIAL

It was implemented in just a few days, and if you check by 
yourself, you will see that it's 100% baby code...

So if you change your mind and decide to implement your own 
extended EP compiler (i.e. with additional modern features), you 
could be astonished by the number of passionate developers who 
could also be interested in this "modern object Pascal" project...

That's the approach they've had for Crystal, and so far it's 
worked quite well for them...





More information about the Digitalmars-d-announce mailing list