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

Henrik
13-Jun-2008
[276]
well, first I'd build the skeleton for the dialect for parsing a 
single line. then I might add some actions to it and then expand 
it to handle multiple lines.
Brock
13-Jun-2008
[277x3]
The first line of the volleyball page http://www.wnmu.edu/athletic/stats/07vb/29wnmu.htm#GAME.PLY
, the line starting 1-0,  _might_  be represented by the following 
keystrokes...
s43a23b50
So, 

s = set attempt, 4 = player Cola Svec, 3 = set attempt level 3 - 
perfect set

a = attack attempt, 2 = player Jeri Walkowiak, 3 = attack attempt 
level 3 - kill

b = block attempt, 5 = player Jessica Lindgren, 0 = block attempt 
level 0 - error
I might need to add a team designator like H = Home, V = visitor 
as it could be complicated to catch live play and may need to establish 
which team inorder to correctly identify a player.  I may also need 
to use a separator between each keystroke if I want to identify the 
player by jersey number.
I will need to start playing with this to see if I can come up with 
something and then maybe get some feedback on my attempts.  I don't 
know when I would get to this but thought I'd through it out there.
BrianH
13-Jun-2008
[280]
If this is typing in real time, space would be the best seperator,
eFishAnt
23-Jun-2008
[281x4]
anyone know how to parse this:
{<table><table></table><tr></tr></table>}
It is a table with an empty table inside, and also a Table-Cell
for some reason, using recursion...I just can't seem to put my finger 
on the right combo.
Chris
23-Jun-2008
[285]
What's the goal?
eFishAnt
23-Jun-2008
[286x5]
parse rules that will give a true if parse/all {<table><table></table><tr></tr></table>} 
RULES
(using recursion)
like  Tables: [Table Tables | Table]
Table: ["<table>" Content "</table>"]
...and so forth.
Chris
23-Jun-2008
[291]
rule: use [table row][
	row: [<tr> </tr>]
	table: [<table> any [table | row] </table>]
	[table]
]
eFishAnt
23-Jun-2008
[292]
As Robert de Niro said in one of my favorite movies of all time, 
"Analyze This"  "...hey, you...you're good!"
Chris
4-Aug-2008
[293x3]
rfc: I have a (not so) little function that attempts to match a block 
of values to a given specification.  Example:

	>> probe match [%image.png :red 300x100 /old][
	[	file: file! | url!
	[	size: opt pair!
	[	attributes: any get-word! | refinement!
	[	]
	make object! [
		file: %image.png
		size: 300x100
		attributes: [:red /old]
	]


There's not much to the rules, they are -- one (default), opt (zero 
or one), any (zero or many), some (many).  If they don't match, they 
return an error.  Any suggestions?  Optimizations?

	http://www.ross-gill.com/r/match.r
Ways of making it smaller???
One of the desired effects is precedence, for example:

	match [http://rebol.com%image.png][
		link: file! | url!
		image: file! | url!
	]

Returns:

	[link: http://rebol.comimage: %image.png]
Gabriele
4-Aug-2008
[296]
I do something like that, but text based, in QML. not sure if it 
can be of any help.
Alan
14-Sep-2008
[297]
.
Robert
25-Feb-2009
[298x4]
What's the best approach to support normal Rebol things like FOREACH, 
IF, ANY, ALL and set-words, get-words within a dialect? I don't want 
to write Rebol parse rules for this.
Example: parse XYZ mydialect

XYZ: [
	repeat x 1 14 [
		a: get-point x 7
		set-point 7 x (a * 2)
	]
]
]
get-point and set-point are the dialect things. The rest should be 
normal rebol.
Is there a best practice how to get Rebol control structure support 
into dialects?
Janko
25-Feb-2009
[302]
but isn't this just a regular rebol code block then .. a: get-point 
x 7 and set-point looks like a normal rebol func too?
Robert
25-Feb-2009
[303]
Just assume that get-point and set-point is done via a dialect.
Janko
25-Feb-2009
[304]
aha, I would also like to know if that is possible .. I still haven't 
figured out how they do ( some code ) in parse
Gregg
25-Feb-2009
[305x2]
Use Gab's compile-rules module.
Gab = Gabriele
BrianH
25-Feb-2009
[307x3]
Robert, if you don't want to use parse rules you might try DO/next. 
Don't use DO/next (or Gabriele's compile-rules) if your dialect data 
can come from an untrusted source - use parse rules and dialect operations 
that call the REBOL functions if necessary.
But *only* the REBOL functions that you want to support and can do 
so safely.
You can't make that restriction with DO/next or Gabriele's compile-rules 
without a sandbox - hard to do in R2.
Oldes
25-Feb-2009
[310x2]
Check out the source of the R2's layout function.
?? layout
Brian: I think, that Rbert wants to use parse rules. The question 
is, what is the best way how to setup such a rules.
Robert
26-Feb-2009
[312x2]
compile-rules: Ok, will take a look at it.
The other option would be not to use a dialect at all and create 
normal functions for everything. But I like dialects :-)
Gabriele
26-Feb-2009
[314x2]
Robert, in compile-rules, INTERPRET is what you want to look at.
Brian: so, see, even normal people want DO in PARSE, and not only 
that, they want all the control structures... look at compile-rules 
how much effort that is. :-)
Robert
26-Feb-2009
[316]
Gab, where can I find the script?
Oldes
26-Feb-2009
[317]
I found it here http://www.colellachiara.com/soft/PDFM2/compile-rules.r
but I don't know if it's uptodate.
Robert
26-Feb-2009
[318x2]
Ok, found version 1.40 on my system.
History states a version 1.50...
BrianH
26-Feb-2009
[320]
Just because normal people want DO in PARSE doesn't make it a good 
idea. Little girls want a pony, but it's not a good idea if they 
live in an apartment. DO in PARSE would be a feature that couldn't 
be used most of the time because of its security problems.
kib2
26-Feb-2009
[321]
:)
BrianH
26-Feb-2009
[322]
A better analogy might be little boys asking for a machine gun though 
:(
kib2
26-Feb-2009
[323]
Please no : keep the pony !
Robert
26-Feb-2009
[324]
That's why I ony want some control structures routed into the dialect 
context.
Gabriele
27-Feb-2009
[325]
Brian, right, so I have to workaround all the time, write slow code 
with deep parse recursions, and all those funny and nice things. 
Or, give up and pretend REBOL was PHP.