r/C_Programming Feb 19 '21

Header only Parsing Expression Grammars (PEG) runtime engine for C Project

https://github.com/gilzoide/pega-texto
9 Upvotes

View all comments

2

u/jonahharris Feb 20 '21

This is not only useful, but a pretty cool implementation as well.

2

u/gilzoide Feb 20 '21

Thanks!

I found that making expressions be literals without having to call functions and mallocing them at runtime made everything A LOT simpler, and a little faster as a bonus. Everytime I simplify some code design/implementation I get this same feeling that "now that's a lot better, why was I even complicating this?" xD

It still lacks some stuff like being able to optionally specify the string size or pass a preallocated buffer to avoid heap allocation, but is pretty usable right now ^^

Loving this header only design of libraries, like stb and sokol