World: r3wp
[Parse] Discussion of PARSE dialect
older newer | first last |
BrianH 6-Oct-2009 [4440] | The discussion was primarily in the comments of the relevant tickets in CureCode, though there was some in R3 chat. Not recently. |
Pekr 6-Oct-2009 [4441] | If parse was already rewritten from the ground-up, couldn't it be directly adapted to allow streamed parsing? :-) You said it could be added later, when rewrite happens, so ... |
BrianH 6-Oct-2009 [4442] | Yeah, but by "later" I meant after 3.0 comes out. I haven't even discussed with Carl what would be involved yet. |
Pekr 6-Oct-2009 [4443] | ok |
BrianH 6-Oct-2009 [4444x2] | I want to write more port code first and refine the model based on what I learn. |
Plus, Carl's rewrite didn't change the basic algorithm of PARSE, just some details. I don't yet know whether my port PARSE is that easy. | |
Maxim 7-Oct-2009 [4446x2] | even with a complement bit, if you use a few chained union's & complements, etc, you'll eventually need to bake it... in the end, all the complement bit is usefull for is to keep the charset to below half the maximum size of the complete encoding. |
(which is still pretty big AFAICT) | |
BrianH 12-Oct-2009 [4448] | Behavior of BREAK, ANY and SOME decided, finally: http://www.rebol.net/r3blogs/0270.html |
Steeve 12-Oct-2009 [4449x2] | Yesssss, the return of BREAK !!!! |
i definitly didn't love the previous way to exit from a loop | |
BrianH 12-Oct-2009 [4451] | And it's finally break from a loop, rather than break from a block (supposedly). |
Maxim 12-Oct-2009 [4452x3] | is it just me or Carl is sidestepping the n BREAK proposal? |
or BREAK/depth n in case of a call within a loop. | |
(loop in a function, not parse) | |
BrianH 12-Oct-2009 [4455] | Yes, that's unlikely to be implemented. He says it doesn't fit in with the rest. Same with n FAIL. |
Maxim 12-Oct-2009 [4456x2] | but its a hell of a powerfull addition to parse and to general code control. I don't see why Carl can't see any use for it. |
being able to drop from foreach [foreach [foreach [....]]] in one call is sooo usefull soo often. | |
BrianH 12-Oct-2009 [4458] | That proposal was only for PARSE, not for function loops. |
Maxim 12-Oct-2009 [4459x2] | I know, but its as usefull within code. |
within parse its a great optimisation for in-line parsing. | |
BrianH 12-Oct-2009 [4461] | And you can do that with CATCH. |
Steeve 12-Oct-2009 [4462] | yep, and for functions, you still got THROW/CATCH and RETURN, which are enough to my mind. |
Maxim 12-Oct-2009 [4463] | n break allows you to tell the parser that you DON'T want any backtracking. its a way to optimize rules for speed, if nothing else. |
Steeve 12-Oct-2009 [4464] | that's an optimization I agree, but all the proposals are the same, optimizations. |
BrianH 12-Oct-2009 [4465] | The BREAK, THROW, RETURN, EXIT, HALT and QUIT functions are implemented the same way, just with different error codes. |
Maxim 12-Oct-2009 [4466x2] | obviously n BREAK can be simulated using longer, non-recursive rules. |
but n BREAK allows us to leverage smaller rules reuse, as if they where large complex rules and still benefit from the same speed of a root rule backtrack. | |
BrianH 12-Oct-2009 [4468] | I think that Carl is trying to balance speed, ease of use, and debugability. In practice n BREAK would be tricky to debug, and doesn't actually reflect what PARSE does internally. Apparently PARSE isn't actually recursive descent - it just fakes it with a state machine. |
Maxim 12-Oct-2009 [4469] | yeah, maybe its just really hard to implement based on the parse algorythm... so not worth the time to implement. |
BrianH 12-Oct-2009 [4470] | Plus, it makes the code flow really tricky to understand. You aren't doing your later maintainer of your code any favors (even if it's you). |
Pekr 12-Oct-2009 [4471] | I am not sure why "to end" attempted several times does not fail? Simply put - if you put any rule, it consumes the input, so I would expect, that once at the end of th input = the rule was matches, second call of "to end" should fail, no? It does not correspond to "to "abc"", which called consecutively would try to find ANOTHER match for "abc", not just the same. I don't see a reason, why "to end" should have an exception. It should imo definitely cause termination. |
BrianH 12-Oct-2009 [4472x3] | Because you can't through the end, not even with THRU END. And once you reach the end, END always succeeds. |
And TO "abc" will also continue to succeed, matching the same "abc" every time. THRU "abc" skips past the "abc" like you say. | |
you can't -> you can't go | |
Pekr 13-Oct-2009 [4475] | Are parse enhancements over, or do we get some other? |
BrianH 13-Oct-2009 [4476] | Well, a89 isn't out yet (when last I checked). Beyond that, it depends on how Carl reacts to the recent blog on the parse plans. |
Pekr 13-Oct-2009 [4477] | So according to his doc, we should get BREAK/RETURN and DO? |
BrianH 13-Oct-2009 [4478] | We don't need BREAK/return anymore, but he can reuse the code he used to implement the RETURN paren operation. I hope we get DO, but Carl was iffy since few were puushing for it. Gabriele's been silent, which is weird since it was his idea. |
Pekr 13-Oct-2009 [4479x2] | Carl should not judge upon his own usage of some features ... |
But generally - the level of feedback is lower and lower. We need to get R3 into beta with requested features in few months, as we are starting to loose ppl being interested ... | |
BrianH 13-Oct-2009 [4481x2] | Um, yeah, but he should about OF (as ALL). What he wanted to do with OF was important. |
The level of feedback? It's been a discussion. When it comes to PARSE, the discussion has pretty-much resolved itself., | |
Pekr 13-Oct-2009 [4483] | Yes, that one might be missed. Dunno why he wants to remove it. Also LIMIT would be nice to have ... |
BrianH 13-Oct-2009 [4484] | He is wary of adding it because he knows how difficult it would be to implement it. LIMIT too :( |
Pekr 13-Oct-2009 [4485x2] | well, otoh we lived without OF for so long. I think it can be done in a conventional (recent) way :-) I think that Carl should dedicate few more days to finish parse and move on to Extensions :-) |
... because that is the way to release host code ... | |
BrianH 13-Oct-2009 [4487x3] | The conventional way has exponential overhead. |
All PARSE needs is a few final decisions. I expect that it won't be too difficult to do the rest, at least the rest that won't be put off. | |
The DO operation was proposed 5 years ago, before R3's change in the behavior of DO/next. The new DO/next is much better suited to the parse workarounds than the old DO/next was. We can thus do without the DO operation if need be. | |
older newer | first last |