What does HackerNews think of Pegged?
A Parsing Expression Grammar (PEG) module, using the D programming language.
https://github.com/PhilippeSigaud/Pegged is a D library that generates a parser generator for you based on a grammar (string) at compile time.
https://github.com/PhilippeSigaud/Pegged
If you want to understand the compile-time techniques available in D language that are being used by the Pegged library this is a handy guide:
https://wiki.dlang.org/User:Quickfur/Compile-time_vs._compil...
An intro to one ingredient of the magic of D metaprogramming, compile-time function evaluation:
https://tour.dlang.org/tour/en/gems/compile-time-function-ev...
An example of the kind of introspection available in the D stdlib:
https://wiki.dlang.org/Finding_all_Functions_in_a_Module
This one's really cool, a library that lets you build an entire grammar of your choice and evaluate it at compile time:
https://github.com/PhilippeSigaud/Pegged
Nim's metaprogramming seems quite similar, and I sometimes wonder if perhaps it took some inspiration from D.
Everything in there listed as impractical in Go is possible in D without external tool, with just regular meta-programming:
- generating parsers from grammar https://github.com/PhilippeSigaud/Pegged
- embedding files as array of bytes:
ubyte[] = import("file.jpeg");\n
\n- protobuf files at compile-time: https://github.com/msoucy/dproto- generating tables at compile-time with CTFE
Instead of copying what works the Go leaders pretend it doesn't work.
There actually is a really powerful parser generator for D by Philippe Sigaud: https://github.com/PhilippeSigaud/Pegged It's much more pleasant to use than something like Boost Spirit.
Somewhat relatedly, D's standard library has a compile time regex engine that compiles regular expressions down at compile-time resulting in some of the fastest regular expressions in the world.