World: r3wp
[Dialects] Questions about how to create dialects
older newer | first last |
Fork 9-Jan-2010 [398] | Still parseable Rebol, but each time you switch the case it's a conceptual word break. |
Steeve 9-Jan-2010 [399] | and how do you decipher a set-word ? |
Fork 9-Jan-2010 [400x8] | Here's a 77 character Roman Numeral to integer converter: |
rSfeCs[Nse[i1v5x10l50c100d500m1000]twCi~J[JnCN]Kk+elJn[alN-j N0]'jJn]pK+j | |
If you start a mushing sequence with a capital letter that indicates the desire for a set-word | |
http://hostilefork.com/2010/01/08/modest-proposal-for-code-golf-in-rebol/ | |
And I just pushed the source for a proof of concept to GitHub: http://github.com/hostilefork/Rebmu/blob/master/rebmu.r | |
Just came up with it last night, so, it's what it is | |
But I bet that it could put Rebol on the map as a code golf language. | |
Wait, that's a 72 character translater. The 77 one was different. :) | |
Steeve 9-Jan-2010 [408] | but 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{...........} |
Fork 9-Jan-2010 [409x3] | My goal was to create a language you can program in on paper |
I 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. | |
The parse dialect also cannot execute as is. Thus are dialects. | |
Steeve 9-Jan-2010 [412] | ok the point is that you may be able to understand the code with normal human abilities |
Fork 9-Jan-2010 [413x5] | Right. And in 1 day of getting used to it, I can pretty easily translate the above Roman Numeral code as I read it |
A 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$. | |
Also 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. | |
(But good for a CS class, or whatever.) | |
(As most joke languages are.) | |
Steeve 9-Jan-2010 [418] | There is a burden. When you add Something inside a sequence, you may have to swap all the followings caps/tiny letters :-) |
Fork 9-Jan-2010 [419x3] | True, 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 anew |
aaBBccDDeeFFgg... 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. | |
Anyway, 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: http://en.wikipedia.org/wiki/J_(programming_language) | |
Steeve 9-Jan-2010 [422] | if 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 loss |
Fork 9-Jan-2010 [423x2] | Problem is that single character words play a huge part in this |
Every variable in your program in most cases will be only one letter. | |
Steeve 9-Jan-2010 [425x2] | So what ? 3A |
ABC would mean [A B C] with this new system | |
Andreas 9-Jan-2010 [427x2] | and changing the case of text is something that can be relegated to a good editor :) |
g~$ in vim, to switch case for everything from the cursor to the end of line | |
Fork 9-Jan-2010 [429] | Well 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? |
Steeve 9-Jan-2010 [430] | A:B |
Fork 9-Jan-2010 [431x3] | >> type? A:B == url! |
You're starting to tread on the question of taking away things and making a non-superset | |
And you added a character :) | |
Steeve 9-Jan-2010 [434] | Yes i added a character but i don't have to take care of the correct alternation of uppercases |
Fork 9-Jan-2010 [435] | A character here, a character there... pretty soon you're talking about real whitespace! :) |
Steeve 9-Jan-2010 [436] | :-) |
Fork 9-Jan-2010 [437x6] | Implementation 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. |
My goal was to only muck with words, which Rebol binding has promised to ignore | |
Er, ignore case | |
There are other issues: | |
>> 'A:B ** Syntax error: invalid "word-lit" -- "A:B" ** Near: (line 1) 'A:B | |
>> 'AB: ** Syntax error: invalid "word-lit" -- "'AB:" ** Near: (line 1) 'AB: | |
Steeve 9-Jan-2010 [443] | hey ! your parser is the weak point, it seems :-) |
Fork 9-Jan-2010 [444x4] | >> unmush ['aB] == ['a b:] |
>> unmush ['aB] == ['a b:] | |
That's the Rebol parser. I'm not taking strings as input, I'm taking Rebol blocks. It's a dialect. | |
If I were taking strings, sky's the limit... but, what's the point? | |
older newer | first last |