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

World: r3wp

[Dialects] Questions about how to create dialects

Gabriele
27-Feb-2009
[326]
We already had a long discussion about the "security problems" and 
I still strongly disagree that there's any more security problems 
than having DO in REBOL has.
BrianH
28-Feb-2009
[327x5]
I'm not saying that I don't support the addition of a DO operation, 
just that it has security implications. I already added DO to the 
Parse Proposals long ago. Here it is: http://www.rebol.net/wiki/Parse_Project#DO
There is more semantic detail in the new DO Parse Proposal than there 
was in your original Parse REP. Being more specific about binding 
issues and error handling deals with most of the security implications. 
This makes the operation *exactly* as secure as DO, and not less 
so. You can even sandbox the data using the same methods you would 
use to sandbox DO in R3.
It also makes the data *exactly* as difficult to sandbox in R2 as 
it is to sandbox R2 DO code :(
I'm working on the sandboxing in the R2-Forward project though.
I don't have to tell *you* how difficult it is to sandbox DO dialect 
code, Gabriele: You've already done half the work :)
Janko
3-Mar-2009
[332x2]
can I ask how did Chris make in his dialect so that set-words are 
used >>a: [ id: ]<< .. how do I parse this, this for example doesn't 
work >>parse a [ 'id: ]<< , any Idea? :)
make = made
Henrik
3-Mar-2009
[334]
remove the '.
Janko
3-Mar-2009
[335x2]
It doesn't seem to work >>parse a [ id: ]<<
or did you mean something else?
Henrik
3-Mar-2009
[337]
I'm not sure what you mean. Do you want to parse set-words?
Janko
3-Mar-2009
[338]
yes, I saw this in Chris's  validation lib " Defining a good dialect 
(simple, short, efficient) isn't an easy task. Chris did some work 
about such form validation dialect in QM. See http://www.rebol.org/documentation.r?script=filtered-import.r
" (on this url)
Henrik
3-Mar-2009
[339x2]
I think I get it. You can't use the set-word directly, as it's used 
to store the current location in the parsed block.
you can always check for any set-word!, but I don't know how you 
would check for a specific set-word!.
Janko
3-Mar-2009
[341x2]
from his dialect: 

name: string! is not within ["Carl"]
age: integer! is between [18 65]
start-date: date! is after 30-April-2007
yes, basically in this case I am not looking for specific set-word 
but taking it as value .. I will try that
kib2
3-Mar-2009
[343]
I'm just starting to play with dialects : it's really a pleasure 
to play with.
Henrik
3-Mar-2009
[344]
set key set-word! (key: to-word key)

is how he does it.
Janko
3-Mar-2009
[345x2]
aha this words yes

>> a: [ id: ]
== [id:]
>> parse a [ set ttt set-word! ( print ttt ) ]
id
== true
:) thanks a lot
Henrik
3-Mar-2009
[347]
a variant on that would be:

parse a [ttt: set-word! (print ttt/1)]
Janko
3-Mar-2009
[348x2]
you solved my problem and it looks much better in Chris's style.. 
thanks to both

this is now:
	id: required and integer

 name: optional "janko" check ( either current == "janko" [ "can't 
 be janko" ] [ none ] )
	vatnum: optional "11ss" and int
	website: optional "123" and int do ( current: current + 1000 )
	phone: optional "NO" calc ( join "oh-" current )
	adress: optional ""

this was before:

	id required and integer .

 name optional "janko" check ( either current == "janko" [ "can't 
 be janko" ] [ none ] ) .
	vatnum optional "11ss" and int .
	website optional "123" and int do ( current: current + 1000 ) .
	phone optional "NO" calc ( join "oh-" current ) .
	adress optional "" .
kib2: yes, and they are technically very easy to make... I always 
thought it's soma magical process :)
Henrik
3-Mar-2009
[350]
Start layering multiple dialects and then you'll see some real power 
:-)
Janko
3-Mar-2009
[351]
I am still at mostly basic dialecting rules, but even this is very 
interesting and a lot can be made
Oldes
3-Mar-2009
[352]
I'm still waiting who will be the first to write Rebol like interpreter 
as a dialect:)
Janko
3-Mar-2009
[353x2]
has anyone made a dialect that would make some basic or typical sqlite 
? (so I won't be reinventing if not necesarry)
Oldes: making something like pypy in rebol rebreb maybe would probably 
not take so many years :)
Henrik
3-Mar-2009
[355]
Last year I created a small database which I wanted to talk to via 
a dialect. So I created a builder dialect that would build the database 
command dialect in two sets, one for server side for query handling 
and one for client side for response handling, so 3 dialects.

Then I would build client- and server-apps using a make-file like 
dialect which preprocesses and builds apps and uploads them to specific 
locations. 4 dialects. Great amount of control. Very little code.
Janko
3-Mar-2009
[356x2]
( pypy is python interpreter in python )
Henrik: very interesting
btiffin
3-Mar-2009
[358]
Janko; you may know this; dobeash.com has RebDB as well as a SQLite 
driver.   RebGUI with RebDB ...  livin'   :)
Janko
3-Mar-2009
[359]
btiffin :)  yes I use their sqlite driver and it works great , haven't 
tried rebdb or regbui yet
Chris
4-Mar-2009
[360]
Though not included in the rebol.org submission (it's in QM), I actually 
have two data matching dialects that use the same validation vocabulary 
(in both cases, set-words are the anchor to each rule).


 import [this "1"] [this: integer! is 1] ; import extracts name/value 
 pairs

 match [1][this: integer! | decimal! is 1] ; match evaluates a free-form 
 dialect


Both have different basic expressions, yet use exactly the same validation 
code.
MaxV
24-Aug-2009
[361]
VID:   How I can change button color? I tried:
view layout [ a: button red [  a/color: 0.0.0
        show a]
    ]

but nothing happens....
Pekr
24-Aug-2009
[362x2]
yeah, typical problem ....
IIRC, button colors are being held elsewhere. I don't remember if 
there were introduced accessor functions for them, or not ... let 
me see ...
Sunanda
24-Aug-2009
[364]
Color in a button is a graduated effect.

Take  a look at:
    a/effect
and then try changing it something like:
    a/effect/3: 0.0.0

(It ought to be easier!)
MaxV
24-Aug-2009
[365]
Thank you, I'll try and let you now!
Cheers!
Henrik
24-Aug-2009
[366]
yes, it ought to be easier. the color of the button is a hardwired 
effect that is calculated upon initialization of the button. when 
initialized, it can't be changed easily without knowing the source 
code for the button style.
Pekr
24-Aug-2009
[367x2]
>> view layout [b: button "OK" red [probe b/effect]]
[gradient 0x-1 255.32.32 223.0.0]


I think that you might be able to change those tuple values, but 
will it work with gradient easily? :-)
>> view layout [b: btn "OK" red [probe b/effect]]
[colorize 255.0.0 128 extend 14]
Henrik
24-Aug-2009
[369]
you need to check feel/redraw to make sure the effect is not overwritten 
by it
MaxV
24-Aug-2009
[370]
If I put 
b/effect: [ gradient  0x-1  0.255.0 0.255.0]
??
Pekr
24-Aug-2009
[371x3]
MaxV - to study it further, you can type following in console - print 
mold get-style 'button
Should work, remember to call show b in you code ...
also remember, there are two button versions - button, and btn - 
slightly different. You might also be interested to look into RebGUI 
VID alternative ...
MaxV
24-Aug-2009
[374]
Yes, yes. 

I'm trying to write a italian guide to Rebol, but now it's coming 
R3, and VID will be changed significantly., so I use Rebol just for 
the programs I need. 

I think that Rebol is what a programmer really needs, but finding 
guides about it is so difficult...
Pekr
24-Aug-2009
[375]
>> view layout [b: button "OK" red [probe reduce [b/color b/font/colors 
b/effect]]]

[255.0.0 [255.255.255 255.180.75] [gradient 0x-1 255.32.32 223.0.0]]