Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I am wondering how it compares to rust-peg[1]. I am currently using it and the syntax is very nice. At first look it seems to be more verbose to use Nom.. Is it much faster then rust-peg, though?

[1] https://github.com/kevinmehall/rust-peg



I do not know if it is faster, I should add it to the benchmarks :)

The biggest difference here is the use of a syntax extension to parse the grammar. This is something I would like to do at some point, because it can make the code nicer. Right now, macros are good, because you can use nom directly without Rust 1.0, no need for feature gates.


That'd be nice.. i am currently contemplating to move or not. Nom does run on Rust stable, right? Although i find rust-peg super easy to use, i don't like that it's only working on nightly. A difference in performance would be another reason to switch over.. or not.. :)

Anyway, thanks for this great project!


Nom works on stable, but there are nice things you can do if you use the nightly, like matching on error codes with slice or box patterns ( https://github.com/Geal/nom/wiki/Error-management#with-slice... ) or use no_std to embed the parser as a C library ( https://github.com/Geal/nom_in_c ).


You shouldn't need no_std specifically to embed in C anymore.


That's nice to know, thanks!


Any time. Basically, one the runtime was removed[1], this became true.

1: Of course, all programming languages have runtimes, but once we got down to C or C++ levels of runtime, that is.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

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

Search: