World: r3wp
[rebcode] Rebcode discussion
older newer | first last |
BrianH 23-Feb-2007 [1909] | You could even generate more of your interpreter by using more interesting macros, which would cut down on the programmer overhead of the increased number of states in your state machine. |
Steeve 23-Feb-2007 [1910x4] | like what ? |
like iterative macros | |
currently i want keep ly source readable | |
but after the debuguing phase, i think i could compact the code with more macros, i agree | |
BrianH 23-Feb-2007 [1914] | Perhaps you could specify your operations in a table and then go through it with a dialect processor like BURG - REBOL is good at that sort of thing. Then you could generate your interpreter from that table. |
Steeve 23-Feb-2007 [1915] | BURG ? sort of beer effect ? |
BrianH 23-Feb-2007 [1916] | No, BURG is a tool used to generate backends for compilers from a processor specification dialect. |
Steeve 23-Feb-2007 [1917] | :-) |
BrianH 23-Feb-2007 [1918x2] | It's for compilers written in C. I think you could do something like BURG in a few lines of REBOL though :) |
Plus the input data, of course. | |
Steeve 23-Feb-2007 [1920x3] | or you could add a a ReBurg function in the Rebol VM , to do that in my place :-) |
don't knwo Burg dialect | |
*know | |
BrianH 23-Feb-2007 [1923x2] | The dialect you would use probably wouldn't look much like BURG, since you are generating an interpreter. |
Your generator would probably act a lot more like a peephole optimizer. | |
Steeve 23-Feb-2007 [1925] | BTW, why rebcode thread is not on rebol.net ? |
BrianH 23-Feb-2007 [1926] | Few of the groups are. If I had to guess, it would be to avoid the reputation of vaporware. It has been a while since they have done a version of REBOL with rebcode, and it had some significant shortcomings. There may be no reason, though. |
Steeve 23-Feb-2007 [1927x3] | BrianH i test some changed with rebcode on my video emulation of the MSX, it seems than some native rebol instructions are more faster with image handling than rebcode |
for example i can copy one image to another one with change instruction but not using rebcode | |
rebcode can only handle byte series | |
BrianH 23-Feb-2007 [1930x2] | Yeah, rebcode just cuts down on interpreter overhead, but since its operations are a bit lower-level they aren't necessarily as fast. For simple operations it can be much faster, but natives are just that, optimized native code. |
Fortunately you can call the natives with the apply opcode and get the best of both worlds. | |
Steeve 23-Feb-2007 [1932x3] | fortunatly :) |
my interpreter will be faster if any math operations could act on char (one byte) | |
and if more flags was handled | |
BrianH 23-Feb-2007 [1935] | That isn't always the case with modern processors - some work faster with integers. I agree on the flags though, in your case. |
Steeve 23-Feb-2007 [1936x5] | could the T flag be set after a locial operation like AND ? |
very usefull to test if a bit is set | |
*after a logical operation | |
for example, if i want to test the 7th bit , i do and var 128 ift [ do the job] | |
instead of doing and var 128 eq.i var 128 ift [ do the job] | |
BrianH 23-Feb-2007 [1941] | Whae does SETT do here? |
Steeve 23-Feb-2007 [1942x2] | sett ? |
you mean | |
BrianH 23-Feb-2007 [1944] | It sets the T flag based on the contents of a variable. I think it sets T to false if the var has 0, none or false, and sets T to true otherwise. |
Steeve 23-Feb-2007 [1945] | and var 128 sett var ift [do the job] |
BrianH 23-Feb-2007 [1946x2] | Yeah. |
Try it. My memory of the behavior of SETT on 0 is a little sparse. | |
Steeve 23-Feb-2007 [1948] | i don't see any gain |
BrianH 23-Feb-2007 [1949] | It would be faster than a compare. |
Steeve 23-Feb-2007 [1950x4] | i use 3 instructions to test a bit in all cases |
should have: bit 7 [do the job] | |
:-) | |
missing the operand | |
BrianH 23-Feb-2007 [1954] | I'm curious, did you check SETT to see if the value 0 sets the T flag to false? |
Steeve 23-Feb-2007 [1955x3] | no sorry , i test now |
it works | |
anyway it's not really a problem, i never perform such tests | |
BrianH 23-Feb-2007 [1958] | Cool. So SETT can replace ZERO? and NONE?, which otherwise don't have rebcode equivalents. |
older newer | first last |