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

World: r3wp

[Parse] Discussion of PARSE dialect

Maxim
28-Dec-2006
[1600]
like bounds checking, making sure some items are not within a specific 
area, etc.
Geomol
28-Dec-2006
[1601x3]
My largest Parse rulesets are in NicomDoc. The scripts nicomdoc.r 
and ndmath.r parse from text to rebxml format. They are 20k and 24k. 
ndrebxml2html.r parse from NicomDoc rebxml format til html, and that 
is a 28k script mostly parse rules. I once build a html dialect, 
and that was 24k.
And yes, parse is a great tool!
The html dialect can be found on the View desktop under REBOL/Public/Sites/Nicom/
Tomc
28-Dec-2006
[1604]
Max complement charset  ...  can often be used as a sort of NOT
Maxim
28-Dec-2006
[1605]
true, but that does not match many cases. obviously one can built 
NOT-A NOT-B and so one.. but man.. that gets tedious, which is not 
what parse should be.
Gregg
28-Dec-2006
[1606x2]
I'm pretty sure my biggest parser so far is the one for Qtask's iCal 
importer: ~75K, ~2,900 lines. It's growing right now, to support 
recurrence rules and timezones.
I didn't write the whole thing manually though. I bootstrapped it 
by writing an ABNF parser, marking up the RFC spec, and generating 
as much as I could from that.
Robert
29-Dec-2006
[1608]
And don't forget to take a look at Gab's compile-rule function.
Graham
29-Dec-2006
[1609]
what does Gabriele's compile-rule function do ?
Robert
29-Dec-2006
[1610]
It's an extension to PARSE so you can use things like IF etc. in 
parse rules.
Graham
29-Dec-2006
[1611]
Sounds useful.
Izkata
29-Dec-2006
[1612]
VERY useful... several times I've wanted something like that, but 
wasn't experienced enough in parse to figure something easy out...
Pekr
29-Dec-2006
[1613]
why default parse is not extended in native level to support such 
constructs as IF, to-first, thru first, etc., if many ppl find them 
usefull?
Ladislav
29-Dec-2006
[1614]
lad, maybe, but if you change the name of the variable to copy to 
you have then to change it twice in the rule.

 - right. That is a general problem of procedural programming style. 
 OTOH, the "opt skip" variant has got another problem - the "opt skip" 
 code is related only to the first alternative, which seems to me 
 like the reason why Joe doesn't like it
Maxim
29-Dec-2006
[1615]
and where is the compile-rule func?  on rebol.org?
Ladislav
29-Dec-2006
[1616]
have a look at: http://www.compkarori.com/vanilla/display/compile-rules.r

my contribution is at: http://www.compkarori.com/vanilla/display/TO%2C+THRU+And+NOT+PARSE+Rules
Graham
29-Dec-2006
[1617]
oh dear .. vanilla has died on me.  I get server error ...
Ladislav
29-Dec-2006
[1618]
strange, it works for me
Graham
29-Dec-2006
[1619]
still?
Ladislav
29-Dec-2006
[1620]
yes
Graham
29-Dec-2006
[1621x4]
I get server error still.
now that is bizarre!
unless the cookie is corrupting it somehow.
must be .. just tried IE and it works fine.
Ladislav
29-Dec-2006
[1625]
I am using Firefox 2.0.0.1
Graham
29-Dec-2006
[1626]
Me too .. but it must be a vanilla problem. Are you logged in when 
you read the page, or as guest?
Ladislav
29-Dec-2006
[1627x2]
strange - I was logged in originally, but am not now, without logging 
out...
...and I am unable to login
Graham
29-Dec-2006
[1629x2]
guess my vanilla instance is dying ...
or, I have run out of server space and so all my scripts are dying 
...
Gabriele
30-Dec-2006
[1631]
most up to date version: http://www.colellachiara.com/soft/PDFM2/compile-rules.r
Maxim
1-Jan-2007
[1632]
thanks.
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
[1649]
the goal was to resolve rules (like described with prolog)