r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Parse] Discussion of PARSE dialect

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
[4487x4]
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.
The BREAK/return proposal was proposed before Carl added the RETURN 
paren option, which makes BREAK/return unnecessary.
Pekr
13-Oct-2009
[4491]
OK, so we are almost done with parse, right?  (As I don't expect 
Carl changing his mind about the deferred proposals, at least not 
for 3.0)
BrianH
13-Oct-2009
[4492]
The only still-missing proposals that aren't easy or efficient to 
work around are OF and REVERSE. They will be missed if not included. 
Unfortunately, the same reasons why they will be hard to work arond 
if missing, are the reasons why they would be difficult to implement 
:(
Pekr
13-Oct-2009
[4493]
btw - what is the outcome of so called - complementing? Will we get 
it enhanced, so that we can use it even with Unicode? I noticed Carl 
said that complements could be enhanced ....
BrianH
13-Oct-2009
[4494x2]
I expect that PARSE release features will be done in a89 - the rest 
will be bug fixes.
One of the bitset! bugs was fixed in a88, but complementing is yet 
to come. It will probably be the using a bit for a flag method.
Pekr
13-Oct-2009
[4496]
Shouldn't be such enhancement part of the proposal doc? (just in 
order to have it documented :-)
BrianH
13-Oct-2009
[4497]
Yes, it should. Care to add it?
Pekr
13-Oct-2009
[4498]
I can add it, just not sure I would describe it precisely :-)
Pekr
14-Oct-2009
[4499]
Carl asks about the usability of Until proposal - if not answered/defined, 
it will not be part of 3.0 -  http://www.rebol.net/r3blogs/0271.html
BrianH
14-Oct-2009
[4500]
Did an initial answer, but Ladislav really needs to expand on it.
Pekr
14-Oct-2009
[4501x3]
hmmm ....http://www.rebol.net/r3blogs/0272.html
Interesting how Carl asks for naming convention opinion, there was 
no single vote for 'loop, yet such word was chosen ;-) http://www.rebol.net/r3blogs/0273.html
We have one hour to decide, if we want 'loop being renamed to 'while 
....
Graham
14-Oct-2009
[4504]
Tim Berners-Lee is quoted today to say that he can't think of a good 
reason to keep the // in http://, and that if he did it again, he 
would have done without them.  I wonder if he spoke to people who 
write parsers ....