CTFE & code generators based on PEG grammars?

Robert M. Münch robert.muench at saphirion.com
Sun Apr 7 06:58:47 UTC 2019


On 2019-04-06 20:16:14 +0000, Bastiaan Veelo said:

> On Saturday, 6 April 2019 at 12:06:22 UTC, Robert M. Münch wrote:
>> The idea is, that I can write a string (or maybe even a scope block?) 
>> in my DSL and use a CTFE grammer to transpile the code.
> 
> Are you aware of Pegged[1]? It’s for exactly that.
> 
> [1] http://code.dlang.org/packages/pegged

Yes, I'm but I didn't remember/thought about using a mixin(...) to use 
the parsed and transformed result at compiler time. Thanks.

BTW: The reference for this specific use-case is here: 
https://github.com/PhilippeSigaud/Pegged/wiki/Generating-Code

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



More information about the Digitalmars-d-learn mailing list