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

World: r3wp

[Parse] Discussion of PARSE dialect

Oldes
19-Jan-2007
[1633x2]
Isn't this a bug?

>> b: "1234^@567" parse/all b [copy i to {^@} 1 skip b: to end] probe 
i probe b
1234
567

BUT:

>> b: "1234^@567" parse/all b [copy i to #{00} 1 skip b: to end] 
probe i probe b
1234
1234^@567
Ah... my fault, parse is not supporting binary format:(
Maxim
19-Jan-2007
[1635]
I wish it did too.  it would make some things simple a little bit.
Volker
19-Jan-2007
[1636x2]
>> b: "1234^@567" parse/all b [copy i to "^(0)" 1 skip b: to end]
== true
>> i
== "1234"
notperfect, but a way to use numbers
Oldes
28-Feb-2007
[1638x2]
how to parse such a string:
   {some.string/(a + (b.a * c()))/end} 
to get:
   ["some" "string" "(a + (b.a * c()))" "end"]
where the 'slash' can be in the paren as well (so I cannot use just 
parse str "/")
Maxim
28-Feb-2007
[1640]
here is a full script  :-) 


rebol []

paren-start: charset "("
paren-end: charset ")"
parens: union paren-start paren-end

separator: charset [#"/" #"."]
label: complement union separator parens

content: complement parens
blk: copy []

str: {some.string/(a + 1 / 2 (b.a * c()))/end}

expression: [paren-start  any [content | expression] paren-end]

parse/all str [some [ separator | here: some [label] there:  (append 
blk copy/part here there) | here:   expression there: (append blk 
copy/part here there)]]


probe blk


ask "..."
Oldes
28-Feb-2007
[1641]
Thank you Maxim:-]
Steeve
7-Mar-2007
[1642]
IIRC someone created an inference motor using parse, unfortunalty 
i'm unable to recover the sources, someone can help me ?
Graham
7-Mar-2007
[1643]
What do you mean?  Is it encapped?
Steeve
7-Mar-2007
[1644x2]
sorry ? what do you  mean by encapied ? IIRC it was running  using 
parse dialect
*encapped
Anton
7-Mar-2007
[1646x3]
You saw it before, now you can't find it, and wish for someone else 
to help.
What did it do ?
Encapping is using the rebol SDK to "compile" rebol sources into 
an executable (from which it is obviously difficult to extract the 
sources).
Steeve
7-Mar-2007
[1649x3]
the goal was to resolve rules (like described with prolog)
it's the use of an inference motor, usally
*usually
Anton
7-Mar-2007
[1652]
This one?

http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=prolog.r
Steeve
7-Mar-2007
[1653x2]
not this one
but the same goal
Anton
7-Mar-2007
[1655]
do you remember the author ?
Steeve
7-Mar-2007
[1656x4]
no sorry
i'ts verry old
rebol.org was not created yet
i mean
Anton
7-Mar-2007
[1660]
But you were not around at this time, were you ?
Steeve
7-Mar-2007
[1661x3]
i was
i'm using Rebol since 6 years at least
i made pauses
Anton
7-Mar-2007
[1664]
aha ok
Steeve
7-Mar-2007
[1665x2]
I made a pause during which I raised sheep in the French Alps
and other ecological activities
Maxim
7-Mar-2007
[1667]
and reality kicked in?
Steeve
7-Mar-2007
[1668x2]
the reality ?, i'm just a nerd, i must admit this weakness, i can't 
leave without technology
*can't live
Maxim
7-Mar-2007
[1670]
hehe not enough buttons on a sheep I guess  ;-)
Steeve
7-Mar-2007
[1671]
I tested sincerely, but to live without technology it is like living 
with the Middle Ages, one passes the three quarters of his time to 
produce his food and to make provisions for the winter .
Graham
8-Mar-2007
[1672]
that's why the stoneage was not known for it's artistic achievements
Sunanda
8-Mar-2007
[1673]
I've never heard of such a script, Steeve.

It does not seem to be on REBOLtech (a forerunner to REBOL.org). 
You could try some more detailed searches than I did if you want 
to look further
http://www.reboltech.com/library/scripts/
****

Sadly, a lot of good stuff gets published on personal websites, and 
when the enthusiasm for REBOL wanes, or the site is taken offline 
for some reason, the scripts are lost to the wider community.
sqlab
8-Mar-2007
[1674]
Steeve, you can have a look at the scripts archive

http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlYCHQ
Henrik
9-Apr-2007
[1675]
I forget whether it's possible to move backwards in the block I'm 
parsing?
Oldes
9-Apr-2007
[1676]
yes, it is
Henrik
9-Apr-2007
[1677]
... how? :-)
Oldes
9-Apr-2007
[1678]
>> firsttime?: true parse [1 2 3 4 5][any [set v integer! p: (prin 
v if all [firsttime? v = 4][p: skip p -2 firsttime?: false]) :p]]
1234345== true
Henrik
9-Apr-2007
[1679]
I'm not sure I get it. how does parse know how to deal with 'p?
Oldes
9-Apr-2007
[1680x2]
p:  gets current parse position
:p  sets new position
but it must be in documentation somewhere
Henrik
9-Apr-2007
[1682]
it does, but I still don't see it. does parse read the block at the 
end of the 'any block?