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

World: r3wp

[rebcode] Rebcode discussion

Pekr
11-Oct-2005
[45x4]
to better support OS-X? So Internally you will switch to VM? Well, 
sorry for such questions, it is not just my level of knowledge - 
too low level :-)
So now someone can start thinking of writing JIT for rebcode, right? 
:-)
btw - would it (technically) make sense to provide interface to internal 
representation of datatypes? Dunno, just very primitive question, 
maybe it can't even technically work that way, but I thought that 
using technique as a rebcode, theoretically we could produce our 
own natives. Think of 'remove-each as an example. You had to provide 
us with one. I thought that if it would be possible to access e.g. 
block from within the rebcode, do some operations, that such functions 
could be done. Is that nonsense? :-)
Maybe we could rewrite some mezzanines then and have them more fast, 
but as I said - I am not even sure I know what I talk about :-)
Carl
11-Oct-2005
[49x2]
I've though a lot about internal access to datatypes, but the problem 
is that they change. For example, the 2.7.0 core kernel changes the 
internal id's for 80% of the datatypes.
So, the only way to do it would be to isolate them (datatype identifiers) 
via a lookup table.
Pekr
11-Oct-2005
[51]
wasn't it planned for so called language plug-ins some time ago?
Carl
11-Oct-2005
[52]
Yes, in fact it was the plugin design that made the problem clear.
Pekr
11-Oct-2005
[53]
So that ppl could write own components? Either in external language/libraries, 
or using VM?
Carl
11-Oct-2005
[54x3]
The more I worked on it, the more problems that came up.
A better approach is to use VM, and eventually JIT to native.
Then, if we come up with a datatype definition method, it may be 
possible to allow user created datatypes.
Pekr
11-Oct-2005
[57]
Yes, VM sounds good, but without internal access to datatypes? Dunno, 
will have to look into examples. Can't imagine manipulating block 
datatype for e.g. using VM :-)
Carl
11-Oct-2005
[58]
But, there would be many rules, because the user must be aware of 
GC and such.
Pekr
11-Oct-2005
[59]
Gabriele did something like that iirc ...
Carl
11-Oct-2005
[60]
Blocks are not very useful at VM level. Mostly strings, and the new 
Vector datatype.
Pekr
11-Oct-2005
[61]
Vector? AGG related?
Gabriele
11-Oct-2005
[62x5]
note about the new ASM: it has an iterative rewriting engine, so 
you can define rewriting rules and basically create your own assembler/compiler.
with it, i can write things like this:
f: rebcode [x y /local res] [
    res: x * x + (y * y)
    sqrt res
    return res
]
the x * x + (y * y) line is compiled to rebcode by the assembler, 
provided you give it the rules to do so :)
think of it as the macro expander in LISP, but more powerful (based 
on parse rules, so you can "expand" any dialect)
Carl
11-Oct-2005
[67x7]
New REBCODE release: www.rebol.net/builds/031/rebcode2.zip
Contains low level fixes and Gabriele's new assembler.
Both CORE and VIEW versions included.
Pekr: vector as a word for 1D array.
For example, vectors will let you create an optimal array of integers 
(unlike blocks).
Mostly useful for specific algorithms and use in rebcode VM.
But, note, not currently functional.
Henrik
11-Oct-2005
[74]
link is broken
Gabriele
11-Oct-2005
[75]
rebcode8.zip (there's a typo above)... but, wait, we found a couple 
bugs ;)
Carl
11-Oct-2005
[76]
New REBCODE release: www.rebol.net/builds/031/rebcode9.zip
Gabriele
11-Oct-2005
[77]
;you can try:
do http://www.colellachiara.com/soft/Misc/julia.r
Alan
11-Oct-2005
[78]
Carl:for some reason IE can not open/save rebcode9.zip-the page just 
gives me a blank icon ? But Firefox does work ! :)
Anton
12-Oct-2005
[79]
Very nice Gabriele :)
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 :-)