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

World: r3wp

[rebcode] Rebcode discussion

BrianH
25-Oct-2005
[874]
Well I am in Chicago, but I'll still vote only once :)
Henrik
25-Oct-2005
[875]
rebcode is like politics for me. I don't really care :-)
Volker
25-Oct-2005
[876]
I do like it if your opinion is not choosen, as long as mine is! 
Have to look if i like democracy now. :)
Henrik
25-Oct-2005
[877]
as in the voting part
BrianH
25-Oct-2005
[878]
Something non-vote-related, would it be possible to have to-dec just 
assign the source to the destination when the source value is already 
a decimal? And the same for to-int, types adjusted?
Volker
25-Oct-2005
[879]
then you cant convert in-place, as in your example. to-dec  a a
BrianH
25-Oct-2005
[880x2]
Right now to-dec sets the destination word to none if the source 
word refers to a decimal already.
And to-int works the equivalent way.
Volker
25-Oct-2005
[882x2]
oops. misreaded just for only.
I agree then.
BrianH
25-Oct-2005
[884x6]
This is a place where I'd be willing to add a couple cycles just 
to prevent extremely obscure bugs.
By the way, I would prefer that randz and the trigonometric opcodes 
not be renamed unless you are planning to make versions of them for 
each type. They are already documented as being type-specific and 
there's only one of each, so it shouldn't be a problem.
Sorry, to-dec assigns 0.0 when the source is a decimal, not none. 
At least you can count on the dest being a decimal afterwards...
See what I mean by obscure bugs?
And to-int assigns 1 when the source is an integer. They're not even 
consistent with each other.
Submitted to RAMBO.
Benjamin
26-Oct-2005
[890]
hoo third option seems fineto me
BrianH
26-Oct-2005
[891]
Does anyone still need to vote?
Ladislav
26-Oct-2005
[892]
looking at the checklist I see, that there was somebody not adhering 
to the rules :-)
Henrik
26-Oct-2005
[893]
never send a checklist to do a voting applications' job :-)
BrianH
26-Oct-2005
[894x2]
Yeah, I noticed that the votes didn't add up to a multiple of three.
Whoops, I guess they do now.
Ladislav
26-Oct-2005
[896]
:-)
Alan
26-Oct-2005
[897]
1
DideC
26-Oct-2005
[898x2]
The survey helped (even with those who didn't play the game ;)
Thans to all
thanks
BrianH
26-Oct-2005
[900]
I've written a patch to the assembler that implements a working OFFSET 
directive and label value fixups. I will submit it to RAMBO as an 
enhancement request.
[unknown: 5]
26-Oct-2005
[901]
I don't know enough about rebcode to do any voting - there any docs 
yet?
BrianH
26-Oct-2005
[902x5]
; You use it like this
label x
;...
offset y 5
sub y x
braw y
Note that label, offset and the branches all calculate relative to 
the end of their statements.
Just after the end, rather.
If anyone wants to test the patch, here it is.
REBOL []


use [fixup-rule label-rule label-fixup-rule label-error-rule here] 
[
    ; Initialize the intermediate rules
    label-rule: make block! 0
    label-fixup-rule: make block! 0
    label-error-rule: make block! 0
    ; Build the fixup-rule based on the opcode-rule
    fixup-rule: copy/deep rebcode*/opcode-rule
    parse fixup-rule [
        some [
            here: 
            lit-word! block! '| (

                unless find ['bra 'brat 'braf] here/1 [insert here/2 [label-error-rule 
                |]]
            ) |
            lit-word! 'word! '| (

                unless 'label = here/1 [here/2: [label-error-rule | word!]]
            ) |
            lit-word! | '| | 'block! | 'series! |
            'word! (here/1: [label-error-rule | word!]) |
            'any-type! (here/1: [label-fixup-rule | any-type!]) |
            into ['integer! '| 'word! | 'word! '| 'integer!] (
                insert here/1 [label-fixup-rule |]
            ) |
            block! (insert here/1 [label-error-rule |])
        ]
    ]
    ; Replace the fix-bl function

    rebcode*/fix-bl: func [block /local labels here there label rule] 
    bind [
        labels: make block! 16
        block-action: :fix-bl
        if debug? [print "=== Fixing binding and labels... ==="]
        parse block [
            some [
                here:
                subblock-rule (here/1: bind here/1 words)
                |

                'label word! (here/1: bind here/1 words insert insert tail labels 
                here/2 index? here)
                |
                'offset word! integer! (
                    here/1: bind 'set words
                    here/3: 3 + here/3 + index? here

                    if (here/3 < 1) or (here/3 > 1 + length? block) [
                        error/with here "Offset out of bounds:"
                    ]
                )
                |
                opcode-rule (here/1: bind here/1 words)
                |
                skip (error here)
            ]
        ]
        either 0 < length? labels [
            label-rule: make block! length? labels

            foreach [key val] labels [insert insert tail label-rule to-lit-word 
            key '|]
            clear back tail label-rule

            label-fixup-rule: [there: label-rule (there/1: 2 + select labels 
            there/1)]

            label-error-rule: [label-rule (error/with here "Cannot use label 
            here:")]
            rule: fixup-rule
        ] [
            rule: opcode-rule
        ]
        parse block [
            some [
                here:
                ['bra word! | 'brat word! | 'braf word!] (

                    if not label: select labels here/2 [error/with here "Missing label:"]
                    here/2: label - index? here
                )
                |
                rule
                |
                skip (error here)
            ]
        ]
    ] rebcode*
]
Rebolek
27-Oct-2005
[907]
somebody must really like the add.i/add.d version. It's got priority 
20 now :)
Volker
27-Oct-2005
[908x2]
can i have preincrement/postdecrement then?
if we go 68k. ;)
Rebolek
27-Oct-2005
[910]
I don't like, it doesn't look like REBOL with the dot. Is it tuple 
or url? No, it isn't. So why the dot?
Volker
27-Oct-2005
[911x2]
because its assembler and 68k did it that way. dont like it too.
have you voted already? :)
Rebolek
27-Oct-2005
[913]
Yes, for the addi/addd version.
Pekr
27-Oct-2005
[914]
but it is not an assembly ;-) It is rebol dialect .... I agree with 
Kru ....
Volker
27-Oct-2005
[915]
Have you voted? shall we vote again? :)
Sunanda
27-Oct-2005
[916]
I agree with kru -- pity there is no option for making them look 
like refinements
  add/i
  add/d
  add   -- default is /i or /d or whatever is chosen
Volker
27-Oct-2005
[917]
suggested that to. Was told its technially no option, they must be 
words.
Rebolek
27-Oct-2005
[918]
or add-i/add-d. More REBOLish than dot.
Pekr
27-Oct-2005
[919x2]
exactly ....
I-am-already-used-to-rebolish-way :-)
BrianH
27-Oct-2005
[921x2]
The only advantages I can see to the dot (as opposed to the - ) is 
that it is less visually imposing and that it is easier for me to 
reach on my keyboard. These advantages are not insignificant, though.
Either dot or - would be OK to me.
Ladislav
28-Oct-2005
[923]
here is a poll