There's a near-OO interface in pacc.tmpl, but it's currently actually hidden from the user with names that start _pacc_. The wrapper function parse() is all right, but we need to offer more control, and perhaps a variety of different wrappers.
The thing about _pacc_parser_new() is that it has the grammar rules embedded in it. So it would have to be YY_new() (where YY is the user-supplied string). That could work. Or, could we truly have a pacc_parser_new() function that returns a generic parser object, a later method call setting the grammar to use with it? Thing is, "a grammar" carries quite a lot of baggage: a pointer to the engine() function, the return type, the number of rules...
So let's spin out the first idea.
That looks like it could work out pretty well. Let's give it a go... Yup, seems to be sorted. Now to build a feeder that uses it. Done. Fiddly, as anticipated, but it works! As far as I know this is a world first (apart from my previous proof-of-concept). If anybody's got a rooftop, I'd like to shout from it.
| [1] | Unfortunately, it's not so easy to move the evaluation code out into a separate function, as it uses the same explicit control infrastructure (goto contin; and such like) as the actual parser. Since I've claimed I'm getting the first release out in the next 10 days, I really don't have time for this at the moment! I've added it to the To Do list, though, as I think it's a great idea. |
Last updated: 2015-05-24 19:45:23 UTC
One thing pacc needs is more users. And, perhaps, one way to get more users is to reduce the friction in getting started with pacc. An obvious lubricant is packaging. Read More...
Looking at _pacc_coords(), I noticed that it seemed to have the same realloc() bug that I'd just fixed in _pacc_result(). However, the "list of arrays" trick really wasn't going to work here. Read More...