Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Peppa PEG – An Ultra Lightweight PEG Parser in ANSI C
7 points by soasme on Feb 21, 2021 | hide | past | favorite | 5 comments
After reading the [PEG Parsers series] written by Guido van Rossum, I started thinking writing a PEG Parser in ANSI C. Here are the reasons:

- It's FUN. I've made several parser libraries, such as JSON, Mustache, Markdown, and I think I can take the challenge now.

- I haven't had any opportunity to work on an Open Source project written in ANSI C.

- Having a PEG parser in ANSI C can benefit whoever is developing a parser, as adding C bindings for other programming languages are not too difficult.

And after SIX months' development, my project is now kinda feature complete. It's named Peppa PEG and you can find it here:

https://github.com/soasme/PeppaPEG

I have learned quite a lot during the journey of creating it, such as gdb, valgrind, cmake, etc. And I wouldn't make it to the end without learning from some awesome projects, such as pest.rs, cJSON, etc.

Appreciate any feedbacks! Thank you!

[PEG Parsers series]: https://medium.com/@gvanrossum_83706/peg-parsers-7ed72462f97c




Author here.

This is the link to the project:

https://github.com/soasme/PeppaPEG

I've also compiled the C tricks I used when developing Peppa PEG.

https://soasme.medium.com/the-c-tricks-i-used-when-developin...


Nice README and examples.

Notes: This seems like a “Show HN” post, you might want to title it that way. The inclusion guard of json.h is P4_LANG_MUSTACHE_H, might not be what you want.


Nice catch! The typo is now fixed. And I have added 'Show HN' prefix.

The README is a little bit verbose but I hope it's not too boring. :)


How about a peppa.h to generate a parser for the PEG syntax - like in the comments of the other examples - so users can define parsers in a natural way?


This is a wonderful idea. I'll add it to the roadmap!




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: