HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
dlang-community
Pegged
D2014–2023
dlang-community / Pegged

Pegged

A Parsing Expression Grammar (PEG) module, using the D programming language.

11Distinct people
11Mentions
0Explicit recommenders
548GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A Parsing Expression Grammar (PEG) module, using the D programming language.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year11 dated mentions

Observed mentions: 2014-02-24 22:46:57 UTC to 2023-06-19 21:06:43 UTC.

0122014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20142015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20182019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2023

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC202
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC000
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC000
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC101
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC101
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC101
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC202
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC211
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC000
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC202

What Hacker News says

11 sources
This is the intended purpose of the feature. gzip may be a little aggressive given that you have to unzip it again at the other end but its very possible (and potentially not even as expensive as one might expect given that these types of compression algorithms can be tuned on a speed/size tradeoff and backoff when struggling to compress). https://github.com/PhilippeSigaud/Pegged is a D library that generates a parser generator for you based on a grammar (string) at compile time.
In C++17’s useful features for embedded systems
No. I was pretty naive in my initial attempts. I tried for many months to make Laurence Tratt's Algorithm 2 (see https://tratt.net/laurie/research/pubs/html/tratt__direct_le... ) work, but ultimately I failed. I recall running into some problem with my implementation of Tratt's idea that led me to conclude that his Algorithm 2 doesn't work as stated. My reasoning is buried in a git commit message from many months ago - I'd have to go look it up. My takeaway from Tratt's explanation was that the general technique of growing the seed bottom-up style when in left-recursion - I think I've also seen that idea termed "recursive ascent" somewhere else but I can't place it offhand - seemed reasonable, so that's what I kept working on until I figured out something that seemed to work. Later on, I ran across https://github.com/PhilippeSigaud/Pegged
Read the rest
/wiki/Left-Recursion, which describes Sergio Medeiros' technique at a high level. One of the nice things I used from the Pegged project was the unit test suite. I re-implemented some of the unit tests from Pegged in my own PEG implementation and discovered that it failed at those unit tests. It took me another number of months to figure out why my implementation failed the unit tests. I re-jiggered my implementation to make it handle the scenarios captured by those unit tests, and then naively thought "hey, it works!"... All was well until I ran across another set of unit tests in the Autumn PEG parser (see https://github.com/norswap/autumn). My implementation failed some of those as well. After another number of months, I had a fix for those too. Long long long story short, this process continued until I couldn't find any more unit tests that my implementation would fail, so once again I'm at the point where I think "well, I think it works". There have been a number of occasions where I've thought "if this doesn't work, I'm just going to re-implement Pegged in Crystal!". Perhaps that's what I should've done. Ha ha! In a few months, when I find another test case that breaks my implementation, I may just do that. We'll see. I hope it doesn't come to that. Fingers crossed. :-)
In Ask HN: What interesting problems are you working on?
I'm just happy that D was mentioned. Yay, D! Also, D's metaprogramming is an utter joy, almost lisp-like, without the craziness of C++ templates. Give it a try! 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.
In Why Zig When There Is Already CPP, D, and Rust? (2017)
> https://groups.google.com/forum/#!msg/golang-dev/ZTD1qtpruA8... 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"); - 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.
In Channels Are Not Enough
> Everyone uses regexes; using a lexer generator should (in my opinion) be as easy as using a one-off regex. I think the key is to make the lexer generator an embeddable library like regex libraries are. 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.
In Facebook Open Sources flint, a C++ linter written in D

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.