J-F-Liu / pom

PEG parser combinators using operator overloading without macros.
MIT License
496 stars 30 forks source link

Recursive parser #52

Closed DukeofStars closed 1 year ago

DukeofStars commented 1 year ago

Currently if you want to write a parser that can contain itself, as far as I can tell, you can't. eg.

fn expr<'a>() -> Parser<'a, u8, Expr> {
    number() | (sym(b'(')  * expr() - sym(b')'))   
}

This fails with "thread 'main' has overflowed its stack".

DukeofStars commented 1 year ago

Never mind, I discovered the call() method