POV-Ray : Newsgroups : povray.off-topic : Reach for the SKI Server Time
8 Jul 2024 08:10:00 EDT (-0400)
  Reach for the SKI (Message 11 to 16 of 16)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Orchid Win7 v1
Subject: Re: Reach for the SKI
Date: 25 Jul 2015 04:10:57
Message: <55b34491$1@news.povray.org>
On 20/07/2015 10:03 PM, Orchid Win7 v1 wrote:
> It turns out you can write a parser that parses items and an execution
> engine that implements the 9 rules in less than 99 lines of shell
> script, as I shall shortly demonstrate.

Of course, you can also delete the Decode() function and all references 
to it, and the script will still work (and considerably faster too). 
That reduces the line count quite a bit.

So, does anybody feel bored enough to have a go at a SKI interpreter in 
other random programming languages?


Post a reply to this message

From: Orchid Win7 v1
Subject: Re: Reach for the SKI
Date: 25 Jul 2015 04:20:24
Message: <55b346c8$1@news.povray.org>
On 21/07/2015 05:58 PM, Orchid Win7 v1 wrote:
>> Rule #7: "P" - Delete the P, keep the next item, insert O, Z after it.
>
> I haven't looked into it properly yet, but it ought to be possible to
> dispense with this rule.

It appears instead of appending "GEP" to the initial program, you can 
append "GE(S(SI(KO))(KZ))", and dispense with the P-rule.

(I haven't actually tested this yet.)


Post a reply to this message

From: scott
Subject: Re: Reach for the SKI
Date: 27 Jul 2015 03:21:11
Message: <55b5dbe7$1@news.povray.org>
>> If L=1 then a[b] == b[a].
>
> Uh, how do you figure? The memory locations of the two variables might
> be in no way related.

"a" is a pointer-to type, "b" is an integer type.

a[b] just means read the memory at location a+b. The "+" operator 
doesn't care which way round the variables are. Also thinking about it, 
this probably works for any array type, as the "+" operator knows how to 
add an integer to a pointer-to type in general (it multiplies the 
integer by the size of each array element first).


Post a reply to this message

From: Andrel Linnenbank
Subject: Re: Reach for the SKI
Date: 28 Jul 2015 10:55:45
Message: <55b797f1$1@news.povray.org>
On 23-07-15 09:37, Orchid Win7 v1 wrote:

 > OTOH, if you look at the size of "S" verses "X(X(X(XX)))", you can see
 > that anything in the Iota calculus is going to be *really huge*!

depends on your encoding. if you use all brackets, the Xs are redundant. 
if you then encode ( by 0 and ) by 1, S is still only 8 bits and K only 6


Post a reply to this message

From: Orchid Win7 v1
Subject: Re: Reach for the SKI
Date: 28 Jul 2015 13:13:00
Message: <55b7b81c$1@news.povray.org>
On 28/07/2015 03:55 PM, Andrel Linnenbank wrote:
> On 23-07-15 09:37, Orchid Win7 v1 wrote:
>
>  > OTOH, if you look at the size of "S" verses "X(X(X(XX)))", you can see
>  > that anything in the Iota calculus is going to be *really huge*!
>
> depends on your encoding. if you use all brackets, the Xs are redundant.
> if you then encode ( by 0 and ) by 1, S is still only 8 bits and K only 6

I don't know, man. Consider:

   X(X(X(XX))) => ((()))
   X(XX(X(XX))) => ((()))

The former encodes S, the latter encodes K.

Another way of doing it is to use 0 to represent pushing X onto the 
stack, and 1 to represent pulling the top two stack items and making 
them into a tree, pushing the result back to the stack.

   X(X(X(XX))) = XXXXX^^^^ = 000001111

In this way, you can do something like

   KI = ( X(X(XX)) )(XX) = XXXX^^^XX^^ = 00001110011

I did also sit down and think about making a prefix code for SKI. 
Something where the code encodes how many arguments follow or something...


Post a reply to this message

From: Andrel Linnenbank
Subject: Re: Reach for the SKI
Date: 29 Jul 2015 17:39:14
Message: <55b94802$1@news.povray.org>
On 28-07-15 19:13, Orchid Win7 v1 wrote:
> On 28/07/2015 03:55 PM, Andrel Linnenbank wrote:
>> On 23-07-15 09:37, Orchid Win7 v1 wrote:
>>
>>  > OTOH, if you look at the size of "S" verses "X(X(X(XX)))", you can see
>>  > that anything in the Iota calculus is going to be *really huge*!
>>
>> depends on your encoding. if you use all brackets, the Xs are redundant.
>> if you then encode ( by 0 and ) by 1, S is still only 8 bits and K only 6
>
> I don't know, man. Consider:
>
>    X(X(X(XX))) => ((()))
>    X(XX(X(XX))) => ((()))

I think you are missing a couple of brackets

      X(X(X(X(X)))) => (((())))
      X(X(X)(X(X(X)))) => (()((())))

> The former encodes S, the latter encodes K.
>
> Another way of doing it is to use 0 to represent pushing X onto the
> stack, and 1 to represent pulling the top two stack items and making
> them into a tree, pushing the result back to the stack.
>
>    X(X(X(XX))) = XXXXX^^^^ = 000001111
>
> In this way, you can do something like
>
>    KI = ( X(X(XX)) )(XX) = XXXX^^^XX^^ = 00001110011
>
> I did also sit down and think about making a prefix code for SKI.
> Something where the code encodes how many arguments follow or something...


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.