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

World: r3wp

[rebcode] Rebcode discussion

BrianH
12-Oct-2005
[80x6]
Thanks for the answers to some of my questions! In summary:

- The set-word notation for setting variables doesn't seem to work 
any more, and the reason for the change to the set* opcodes is increased 
speed.

- BRAW is computed goto, but it is yet unclear what the value of 
the word is supposed to be. I'll test.
After testing and some guesses I figured out that the rebcode dialect 
is statement-based, although it can be converted from expression-based 
by the aforementioned rewrite rules. Also, the | in the declaration 
of opcode syntax refers to alternate data types, so that:
    skip: [word! integer! | word!]

means that skip takes a word! as its first argument and an integer! 
or a word! in its second argument.
After some digging, it seems that the inner block goto label problem 
has been solved. I'm not sure where Gabriele's user defined rewrite 
rules are to be set, but I'm still looking.
The syntax check in Gabriele's assembler seems solid at first glance 
- it seems to be automatically generated from the system/internal/rebcodes 
object, or both generated from the same source data.
There may still be ways to crash the VM using semantic errors (type 
mismatch and such). Testing...
So far, argument words with the wrong type of values assigned to 
them just seem to cause the opcodes to be skipped without complaint. 
Certainly better than crashing, but it could lead to the kind of 
errors that would be difficult to find without extensive unit testing 
or a type inferencer. Still, I'm pleased.
Henrik
12-Oct-2005
[86]
gabriele, the gradient is a little boring, but still a good demo. 
:-)
Cyphre
12-Oct-2005
[87]
do http://www.rebol.cz/~cyphre/dotflowers.r
Henrik
12-Oct-2005
[88]
cyphre: great stuff
BrianH
12-Oct-2005
[89x2]
Glad to hear about the vectors!
Any chance of struct! support in /Core? It would seem that it could 
be even more useful in rebcode than in library access...
Benjamin
12-Oct-2005
[91]
WOW Cyphre o_0 cool stuff
BrianH
12-Oct-2005
[92x2]
It seems to me that vectors would be useful to use when implementing 
Unicode support.
Nice, Cyphre :)
Henrik
12-Oct-2005
[94]
try adding a blur or other effect to the image in dotflowers. looks 
really cool :-)
Benjamin
12-Oct-2005
[95]
only 20% of CPU on my 2.6 !
Henrik
12-Oct-2005
[96x2]
eats 45% here... show eats a lot on my machine for some reason
I'm wondering a bit if it's possible to do anything more direct than 
show. simply have a pixel buffer directly to put pixels in without 
the need for show
Cyphre
12-Oct-2005
[98]
thanks guys...I agree Rebol should be able to use 'direct blitting' 
mode(bypass the compositing engine)
Henrik
12-Oct-2005
[99]
benjamin is it a celeron or pentium 4?
Benjamin
12-Oct-2005
[100]
amd
Henrik
12-Oct-2005
[101x2]
cyphre, maybe that's why show is heavy? Show is very resolution dependant, 
so if I set the screen area to just 800x600, dotflowers becomes about 
half as fast, no longer smooth. If I go to 1280x960, I get about 
5-7 fps.
screen area = window size, sorry
Cyphre
12-Oct-2005
[103]
yes, I have disscussed this with Carl on DevCon05. I hope we find 
a good solution to finally get faster blitting in View.
Henrik
12-Oct-2005
[104]
goodie :-)
Benjamin
12-Oct-2005
[105]
Fungus function will fly on this baby
BrianH
12-Oct-2005
[106x2]
A couple questions:

- Are the exit and return opcodes still implemented with setjump/longjump 
?

- Is there still a plan to enable rebcode procedures to call other 
rebcode procedures, other functions? Or do we just use the do opcode 
for that?
These are questions for later answer, when sensible Americans are 
awake :)
Henrik
12-Oct-2005
[108]
funny that it still eats 45% if I set the wait to 0.01 instead of 
0.001. maybe show is simply waiting for itself to finish before it 
can redraw?
Pekr
12-Oct-2005
[109]
btw - will there be updated documentation for Rebcode?
BrianH
12-Oct-2005
[110x2]
Just poking around, and found a hint of things to come. There are 
more new (not working yet) data types in addition to rebcode! and 
vector!: percent! and unicode! are there as well. This should be 
fun!
Now if only struct! worked...
Pekr
12-Oct-2005
[112]
:-) do you mean struct in Core? It seems to me that RT is now working 
really fast and working on new nice things ...
Volker
12-Oct-2005
[113]
cyphre, beautifull. :)
Anton
12-Oct-2005
[114]
Very nice too !!
Gabriele
12-Oct-2005
[115x6]
Brian: i think exit and return are implemented internally by wrapping 
a TRY around rebcode calls. About calling subroutines, that is planned.
about the rewriting: use the REBCODE-DEFINE function.
rebcode-define [
	my parse rule #==> production .
	my other parse rule #==> other production .
]
example:

context [
    slash: to lit-word! first [ / ]
    res: val: rest: mark1: mark2: op: rv: none
    value: [set val [decimal! | word! | paren!]]

    oper: ['+ (op: 'addd) | '- (op: 'subd) | '* (op: 'muld) | slash (op: 
    'divd)]
    rebcode-define [

        set res set-word! mark1: value some [oper mark2: value] (rest: copy/part 
        mark1 back mark2) #==>
            (res) (rest)

            (either paren? val [compose [rv: (to block! val)]] [ ])
            (op) (to word! res) (either paren? val ['rv] [val])
            .
        set res set-word! value #==> set (to word! res) (val) .
    ]
]
this allows expressions like:

f: rebcode [x y /local res] [
    res: x * x + (y * y)
    sqrt res
    return res
]
note that rewriting can also be used for optimization.
Pekr
12-Oct-2005
[121]
subroutines planned? For later or 1.0 rebcode release?
Volker
12-Oct-2005
[122]
I guess for completion they will. But are soubroutines necessary? 
we can do everything with macros? dont know hw much overhead passing 
arguments would be.
Pekr
12-Oct-2005
[123]
dunno, just asking :-)
Gabriele
12-Oct-2005
[124]
i think for release. but you should ask Carl.
Pekr
12-Oct-2005
[125]
Gabriele - what is the code above? You should not be so cruel to 
us novices - I've got a headache trying to understand, what above 
code does :-)
Gabriele
12-Oct-2005
[126x3]
:-P
That stuff is not for novices. Use REBOL instead. ;)
And if you ever have to use rebcode, make sure you wear protective 
glasses. ;)
Ladislav
12-Oct-2005
[129]
8-)