|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>> 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
|
|