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

World: r3wp

[Parse] Discussion of PARSE dialect

Maxim
16-Jun-2009
[3920]
yes it goes one past the end. it does not stop AT the end.
BrianH
16-Jun-2009
[3921]
end has no length, so to end and thru end mean the same thing.
PeterWood
16-Jun-2009
[3922]
I guess you could answer that end is past the end of the input. But 
the behavior seems inconsistent:

>> parse "123456789" [thru "8" "9" end
]
== true

>> parse "123456789" [thru "9" end]
  
== true
>> parse "123456789" [thru end]
        
== false
Maxim
16-Jun-2009
[3923]
but brian, skipping past the end, still puts you at the end of the 
series, but the parser know you tried to go beyond the end... ITs 
the thru wich is failing, cause it knows you are trying to go beyond 
the end.
PeterWood
16-Jun-2009
[3924]
It's different in R3 :-)

>> parse "123456789" [thru end]

== true
Maxim
16-Jun-2009
[3925]
thru consumes the end word, and then detects that, as a result, it 
would put you beyond the end.  
really, its quite logical.  


but in practically, thru shouldn't complain.... cause as you say, 
in this specific context, thru and to really do mean the same end.
PeterWood
16-Jun-2009
[3926]
I prefer the R3 behaviour. I really hope that it doesn't change.
BrianH
16-Jun-2009
[3927]
I'll make sure of that, Peter.
PeterWood
16-Jun-2009
[3928]
Thanks.
Ladislav
16-Jun-2009
[3929]
yes, Peter, I am sure R3 behaviour is correct
BrianH
23-Jun-2009
[3930x2]
In R2:

>> parse/all { X X  XX X X} [(prin 'a) some [(prin 'b) "X" (prin 
'c) [(prin 'd) "X" (prin 'e) | (prin 'f) skip (prin 'g)] (prin 'h) 
| (prin 'i) skip (prin 'j)] (prin 'k)]
abijbcdfghbcdfghbijbcdehbijbcdfghbcdfijbik== true

In R3:

>> parse/all { X X  XX X X} [(prin 'a) some [(prin 'b) "X" (prin 
'c) [(prin 'd) "X" (prin 'e) | (prin 'f) skip (prin 'g)] (prin 'h) 
| (prin 'i) skip (prin 'j)] (prin 'k)]
abijbcdfghbcdfghbijbcdehbijbcdfghbcdfijk== true


In both cases the fij near the end should should be fgh - a bug in 
PARSE.
Never mind, I missed that the last X is at the end of the string. 
No bugs.
shadwolf
30-Jun-2009
[3932x2]
the more i try to understand parse the less i understand it
i want to try to make a tutorial about parse but my knowledge of 
it is poor 

 so as we have a wiki we could start a project to write a documentation 
  with the goal to make people understand what is the interrest of 
 parse
Sunanda
30-Jun-2009
[3934]
Parse question on stackoverflow (unanswered as yet:)

http://stackoverflow.com/questions/1060727/rebol-parse-dealing-with-whitespace-and-copy-var
BrianH
30-Jun-2009
[3935]
Answered :)
Sunanda
30-Jun-2009
[3936]
Fast!
shadwolf
30-Jun-2009
[3937]
http://www.rebolfrance.info/articles/allaboutparse
documentation to put all what we want to now about parse
BrianH
30-Jun-2009
[3938]
There's also a lot of documentation about parse's behavior (in theory) 
at the beginning of the Parse Proposals page on DocBase.
shadwolf
30-Jun-2009
[3939]
BrianH yea but that's really too light you can't expect people gaining 
Guru level in parse with so poor documentation ... I want to know 
all about parse and i want that knowledge to be sahred
BrianH
30-Jun-2009
[3940x2]
Alas, to know all about parse you have to go to the guru level. To 
know enough to get by, you don't :)
Code like that example above with all the (prin) calls can help a 
lot wiith understanding parse though.
Sunanda
30-Jun-2009
[3942]
What would be useful would be a parse cookbook.....HowTo questions 
with sample answers.

That way, we could build up a set of carefully graded examples of 
putting parse to work.
shadwolf
30-Jun-2009
[3943x4]
sunanda that's what i have in mind
but not only ...
first you give the basic you say what is parse you eplain how you 
can use it and then for the very hl part of the documentation you 
have examples working or not and answers from gurus explaining what 
 you missed in your implementation
sunanda look the page i submited if you have any comments
Maxim
30-Jun-2009
[3947]
parse is a part of rebol which needs a complete book to be written 
about it.   To go from zero to hero it could easily span 100 or more 
pages.
shadwolf
30-Jun-2009
[3948]
Maxim i agree lets do it :P
Maxim
30-Jun-2009
[3949]
to me parse is something that is useless until you understand it.... 
at which point, you are a guru.   There is no real middle ground, 
which is the problem.
shadwolf
30-Jun-2009
[3950]
but really i have a thousand projects in mind and i'm locked because 
of  my parse low knowlege i can add things to existing parse rules 
 but building a rule or a dialect from scratch is impossible for 
me
Pekr
30-Jun-2009
[3951x2]
parse just needs to implement suggested refinements to make it more 
easy to use ...
I am able to parse what I need, am far from guru, but I still find 
parse usefull. I would not be able to write single regexp line ....
shadwolf
30-Jun-2009
[3953]
Maxim if people will know how to explain parse in ten years of existance 
it will be done already but nothing goes against trying and in the 
end the result can be surprising
BrianH
30-Jun-2009
[3954]
One of the best ways to learn is to try to figure out enough to teach 
others :)
shadwolf
30-Jun-2009
[3955x7]
Pekr if you saw viva-rebol code you could see parse will be usefull 
for the function click and go  part

instead of the weak actual solution base  on  either any [ find ...] 
]
as area-tc is base on parse to draw on screen having a better understanding 
of parse would lead to the creation of a all purpose ritch text rendering 
widget using an adapated dialect
but i'm amased  some years ago rebol was all about eep computing 
simple by creating dialects addapted to your needs. But in reality 
parse is so compexe that this aspect of rebol is from far one of 
the less used ....
and in my opinion we are missing really something ... That's the 
kind of thing carl found so easy to use that he never though about 
creating a complete documentaton on it
at least that's my opinion ... I always delayed this kind of project 
I was expecting someone to do it 
But time passed and no complete documentation emerged.
i started writing the documentation and organising the plan of the 
document and how i see things organised.

all comments or adding to this document are welcome.
I recall the URL: http://www.rebolfrance.info/articles/allaboutparse
Graham
30-Jun-2009
[3962]
there is  a section on parse in the wikibook .. you could add to 
that...
shadwolf
30-Jun-2009
[3963x7]
graham .. wiki is for R3 since R2 and R3  are not the same it's better 
to not mix them. We can build the  documentation prototype on french 
wiki and then upload it with adaptations to unicode and other R3 
parse new things... to R3 wiki.


I prefere using french wiki because it's wide open no need to fill 
a form and log to be granted as a reader and in my mind this have 
to be the most open wide possible.
as a writer lol ofcourse ...
but yes that will be a need to be on wiki R3 .. but before talking 
on what is not official can we talk about what is official and already 
wait for us to use it since so many years ?
graham even if from taht wor then you write a book on parse and become 
billionare I won't be annoyed by that hahaha (if that's the case 
I and the other writers would gladly appreciate you to send us a 
plane to ticket to visit you graham :P)
any people that want to explain what he understoud from parse should 
be able to write it somewhere and have other people contribute to 
it well in my particular case that will end fast lol i'm not a parse 
guru i'm just a rebol coder willing to understand parse and use it 
the more often possible in all my projects.
i recognise i have been lazy and skipping the pain to understand 
parse too much time...
we can live without parse yes .... but then we have post from Carl 
saying that the rebol community is coding in rebol like they could 
code in any other language and skippping the most part of interrest 
of coding in rebol... and yes i'm not against that remark that's 
completly true. what interrest me is how can we promote the use of 
parse and how can we give back to parse use and dialects conception 
the  central place they deserve ?