Skip to content

Comment on Parsing – REBOL Users Guideparent

Comments

Usually they do through a PEG library if you search for that. Lua has a nice one and Python a few ok ones. They aren't native to the language like Rebol and Perl6 though.

Yeah, I meant natively.

Oh, yea. P6, Rebol, Red...any lisp with a little work.

And Perl5. Here are two examples of grammar engines built out of perl regex...

* Regexp::Grammars - https://metacpan.org/pod/Regexp::Grammars

* Parse::RecDescent - https://metacpan.org/pod/Parse::RecDescent

Yea, not native which is what the poster ended up meaning, but I hear that one you linked from Damian Conway is great.

No external library is used in these modules just Perl5 native regex engine.

NB. I think thats also same for Parsec (built out of Haskell's parser combinators)

BTW - Damian created both of them, Regexp::Grammars was his replacement for his Parse::RecDescent.

Interesting. I didn't know they had no dependencies. Is it still considered native though since you have to import another module? Rebol & Perl6 don't require that although I'm probably grasping at straws lol. Thanks for pointing out Damian replaced Parse::RecDescent with the other one as I was reading doc on it today at work.

You can write grammars in pure Perl5 regex but it can get a bit fugly :)

Here's a (very) simple example I did in Perl5 - https://news.ycombinator.com/item?id=6895126

And here's a (nicer!) port to Rebol I also did - https://www.reddit.com/r/programming/comments/1smpa1/why_reb...

Thank you!

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.