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

World: r3wp

[REBOL Syntax] Discussions about REBOL syntax

PeterWood
13-Feb-2012
[1]
The purpose of this group is for discussion about REBOL syntax.
Ladislav
14-Feb-2012
[2x4]
Thank you, Peter. It is of note, that some (including myself) might 
prefer to use the "interpreter dialect naming convention", which 
gives it the LOAD dialect name...
The code is currently placed at:

    https://github.com/rebolsource/rebol-syntax
The main goal (but surely not the sole goal) to have a formal specification 
of REBOL syntax.
Contributions: code, examples, bugs, etc. welcome from everybody
Geomol
14-Feb-2012
[6]
The existing (implemented) syntax of R2/R3, or the desired syntax?
Ladislav
14-Feb-2012
[7x2]
We do not need to be too limited, currently the source is R3 specific, 
but I do intend to put in also R2, and the inclusion of other alternatives 
may be a worthy enterprise as well.
(just thinking how to optimally handle the alternatives, though)
Dockimbel
14-Feb-2012
[9]
Thanks Ladislav, useful initiative.
Maxim
14-Feb-2012
[10x2]
could we add a rule which joins all the higher-order rules into a 
single rule which can ultimately tell if a  script is compliant to 
the whole syntax.r rule?
dang, I just discovered thousand separators within numbers!
Ladislav
14-Feb-2012
[12]
could we add a rule which joins
 - that rule already exists, can you guess which one it is?
Maxim
14-Feb-2012
[13]
if you mean value-syntax... actually no it doesn't  :-)   but this 
does (in current implementation of file)

rebol-syntax: [
	some [
		comment-syntax
		| value-syntax
		| whitespace
	]
]
Ladislav
14-Feb-2012
[14x2]
that is called IMPLICIT-BLOCK and is there
(slightly different than your code)
Maxim
14-Feb-2012
[16]
ah.. hehe my browser had an old version of the rules... did a page 
refresh and there it was   ;-)
Steeve
14-Feb-2012
[17]
Ladislav, I see what you did there ;-)
Tuples:
Each number is 3 digit max
Leading and trailing zeros are optional 
.0. == 0.0.0
Maxim
14-Feb-2012
[18]
actually, the rule should load the digits and fail if the integer 
it represents is higher than 255.
Steeve
14-Feb-2012
[19]
yes but it's hard to do it without code evaluation.
Same remarks apply to integer! and decimal! datatypes.
Andreas
14-Feb-2012
[20x2]
We are aiming for a purely syntactic description. So semantic checks 
at a later stage are out of the picture for now (no action blocks 
in general, and here: no loading of digits in particular).
But basic accuracy is important :)
Ladislav
14-Feb-2012
[22]
Yes, 1000.1000.1000 is recognized as a tuple. The fact that it is 
"too big" is another check.
Andreas
14-Feb-2012
[23x2]
So ".0." should be recognised as valid, that's important. ".1234." 
being invalid, not so much.
(Same for integer and decimal overflows, as Steeve already remarked.)
Steeve
14-Feb-2012
[25]
tuple-syntax: [0 3 digit #"." 1 3 digit #"." 0 7 [1 3 digit #"."] 
and termination]

I know there is still the need to check the overflow but I think 
it's slightly better than using some or any digits
Andreas
14-Feb-2012
[26x3]
No need to check overflow, as stated above.
But it has to match syntactically valid tuples :)
The above would fail for "0000..", no?
Steeve
14-Feb-2012
[29x2]
no, but it would fail another cases. I forgot the last number
tuple-syntax: [0 3 digit #"." 1 3 digit #"." 0 7 [1 3 digit #"."] 
0 3 digit and termination]
Andreas
14-Feb-2012
[31]
Still fails for {0000..}.
Steeve
14-Feb-2012
[32x2]
to get rid of the 3-digit enforcement:

tuple-syntax: [any digit #"." some digit #"." 0 7 [some digit #"."] 
any digit and termination]
wait...
Andreas
14-Feb-2012
[34]
0..0
 :)
Steeve
14-Feb-2012
[35x4]
yep
replace some by any
But but... it's not only the leading and trailing zeros that can 
be removed.
It takes me time......
So the initial implementation of ladislav was right from the start
Ladislav
14-Feb-2012
[39]
adding the termination is needed, though
Steeve
14-Feb-2012
[40x4]
let me try again :-)
the only requested digit is the second  one.
.0.... is valid
or/and the first one
0..... is valid
.0..... is valid
Ladislav
14-Feb-2012
[44]
aha, did not check the second one, needs a correction, then
Steeve
14-Feb-2012
[45x2]
tuple-syntax: [[some digit 2 9 [#"." any digit] | #"." some digit 
1 8 [#"." any digit] ] and termination]
should be better
Ladislav
14-Feb-2012
[47]
OK
Steeve
14-Feb-2012
[48]
Fiouuuu.... that one was hard :-)
Endo
14-Feb-2012
[49]
Well.. may be silly question, but can I use those parse magics in 
my projects? I didn't see license information.
Andreas
14-Feb-2012
[50]
A very good question. No license attached, yet. We'll fix that.