alex / rply

An attempt to port David Beazley's PLY to RPython, and give it a cooler API.
BSD 3-Clause "New" or "Revised" License
381 stars 60 forks source link

Allow copying parser generators to extend them #62

Closed eddiejessup closed 6 years ago

eddiejessup commented 8 years ago

This isn't really a pull request, just thought I'd mention that I personally have this use case that I'm hacking on rply to accommodate.

I want to be able to parse sub-sets of my language at run-time. For this, I've modified the parser generator to allow a common base to be worked on. I then import this object and make new copies using copy_to_extend(). In one version, I then extend this parser generator with new productions. The messing about with production_sets is just my lazy way of ensuring that when build() is called, and the starting production is determined by looking at the first production, the first extended production appears first.

I'm not saying this sort of thing should be merged into rply, I just thought you might want to know that at least one person wants this. The project I'm working on is implementing TeX, which is a horrendous language to parse for all sorts of reasons, so maybe other people don't have this need.