REBOL3 - Dialects (Questions about how to create dialects [web-public])

Return to Index Page
Most recent messages (300 max) are listed first.

517SunandaNever knew it as a kid's game, but the Two Ronnies spun it into a TV sketch: 18:33
516ReichartI recall a childrens book from England when I was a child where each of the cartoon children in the book spoke in mostly single letters, it was something like:

Boy - I C U Girl - I C U 2

Boy - R U HP Girl - I M HP

Boy - U R A QT

It was a bit silly, but well made, and they had some MUCH BETTER tricks of this than I have given from memory.

13-Jan-10 18:13
515ForkOf course to make that worth it you would have to use rej more than twice: rejREJ = RrejRr :)13-Jan-10 5:19
514ForkI'm also thinking that it's better to use three-letters for things rather than use letter combinations that don't make sense. If you run out of things RE can be (RETURN, REJOIN, REPEND, etc.) then the answer is not to pick one and make it RZ for no reason... but to pick the least likely to use in code golf and go to three letters. If this is a problem for any particular challenge they can just write (for instance) Rrej at the beginning of the code and then have a shorthand.13-Jan-10 5:18
513ForkI've had some internal debates on questions like whether LN should be LENGTH? or if I should make any Rebol identifier that ends in a ? also have a ? in it. These are some tricky questions, but on that particular decision (for instance) I've decided that the ? in the name is something important to keep.13-Jan-10 5:10
512ForkAnd of course, you can use multiple characters whenever you so wish, even using the full Rebol words for things.13-Jan-10 5:09
511ForkWell, Rebmu has a set of starting definitions for one letter things. So s starts out as the empty string, i starts out as IF. You can redefine these things.13-Jan-10 5:09
510GrahamBasic had one letter variables13-Jan-10 5:08
509ForkRebmu now has a fledgling homepage/logo/rationale: 5:06
508ForkSaw some posts to the Rebol list about Intentional Programming, I still have hopes.9-Jan-10 10:35
507ForkI also changed continue's shortcut from CO to CN because I wanted CO for compose. Every time you change something it wrecks everything. I know text files have their... um... way. But I still want computers to step up to the plate and give every reference a UUID. Someday...9-Jan-10 10:34
506ForkOkay maybe just one k. Reason is I reformed the spec so that n, j, k were default defined to 0 as integers and had a rewrite in the middle.9-Jan-10 10:32
505ForkSo there are some k's in the commented version that should be js. So it is when you're trying to maintain a document in wordpress. :(9-Jan-10 10:30
504Fork>> unmush/deep [rSfeCs[Nse[i1v5x10l50c100d500m1000]twCi~J[JnCN]Kk+elJn[alN-j N0]'jJn]pK+j] == [r s fe c s [n: se [i 1 v 5 x 10 l 50 c 100 d 500 m 1000] tw c i ~ j [j: n cn] k: k + el j n [al n - j n: 0] 'j j: n] p k + j]9-Jan-10 10:29
503ForkStevee: good catch, the commented version is not in sync with the decompiled version (as I said, day 1 of this, lots of back and forth). If you run unmush you get:9-Jan-10 10:28
502Steevek: k + ... k: n

k always erased with n

9-Jan-10 10:20
501Steevesomething wrong in your code (although i didn't test it)9-Jan-10 10:18
500ForkThe only "new" trick for me in writing the above was ALSO. BrianH clued me into it this week when he used it adapting my proposal for correcting the object none leak: 9:57
499ForkBut I'm on the fence. Commenting is too important, and if you can't comment code and have it not count against your golf score something is wrong.9-Jan-10 9:54
498ForkI was contemplating the good and bad of a "mush" function, and I think I'm against it, because it undermines my point--namely that you should be able to write this code without assistance from a tool.9-Jan-10 9:53
497Fork; The following initial declarations are implicit ; k: 0 ; j: 0 ; s: "" ; readin senses the type of the argument and fulfills that from input readin-mu s foreach c s [ ; n is the current digit value n: select [ i 1 v 5 x 10 l 50 c 100 d 500 m 1000 ] to-word-mu c ; if previous digit value is zero ; capture current digit and continue ; inversion is like not but supports 0 as false if inversion-mu j [ j: n continue ] ; based on whether the previous digit value is ; less than the current one, we decide what to ; add to the total. If we need subtract the ; previous digit then we also carry over the ; current digit into the next addition k: k + either-lesser?-mu j n [also n - j n: 0] [j] ; save current digit as the previous digit ; (note that it is possibly zero) k: n ] ; if lingering previous value is not zero ; it will be added here k + j9-Jan-10 9:52
496Steeveactually i would like to see your example in plain rebol.9-Jan-10 9:52
495ForkNope, not playing. I didnt spend much time on the roman numeral function, it's incidental. Those code golfers were tweaking, I was writing plain and simple code. What do you mean "roman-num"?9-Jan-10 9:50
494Steevedon't play dumb :-)9-Jan-10 9:42
493ForkStevee: Hm? I don't know what you are referring to. I wrote the roman numeral function from scratch, in a fairly naive way.9-Jan-10 9:37
492Steevebtw, what is the sourc of the roman-num function you use "in clear"9-Jan-10 9:18
491ForkThe punch line being the one Sunanda alludes to: Rebol can play this game as well as languages designed to play *only* this game, but that's just the tip of the iceberg.9-Jan-10 9:01
490Fork(refer to )9-Jan-10 9:00
489ForkI'd put as a challenge to the Rebol community to refine Rebmu (or a similar syntax) to the point where they can submit an answer to code golf challenges that demonstrates some awesome feature of Rebol while still being in striking distance of the "winning" answer. I thought that perhaps showing Rebol 3.0 extending the roman numeral system to support higher order numerals than 1000 through unicode characters for M with a bar over it, etc. would be a good one.9-Jan-10 8:58
488ForkThe fact that you can read and write it without assistive technology is good, but you'd certainly prefer to use the normal syntax.9-Jan-10 8:49
487ForkI don't know that I'd propose this for anything other than code golf. Its saving grace is that it doesn't screw up Rebol or its legal syntax for dialects, while making it quite competitive in such contests.9-Jan-10 8:48
486HenrikCould an offshoot of this be a method for thumb coding? I'd love an app for phones which allow you to write code solely with your thumb.9-Jan-10 8:47
485ForkI think the second commandment is my favorite: "Thou shalt not worship graven images." :)9-Jan-10 8:46
484ForkSunanda: The idea of a minor modification to the challenge and seeing what that does to the program is a good one; I would do that with interview candidates who knew the "right" solution to a problem (due to studying or seeing it before)... just introduce some whimsical constraint they hadn't memorized...9-Jan-10 8:44
483Steeveso you could use returns to replace closing square brackets for example, saving more chars9-Jan-10 8:44
482ForkNot unless it's part of the program function (e.g. you use it in a multi-line character constant bounded by braces to get a carriage return in your target program)9-Jan-10 8:43
481Steeveis the return carriage counted as a char or not ?9-Jan-10 8:36
480ForkJust of the code kind...and given Tiger Woods latest publicity I think I'll steer clear for now of the real sport :)9-Jan-10 8:34
479Steeveat least, make a birdy9-Jan-10 8:34
478Steevewell, do you play Golf or not ?9-Jan-10 8:33
477ForkWhat Rebol can do is solve the problem and then do a coup-de-grace, like upload the results to a web server or something crazy like that.9-Jan-10 8:33
476ForkI think of it as "rebol mooshed" or "rebol microscopic" or "rebol please unask this development method" :)9-Jan-10 8:33
475SteeveREBIRDY would be a better suitable name for your dialect ;-)9-Jan-10 8:32
474Fork>> rebmu [rSfeCs[Nse[i1v5x10l50c100d500m1000]twC (probe n) i~J[JnCN]Kk+elJn[alN-j N0]'jJn]pK+j] Input String: XIV 10 1 5 149-Jan-10 8:31
473ForkObviously people who do code golf come to it from different perspectives, I think Rebol's key here is just to engage by giving lively and flexible solutions which pique interest. I intentionally didn't clone the deranged "winner" of the roman numeral contest because he'd thrown out the program logic, it was no longer source code. I can edit, debug, and insert probe messages into mine easily.9-Jan-10 8:30
472Fork5. you do not bring your sony robot, night vision goggles, laser guidance systems, etc. onto the golf course. You bring a bag of sticks and you use your own arm, eyes, and brain.9-Jan-10 8:27
471SunandaMy other main article point was: 4. Real golf has 18 holes per round. Most code golf plays just one hole. To be more realistic, there should be at least three holes -- ie after the first hole's scores are published, the challenge setter makes a modification to the challenge. Scores for that hole are (somehow) equated to the amount of original code the survives.9-Jan-10 8:25
470SteeveGenerally Rebolers don"t make any difference with dialects parsing a string or a loaded block. It's called dialect as-well.9-Jan-10 8:25
469ForkSunanda: I feel from my experience with parse that it's the sort of thing that can, if it fits your problem, help you a great deal... but it often seems to be just short of the needed functionality. I feel if your task does not depend on knowing the true/false result of matching, then series operations are often better. I've been thinking "if you don't use the boolean result of parse, you probably aren't working on a task that needs parse."9-Jan-10 8:24
468ForkSunanda: Rebol definitely could get some publicity with empathetic people if it were to embrace the code golfers...9-Jan-10 8:22
467ForkSaves 40%. The colons and the spaces are intertwined issues, just due to the rules of Rebol. And I feel that if the dialect wasn't parseable Rebol but a string it wouldn't rightfully be called a Rebol dialect.9-Jan-10 8:20
466Fork[r s fe c s [n: se [i 1 v 5 x 10 l 50 c 100 d 500 m 1000] tw c i ~ j [j: n cn] k: k + el j n [al n - j n: 0] 'j j: n] p k + j]9-Jan-10 8:19
465ForkThen look at what it unmushes to:9-Jan-10 8:19
464ForkLook at the Roman Numerals program [rSfeCs[Nse[i1v5x10l50c100d500m1000]twCi~J[JnCN]Kk+elJn[alN-j N0]'jJn]pK+j]9-Jan-10 8:19
463Steevei agree for saving spaces9-Jan-10 8:19
462ForkStevee: But my point is you're forgetting the spaces, which are needed too, since colons cannot appear in words.9-Jan-10 8:18
461Steeveonly to save ":" what a tremendeous gain !!! :-)9-Jan-10 8:18
460ForkWell, I understand the concern, but I didn't do it just to be weird. :)9-Jan-10 8:17
459SunandaFollowing some thoughts of Christoph Budzinski back in December, I wrote a short article on an approach to REBOL code golf last month......It takes quite a different approach to yours. But as it was never published, your approach must have priority :)

What I suggested in the article was:

1. we create a private group here to thrash out the principles and practicesl then launch a set of REBOL code golf challenges

2. current code golf is seriously flawed as it counts characters not lexical elements: variable1: variable1 + variable2 is much better code than: v1: v1 + v2 and should have the same golf score

3. in REBOL, the First Rule of Code Golf is: Parse always wins (this has been empirically observed over many REBOL code challenges)

9-Jan-10 8:17
458Steeveavthe=avoid9-Jan-10 8:17
457Steeveok i understand, i just proposed to avthe burden caused by a safe alternance of letter's casing9-Jan-10 8:16
456ForkFrom 5 chars down to 3, and it's legal to the Rebol parser.9-Jan-10 8:16
455Fork>> unmush ['aB] == ['a b:]9-Jan-10 8:16
454ForkI showed you my answer to get ['a b:] in a brief notation9-Jan-10 8:15
453ForkI'm just playing devil's advocate for your suggestion to go putting colons in the input when the goal is to minimize source representation.9-Jan-10 8:15
452Steeve'AB: has no meaning9-Jan-10 8:14
451Steevewhat is the interest to try to construct something which has no sense in Rebol9-Jan-10 8:14
450Fork>> parse {'AB:} [to end] == true9-Jan-10 8:14
449Fork>> parse ['AB:] [to end] ** Syntax error: invalid "word-lit" -- "'AB:" ** Near: (line 1) parse ['AB:] [to end]9-Jan-10 8:13
448Steeveit doesn't bother, parse has not the limitations you pointed9-Jan-10 8:12
447ForkIf I were taking strings, sky's the limit... but, what's the point?9-Jan-10 8:12
446ForkThat's the Rebol parser. I'm not taking strings as input, I'm taking Rebol blocks. It's a dialect.9-Jan-10 8:11
445Fork>> unmush ['aB] == ['a b:]9-Jan-10 8:11
444Fork>> unmush ['aB] == ['a b:]9-Jan-10 8:10
443Steevehey ! your parser is the weak point, it seems :-)9-Jan-10 8:10
442Fork>> 'AB: ** Syntax error: invalid "word-lit" -- "'AB:" ** Near: (line 1) 'AB:9-Jan-10 8:10
441Fork>> 'A:B ** Syntax error: invalid "word-lit" -- "A:B" ** Near: (line 1) 'A:B9-Jan-10 8:09
440ForkThere are other issues:9-Jan-10 8:09
439ForkEr, ignore case9-Jan-10 8:08
438ForkMy goal was to only muck with words, which Rebol binding has promised to ignore9-Jan-10 8:07
437ForkImplementation gets trickier if you're parsing urls, and you're impinging on the URL type at that point, which is an any-string and thus does give meaning to case.9-Jan-10 8:07
436Steeve:-)9-Jan-10 8:07
435ForkA character here, a character there... pretty soon you're talking about real whitespace! :)9-Jan-10 8:06
434SteeveYes i added a character but i don't have to take care of the correct alternation of uppercases9-Jan-10 8:05
433ForkAnd you added a character :)9-Jan-10 8:04
432ForkYou're starting to tread on the question of taking away things and making a non-superset9-Jan-10 8:04
431Fork>> type? A:B == url!9-Jan-10 8:04
430Steeve"A:B"9-Jan-10 8:03
429ForkWell you're free to work out an example of a better dialect but you'll be parsing URLs or something... like where I can do Ab to get a: b how would you get it?9-Jan-10 8:03
428Andreasg~$ in vim, to switch case for everything from the cursor to the end of line9-Jan-10 8:02
427Andreasand changing the case of text is something that can be relegated to a good editor :)9-Jan-10 8:01
426Steeve"ABC" would mean [A B C] with this new system9-Jan-10 8:01
425SteeveSo what ? 3A9-Jan-10 8:01
424ForkEvery variable in your program in most cases will be only one letter.9-Jan-10 8:00
423ForkProblem is that single character words play a huge part in this9-Jan-10 8:00
422Steeveif each new word always begin with a capital letter, you don't have anymore the problem. You just lost the compression of the ":" char. Not a so huge loss9-Jan-10 7:59
421ForkAnyway, I'm not very interested in the super estoeric algorithms but do note that people get upvoted significantly for small solutions in languages like J: 7:59
420ForkaaBBccDDeeFFgg... if you really do have a long long uninterrupted chain of that nature then there's a problem. But I bet usually a number or path or symbol would pop in there.9-Jan-10 7:57
419ForkTrue, but renaming variables is a burden as well. As it happens, each numeric constant, symbol, or path operator breaks the chain so you get to start anew9-Jan-10 7:56
418SteeveThere is a burden. When you add Something inside a sequence, you may have to swap all the followings caps/tiny letters :-)9-Jan-10 7:55
417Fork(As most joke languages are.)9-Jan-10 7:49
416Fork(But good for a CS class, or whatever.)9-Jan-10 7:48
415ForkAlso it's not corrupting the language (much). If you learn this "rebmu" dialect you'll be learning a useful language and your knowledge will transfer. As opposed to GolfScript which is just garbage.9-Jan-10 7:48
414ForkA little awkward, but, not so bad when compared to things that have disposed the entire program logic into constants like n=1;$.+=n/2-n%n=10**(494254%C/9)%4999while C=getc;p$.9-Jan-10 7:46
413ForkRight. And in 1 day of getting used to it, I can pretty easily translate the above Roman Numeral code as I read it9-Jan-10 7:46
412Steeveok the point is that you may be able to understand the code with normal human abilities9-Jan-10 7:45
411ForkThe parse dialect also cannot execute as is. Thus are dialects.9-Jan-10 7:43
410ForkI suppose technically you can base-64 encode by working it out on paper, but I think it has moved out of the domain of being program source code at that point.9-Jan-10 7:42
409ForkMy goal was to create a language you can program in on paper9-Jan-10 7:42
408Steevebut in fact it's a little bit cheating, the code cannot be execute as-is. Is there a real difference with the following idiom used to shorten rebol sources >> do load decompress #64{...........}9-Jan-10 7:42
407ForkWait, that's a 72 character translater. The 77 one was different. :)9-Jan-10 7:37
406ForkBut I bet that it could put Rebol on the map as a code golf language.9-Jan-10 7:34
405ForkJust came up with it last night, so, it's what it is9-Jan-10 7:34
404ForkAnd I just pushed the source for a proof of concept to GitHub: 7:33
403Fork 7:33
402ForkIf you start a mushing sequence with a capital letter that indicates the desire for a set-word9-Jan-10 7:32
401ForkrSfeCs[Nse[i1v5x10l50c100d500m1000]twCi~J[JnCN]Kk+elJn[alN-j N0]'jJn]pK+j9-Jan-10 7:32
400ForkHere's a 77 character Roman Numeral to integer converter:9-Jan-10 7:32
399Steeveand how do you decipher a set-word ?9-Jan-10 7:32
398ForkStill parseable Rebol, but each time you switch the case it's a conceptual word break.9-Jan-10 7:31
397Steeveinteresting9-Jan-10 7:31
396Fork>> unmush [AbCdE/Fg/H] == [a: b c d e/f: g/h:]9-Jan-10 7:30
395Fork>> unmush [aBcDe/fG/h] == [a b c d e/f g/h]9-Jan-10 7:30
394ForkPhilosophically, it would seem Rebol could compete, if the functions had shorter names--which is easy enough (Huffmanize natives and the mezzanine, whatever). But the whitespace policy for words is a bit of a problem. Then I thought of what I called "mushing"9-Jan-10 7:29
393ForkSome of the things people do are utterly ridiculous. They compile assembly to DOS .COM files and claim the resulting hex bytes constitute program code because you can feed them into the console. Other approaches obfuscate the code beyond belief to where you really can't make the slightest change to them--they are effectively not source, but the result of a bizarro compilation--often written using some kind of assistive tool or calculator.9-Jan-10 7:27
392ForkI took a bit of a Rebol break for the new year. But last night I had an idea that just wouldn't get out of my head. It happened after I read about "code golf" on StackOverflow. The premise is to use the fewest characters possible to solve a problem using a general purpose language (albeit perhaps one optimized for such a game, like "GolfScript")9-Jan-10 7:25
391MaxVOK Thanks24-Aug-09 14:09
390Pekroce=code24-Aug-09 14:09
389PekrYou just have to do a little math, if you want the gradient. From the oce you can see how to aproach it - VID applies +- 32 tuple offset ...24-Aug-09 14:09
388PekrEffect is the actual color in actual state imo. Remember that you can call 'show in many places. Effect is initialised upon button state by redraw code: "pick face/effects not state"24-Aug-09 14:08
387MaxVYess! Effect is the color of the button pushed, effects normal button state. Thank you24-Aug-09 14:07
386PekrFrom there on, you can work out your final solution imo ...24-Aug-09 14:06
385Pekrview layout [b: button "OK" red [b/effects/1: [gradient 0x1 100.100.100 120.120.120]]]24-Aug-09 14:06
384PekrIf you change only b/effect, it will be rewritten by redraw imo ....24-Aug-09 14:04
383Pekr>> view layout [b: button "OK" [probe reduce [b/color b/font/colors b/effect b/effects]]] [44.80.132 [255.255.255 255.180.75] [gradient 0x-1 66.120.192 44.80.132] [ [gradient 0x1 66.120.192 44.80.132] [gradient 0x-1 66.120.192 44.80.132] ] ]24-Aug-09 14:04
382PekrI was not succesfull changing only 'effect. You have to change b/effects block, because of following engage/redraw code imo:

if face/effects [face/effect: pick face/effects not state]

24-Aug-09 14:03
381Pekr"either color" means, if you have submitted a color facet in VID level ... e.g. button red24-Aug-09 14:00
380Pekrthis is the button's init function part - it looks if you have image for button, and if not, then:

if not any [effect effects] [ either color [ effects: reduce [ reduce ['gradient 0x1 color + 32 color - 32] either all [block? colors colors/2] [ reduce ['gradient 0x-1 colors/2 + 32 color/2 - 32] ] [ reduce ['gradient 0x-1 color + 32 color - 32] ] ] ] [ effects: [ [gradient 0x1 66.120.192 44.80.132] [gradient 0x-1 66.120.192 44.80.132] ] ]

24-Aug-09 13:59
379MaxVwell b/color after initialization is ignored, so I have to change effect24-Aug-09 13:59
378Pekrhmm, seems b/color is the red color. b/font colors is font colors - normal and over, b/effect - dunno ...24-Aug-09 13:57
377MaxVYes, I was confused by b/color24-Aug-09 13:56
376Pekryes, R2 was kind of rather badly documented. And VID2 is really not that easy to hack, extend, beyond what it does. In the past I was reluctant to use RebGUI, because it looked rather unatractive, but that is not case anymore ....24-Aug-09 13:56
375Pekr>> 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]]24-Aug-09 13:55
374MaxVYes, 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...24-Aug-09 13:55
373Pekralso remember, there are two button versions - button, and btn - slightly different. You might also be interested to look into RebGUI VID alternative ...24-Aug-09 13:51
372PekrShould work, remember to call show b in you code ...24-Aug-09 13:50
371PekrMaxV - to study it further, you can type following in console - print mold get-style 'button24-Aug-09 13:49
370MaxVIf I put b/effect: [ gradient 0x-1 0.255.0 0.255.0] ??24-Aug-09 13:49
369Henrikyou need to check feel/redraw to make sure the effect is not overwritten by it24-Aug-09 13:49
368Pekr>> view layout [b: btn "OK" red [probe b/effect]] [colorize 255.0.0 128 extend 14]24-Aug-09 13:48
367Pekr>> 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? :-)

24-Aug-09 13:47
366Henrikyes, 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.24-Aug-09 13:46
365MaxVThank you, I'll try and let you now! Cheers!24-Aug-09 13:45
364SunandaColor 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!)

24-Aug-09 13:43
363PekrIIRC, button colors are being held elsewhere. I don't remember if there were introduced accessor functions for them, or not ... let me see ...24-Aug-09 13:35
362Pekryeah, typical problem ....24-Aug-09 13:35
361MaxVVID: How I can change button color? I tried: view layout [ a: button red [ a/color: 0.0.0 show a] ]

but nothing happens....

24-Aug-09 13:33
360ChrisThough not included in the 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.

5-Mar-09 2:40
359Jankobtiffin :) yes I use their sqlite driver and it works great , haven't tried rebdb or regbui yet3-Mar-09 20:26
358btiffinJanko; you may know this; has RebDB as well as a SQLite driver. RebGUI with RebDB ... livin' :)3-Mar-09 20:10
357JankoHenrik: very interesting3-Mar-09 15:14
356Janko( pypy is python interpreter in python )3-Mar-09 15:13
355HenrikLast 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.3-Mar-09 15:12
354JankoOldes: making something like pypy in rebol rebreb maybe would probably not take so many years :)3-Mar-09 15:11
353Jankohas anyone made a dialect that would make some basic or typical sqlite ? (so I won't be reinventing if not necesarry)3-Mar-09 15:10
352OldesI'm still waiting who will be the first to write Rebol like interpreter as a dialect:)3-Mar-09 15:09
351JankoI am still at mostly basic dialecting rules, but even this is very interesting and a lot can be made3-Mar-09 15:04
350HenrikStart layering multiple dialects and then you'll see some real power :-)3-Mar-09 15:03
349Jankokib2: yes, and they are technically very easy to make... I always thought it's soma magical process :)3-Mar-09 15:03
348Jankoyou 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 "" .

3-Mar-09 14:59
347Henrika variant on that would be:

parse a [ttt: set-word! (print ttt/1)]

3-Mar-09 14:54
346Janko:) thanks a lot3-Mar-09 14:53
345Jankoaha this words yes

>> a: [ id: ] == [id:] >> parse a [ set ttt set-word! ( print ttt ) ] id == true

3-Mar-09 14:53
344Henrikset key set-word! (key: to-word key)

is how he does it.

3-Mar-09 14:52
343kib2I'm just starting to play with dialects : it's really a pleasure to play with.3-Mar-09 14:52
342Jankoyes, basically in this case I am not looking for specific set-word but taking it as value .. I will try that3-Mar-09 14:52
341Jankofrom his dialect:

name: string! is not within ["Carl"] age: integer! is between [18 65] start-date: date! is after 30-April-2007

3-Mar-09 14:50
340Henrikyou can always check for any set-word!, but I don't know how you would check for a specific set-word!.3-Mar-09 14:49
339HenrikI 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.3-Mar-09 14:48
338Jankoyes, 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 " (on this url)3-Mar-09 14:47
337HenrikI'm not sure what you mean. Do you want to parse set-words?3-Mar-09 14:45
336Jankoor did you mean something else?3-Mar-09 14:43
335JankoIt doesn't seem to work >>parse a [ id: ]<<3-Mar-09 14:40
334Henrikremove the '.3-Mar-09 14:33
333Jankomake = made3-Mar-09 14:32
332Jankocan 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? :)3-Mar-09 14:32
331BrianHI don't have to tell *you* how difficult it is to sandbox DO dialect code, Gabriele: You've already done half the work :)28-Feb-09 23:39
330BrianHI'm working on the sandboxing in the R2-Forward project though.28-Feb-09 23:36
329BrianHIt also makes the data *exactly* as difficult to sandbox in R2 as it is to sandbox R2 DO code :(28-Feb-09 23:32
328BrianHThere 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.28-Feb-09 23:31
327BrianHI'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: 23:16
326GabrieleWe 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.27-Feb-09 9:53
325GabrieleBrian, 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.27-Feb-09 9:52
324RobertThat's why I ony want some control structures routed into the dialect context.26-Feb-09 20:10
323kib2Please no : keep the pony !26-Feb-09 19:16
322BrianHA better analogy might be little boys asking for a machine gun though :(26-Feb-09 19:13
321kib2:)26-Feb-09 16:40
320BrianHJust 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.26-Feb-09 16:32
319RobertHistory states a version 1.50...26-Feb-09 14:20
318RobertOk, found version 1.40 on my system.26-Feb-09 14:20
317OldesI found it here but I don't know if it's uptodate.26-Feb-09 12:44
316RobertGab, where can I find the script?26-Feb-09 12:03
315GabrieleBrian: 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. :-)26-Feb-09 9:29
314GabrieleRobert, in compile-rules, INTERPRET is what you want to look at.26-Feb-09 9:28
313RobertThe other option would be not to use a dialect at all and create normal functions for everything. But I like dialects :-)26-Feb-09 8:49
312Robertcompile-rules: Ok, will take a look at it.26-Feb-09 8:48
311OldesBrian: I think, that Rbert wants to use parse rules. The question is, what is the best way how to setup such a rules.25-Feb-09 19:13
310OldesCheck out the source of the R2's layout function. ?? layout25-Feb-09 19:03
309BrianHYou can't make that restriction with DO/next or Gabriele's compile-rules without a sandbox - hard to do in R2.25-Feb-09 18:10
308BrianHBut *only* the REBOL functions that you want to support and can do so safely.25-Feb-09 18:09
307BrianHRobert, 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.25-Feb-09 18:04
306GreggGab = Gabriele25-Feb-09 18:01
305GreggUse Gab's compile-rules module.25-Feb-09 18:01
304Jankoaha, I would also like to know if that is possible .. I still haven't figured out how they do ( some code ) in parse25-Feb-09 16:09
303RobertJust assume that get-point and set-point is done via a dialect.25-Feb-09 15:56
302Jankobut 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?25-Feb-09 15:39
301RobertIs there a best practice how to get Rebol control structure support into dialects?25-Feb-09 15:19
300Robertget-point and set-point are the dialect things. The rest should be normal rebol.25-Feb-09 15:18
299RobertExample: parse XYZ mydialect

XYZ: [ repeat x 1 14 [ a: get-point x 7 set-point 7 x (a * 2) ] ] ]

25-Feb-09 15:18
298RobertWhat'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.25-Feb-09 15:16
297Alan.14-Sep-08 7:05
296GabrieleI do something like that, but text based, in QML. not sure if it can be of any help.4-Aug-08 10:18
295ChrisOne of the desired effects is precedence, for example:

match [ %image.png][ link: file! | url! image: file! | url! ]


[link: image: %image.png]

4-Aug-08 4:28
294ChrisWays of making it smaller???4-Aug-08 4:23
293Chrisrfc: 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?

4-Aug-08 4:22
292eFishAntAs Robert de Niro said in one of my favorite movies of all time, "Analyze This" "...hey,'re good!"24-Jun-08 3:00
291Chrisrule: use [table row][ row: [<tr> </tr>] table: [<table> any [table | row] </table>] [table] ]24-Jun-08 2:54
290eFishAnt...and so forth.24-Jun-08 2:50
289eFishAntTable: ["<table>" Content "</table>"]24-Jun-08 2:50
288eFishAntlike Tables: [Table Tables | Table]24-Jun-08 2:50
287eFishAnt(using recursion)24-Jun-08 2:49
286eFishAntparse rules that will give a true if parse/all {<table><table></table><tr></tr></table>} RULES24-Jun-08 2:49
285ChrisWhat's the goal?24-Jun-08 2:48
284eFishAntfor some reason, using recursion...I just can't seem to put my finger on the right combo.24-Jun-08 2:47
283eFishAntIt is a table with an empty table inside, and also a Table-Cell24-Jun-08 2:46
282eFishAnt{<table><table></table><tr></tr></table>}24-Jun-08 2:46
281eFishAntanyone know how to parse this:24-Jun-08 2:45
280BrianHIf this is typing in real time, space would be the best seperator,13-Jun-08 12:57
279BrockI 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.13-Jun-08 7:30
278BrockI 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.13-Jun-08 7:29
277BrockThe first line of the volleyball page , 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 - error13-Jun-08 7:24
276Henrikwell, 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.13-Jun-08 7:13
275BrockAs I haven't worked much with Dialects I wasn't terribly sure how to start, so was looking for some dialect examples that might influence my starting point.13-Jun-08 7:11
274BrockEach skill would be given a character on the keyboard and would expect it to be followed by a player number and the level of success of the player attempting the skill.13-Jun-08 7:11
273BrockYes, I was thinking parse would likely be the way to go.13-Jun-08 7:08
272BrockThe sport I am most interested in doing this for is Volleyball as I have experience coaching this sport.13-Jun-08 7:08
271HenrikIt looks pretty parse friendly.13-Jun-08 7:07
270BrockWhat I am going to attempt is a dialect that will respond to single key-strokes to tell the story of a match and at the same time capture the statics for the live game. Hopefully the end result will lead to many different tools based on this data such as statistics visualizations in the form of data summaries/reports and charts.13-Jun-08 7:06
269Henrikwhat would the dialect do?13-Jun-08 7:04
268BrockHas anyone written a dialect to capture live sports action? Here are some examples of the types of items needed to be captured... Volleyball... Hockey... Soccer... 7:03
267GreggI understand; my point was that mathematics, as a foundation, allows you to express things in a domain that Basque, historically, does not. A DSL doesn't *have* to be an extension or outgrowth of an existing language, but that can often help. In order for tha that to work, you need to choose a base language that suits your needs.24-Sep-07 14:35
266TerryBut Gregg, the reference was towards a "language that combines vocabulary and grammar"... sounds more like "Energy equals mass times the speed of light squared", rather than E = MC224-Sep-07 5:55
265RobertSIn this context I am not going to offer the Curl examples for DSL and pass-the-proc except to say that ... no , I won't say that either ;-)23-Sep-07 21:46
264btiffinLearn something new here everyday. :)23-Sep-07 21:19
263Ladislavanother reliable implementation not using closure: foo: func [n] [use [m] [m: n func [i] [m: m + i]]]23-Sep-07 18:27

f1: foo 1 f2: foo 2

f1 1

should yield 2, not 3!

23-Sep-07 18:22
261Ladislavfoo: closure [n] [func [i] [n: n + i]] is necessary for this to work reliably23-Sep-07 18:19
260Ladislavhmm, but foo: func [n] [func [i] [n: n + i]] is wrong23-Sep-07 18:18
259btiffinRead this today, re programming language choice; Down near the bottom is the Appendix: Power. and leads to I can read the languages he uses as examples, but only a few of them come close to the readability of foo: func [n] [func [i] [n: n + i]] or am I just too sucked into REBOL/Think? It's too bad the page has extra space around the brackets, as at a quick glance REBOL would be in the top four shortest. It's as quick grokable (meaning a quick glance implies a function returning a function that accumulates) as Dylan, LUA, Javascript and NewtonScript. And who uses Javascript? :)21-Sep-07 22:34
258GreggIt matters if it's a dialect Terry. If you wanted to create a special language to discuss neclear physics, do you think it would make a difference if you based it on a Mathematical foundation versus Basque?21-Sep-07 16:06
257GreggI'm going to try to make time to respond on the ML later today. It's a good topic.21-Sep-07 16:03
256TerryA. It doesn't matter what language you use. That's like two kids that speak English saying.. "lets invent a new language.. what language should we use to invent it with?"21-Sep-07 7:20
255btiffinIf I had to quickly pick an order; REBOL, Forth, SNOBOL, Lisp. If I was told I HAD to do it in a class based object oriented language I'd probably pick SmallTalk ... no ... I'd probably just leave. To be honest, I've rarley seen a DSL that didn't require a programmer to script it anyway, so... I find the whole thing kind of moot. Moot is the wrong word. A non-coder MIGHT be able to VID up a GUI but I doubt it would do much...or by the time they were done, the non-coder would have unknowningly become a coder. I've not seen a DSL I'd turn over to Bob the manager to write progams in. Even languages written to be specific; Erlang for telephony, Forth for telescopes, are still programmer languages. REBOL comes soooo close to being a data language that humans can use...but unfortunately nope; Programmers required. The magic all happens when you can build up layers, and stand on the shoulders of giants. Something hardware engineers have been doing since day 1...programmers might learn by day 32'767 if we get lucky. No doubt our smartest programmers will be fussing with strings 50 years from now with the same basic problems and mind sets faced 50 years ago.20-Sep-07 22:33
254BrockI wonder of any of those well versed in languages (Greg, btiffin, Geomol, Max to name a few) would want to respond to this posted question related to the above article "What language you would use to develop DSL?" ?20-Sep-07 19:18
253BrockInteresting article Richard.20-Sep-07 19:15
252Richard Boyd[InfoQ Article] Language-oriented programming : an evolutionary step beyond object-oriented programming?

"Fowler defined this concept as “the general style of development which operates about the idea of building software around a set of domain specific languages”.

According to Martin Fowler object-oriented domain modelling allows to “build up a vocabulary” but the grammar – ways to combine these vocabularies – is not defined; DSLs add this grammar side. Therefore language-oriented programming inducts “this shift of moving from thinking about vocabulary, which is objects, to the notion of a language that combines vocabulary and grammar.”

20-Sep-07 4:47
251GeomolOk, I'll read some more of this. I've already started a dialect (more like an intepreter as with BASIC). I'll have a real REBOL dialect (that can be used in the middle of REBOL scripts) in mind as well, as I go along.1-Aug-07 18:10
250Geomol:-)1-Aug-07 18:09
249btiffinForth Inc will send you a copy of of Swiift it has a block editor, but they've moved away from supporting it so they could 'do Windows'...a pity. And wait...did I say Forth was "just another language"? Where did THAT come from? Long live REBOL. :)1-Aug-07 17:47
248GreggI never got into Forth more than playing around, but I *love* the idea of the immersive experience. REBOL is that in many ways for me, because I can think about so many things using REBOL as a context. I think the idea of dialects could lead us to domain specific environments that are like Forth, in that they are highly focused and immersive.1-Aug-07 17:37
247btiffinNever mind the link so much. just a dup of one of Greggs.1-Aug-07 17:36
246btiffinYou beat me to it Gregg. Starting Forth by Leo Brodie. It includes the old school (and really the only reason to use Forth) block editor. Without the block editor Forth is pretty much just another language, with it (and after getting used to EDLIN style editing), you get the immersive holy grail. Thinking Forth is quite a bit more cerebral, but I know it's been made available in PDF, but I found this... so far.

1-Aug-07 17:33
245GreggLeo Brodie's books, Starting Forth and Thinking Forth, are the seminal works on the language.1-Aug-07 16:45
244GreggI have a lot more links here as well, but the best reference may be Brian, since he was a real live Forth user. I also have a couple books on my shelf, but...1-Aug-07 16:45

1-Aug-07 16:43
242GeomolWhat is a good Forth version as a reference system? ANS Forth? I also need a place to look, where the language is explained in a clear and short form.1-Aug-07 14:50
241GreggJohn, it sounds great. I'm just totally strapped for time, or I'd be in there baning on it and learning from what you've done.31-Jul-07 2:30
240btiffinForth has a very (untouchable actually) immersive feel to it. As long as you avoid working with the sad sad current trend of text file forth, everything you do in Forth is Forth. Editor commands...Forth, disk management Forth, debugger Forth, locate and cross reference, Forth. Anyway I'm still questing for a REBOL enviroment that allows that immersive feel. No brain switching to Editor, back to console command brain, then another brain switch to file manager, bobloblaw. Mondo powerful when you can keep your brain in one mode for a full eight hours. Even building Forth was Forth. I do kinda miss it, but only for semimental reasons. REBOL is just too cool to think about going back.30-Jul-07 23:36
239GeomolThanks for the input! I thought about something similar, having a sub-pointer as you speak of. It could work. But I got the feeling, it'll be a better design, if it's done like the original, using an internal format with byte-code for the keywords. I have to judge, how much work it is.

I'm interested in Greggs original ideas, which got me going with this, to implement different languages. I'll consider Forth as the next one.

30-Jul-07 23:23
238btiffinComments, hmmm. You've done an awesome job John. I learned Z-80 assembler back on my TRS-80 before I did much BASIC. When they finally got a computer class in my high school for ninth graders, I was already in grade 12 and laughed at the BASIC. So, instead of having me whining and whinging all class, I got to write a student database program in assembler for my electronics teacher on the Commodore PET. Never been a fan of BASIC, but what you've done can only attract a larger REBOL audience so well done. If you can make it compatible enough to run old DOS frogger.bas you may have a demo that gains worldwide attention.

Technically, back to your point, (having sadly only glossed over your codebase), what if you tricked the "line" internals say with pair! or decimal! keeping your own sub-lines invisible to the user?

And if you start up a Forth dialect...I'm in. Or at least will show a keener interest watching a guru at work :)

30-Jul-07 23:07
237GeomolComments!?30-Jul-07 19:12
236GeomolIt's rather difficult to implement functions (user functions, which the BBC BASIC language support), with the implementing method, I've choosed. Problem is, that the return point need to be saved, while the function code is running. The problem is the same with statements like GOSUB and PROC (procedures), but so far, I've just put some restrictions on those. In this basic, more than one statement can be on each line, if they're separated by colons, ':'. The way it's implemented, this example give a syntax error: GOSUB 100:PRINT "I'm back" My implementation require, that the return point is the next line. That isn't good enough with functions, because they're used in the middle of other statements. Examples:

PRINT FNone_function, FNanother_function IF FNmyfunc=42 THEN PRINT "It's 42!"

The return point for those need to be in the middle of a statement, in the middle of a line. So I'm at a point, where I consider another implementation of all the statements (more like a real emulation of the BBC computer) or if I just should say "the heck with it" and move on to some other language or another version of a new BASIC language.

30-Jul-07 19:12
235GeomolThis *is* ...29-Jul-07 11:09
234GeomolThis probably the same reason, words are separated by space in REBOL.29-Jul-07 11:08
233GeomolSo far, I've allowed keywords to be either UPPER- or lower-case. I think, I have to restrict them to UPPER-case like in traditional BASIC. Problem is with variable names being assigned by the LET statement. If I define a variable "length": LET length=10 and then use it in some expression, the first part of the variable name is being recognized as the LEN function. In the original BBC BASIC, the above LET statement is ok, while you can't write: LET LENGTH=10 , which will give a syntax error. I conclude, I have to restrict keywords to UPPER-case and then check, when the variables are being defined, so their names don't collide with keywords.29-Jul-07 11:04
232GeomolThere still need to be work done on formatted output (PRINT and INPUT statements).27-Jul-07 12:18
231GeomolUps, the line >50end after the program shouldn't have been there, so forget that (even if it works with it included).27-Jul-07 12:16
230GeomolExample use of local variables. In line 70, 'a' is local, because it's a parameter to the procedure, 'b' is still global. After line 80, 'b' also become local to the procedure. After returning from the procedure, both 'a' and 'b' are set back to their global values. In 'proctest', 'a' could have been called anything without changing the global 'a'.

>> do Script: "BBC BASIC" (27-Jul-2007) BASIC v. 0.4.0

>auto 10 a=42 20 b=1 30 proctest(a) 40 print "line 40 : a=";a " b=";b 50 end 60 def proctest(a) 70 print "line 70 : a=";a " b=";b 80 local b 90 a=2:b=2 100 print "line 100: a=";a " b=";b 110 endproc 120 0 >50end >run line 70 : a= 42 b= 1 line 100: a= 2 b= 2 line 40 : a= 42 b= 1

27-Jul-07 12:14
229GeomolIt's now almost 1400 lines of REBOL source. But still only 4922 bytes compressed.27-Jul-07 11:34
228GeomolBBC BASIC v. 0.4.0 uploaded. Added procedures and local variables (DEF PROC, ENDPROC and LOCAL). Added TIME, RND and EVAL. Added better error handling. Next thing will be functions, but I'll test procedures some more first. The implementation is based on this user guide: 11:29
227GeomolArrays are indexed from zero. Arrays can also be used to index other arrays. Example:

>dim name$(4) >dim a(1,1) >name$(3)="Joe" >a(1,0)=3 >print name$(a(1,0)) Joe

24-Jul-07 19:24
226GeomolVersion 0.3.0 of BBC BASIC uploaded. Added the rest of the string handling: LEFT$, MID$, RIGHT$, STRING$ and INSTR. Added ON, that can change the order of execution. Added DIM, which implement arrays. Both for integers, reals and strings. To run: >> do List of keywords: 19:21
225?Somthing that translates to all languages, and ages...23-Jul-07 11:36
224?(;_ylt=A0WTUfF176FG8XwBExgZ.3QA)23-Jul-07 11:36
223Gabrielei think, time would better be invested in an OS (both for geeks, and non-geeks). then you can make cheap computers for the OS to run, once it has been recognized, so parents could buy a $100 computer to childs (one each) instead of one big $1000 pc for the family.23-Jul-07 5:51
222GabrieleGeomol, the problem with such a computer is that it would only appeal to geeks, and geeks already have a pc anyway. for developing countries, there's the OLPC eventually.23-Jul-07 5:50
221Geomol:-) I have a feeling, that dialects is a good way to go, because so many problems become much easier to solve.22-Jul-07 12:42
220GreggWow John! I haven't even had a chance to look at it since the original release and you're already on v2, well, 0.2, but still. :-) And, yes, I think it would be very cool to have a BASIC that supports REBOL's datatypes. Part of my, perhaps not so hidden, agenda for these things--in addition to being great for teaching language design and construction--is to show how REBOL can work *inside* the idioms other languages use.22-Jul-07 12:39
219GeomolPekr, is it strong enough? As datatypes, it support different kinds of integers, floating-point and strings. BASIC as a REBOL dialect would be able to have much more, wouldn't it?22-Jul-07 10:05
218PekrGeomol - there is one strong and modern Basic implementation - Free Basic?22-Jul-07 10:00

Return to Index Page