<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.secondlife.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Subus+Tremor</id>
	<title>Second Life Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.secondlife.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Subus+Tremor"/>
	<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/wiki/Special:Contributions/Subus_Tremor"/>
	<updated>2026-07-28T23:27:32Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=RPN_Interpreter&amp;diff=1179386</id>
		<title>RPN Interpreter</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=RPN_Interpreter&amp;diff=1179386"/>
		<updated>2013-06-23T09:24:32Z</updated>

		<summary type="html">&lt;p&gt;Subus Tremor: Created page with &amp;quot;(http://www.gnu.org/copyleft/fdl.html) in the spirit of which this script is GPL&amp;#039;d. Copyright (C) 2013 Subus Tremor  This program is free software; you can redistribute it and/or…&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;(http://www.gnu.org/copyleft/fdl.html) in the spirit of which this script is GPL&#039;d. Copyright (C) 2013 Subus Tremor&lt;br /&gt;
&lt;br /&gt;
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.&lt;br /&gt;
&lt;br /&gt;
This is a reverse polish notation interpreter - it&#039;s also called 0-address-machine as it does not need addressable storage locations for it&#039;s operation . &lt;br /&gt;
It interprets rpn expressions. (see the code which operands are supported- feel free to change/extend it)&lt;br /&gt;
There is no debugging etc. provided.&lt;br /&gt;
&lt;br /&gt;
Create a box, and drop this script in it. Then edit the script and assign a rpn input expression to the input list - or even better :-) add an Input routine to it.&lt;br /&gt;
Save the script and touch your box to run the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
// Simple RPN calculator as lsl plugin sample for my Real Inworld Computer - by Subus Tremor&lt;br /&gt;
// made to compare it to the Real Inworld Computers rpn batch domme program notecard&lt;br /&gt;
&lt;br /&gt;
list    inlist;         // Input as list&lt;br /&gt;
list    stack;          // our stack&lt;br /&gt;
&lt;br /&gt;
push(string val) {&lt;br /&gt;
    stack = val + stack;&lt;br /&gt;
}&lt;br /&gt;
string pop() {&lt;br /&gt;
    string ret = llList2String(stack,0);&lt;br /&gt;
    stack = llDeleteSubList(stack,0,0);&lt;br /&gt;
    return ret;&lt;br /&gt;
}&lt;br /&gt;
string abop (string a, string b, string func) { // does rout = a op b&lt;br /&gt;
    string  rout;&lt;br /&gt;
    integer iout;&lt;br /&gt;
    float   fout;&lt;br /&gt;
    if((~llSubStringIndex(a,&amp;quot;.&amp;quot;))||(~llSubStringIndex(b,&amp;quot;.&amp;quot;))) { //float&lt;br /&gt;
        float fa = (float)a;&lt;br /&gt;
        float fb = (float)b;&lt;br /&gt;
        integer fia;&lt;br /&gt;
        if(func==&amp;quot;+&amp;quot;) fout = fa + fb;&lt;br /&gt;
        if(func==&amp;quot;-&amp;quot;) fout = fa - fb;&lt;br /&gt;
        if(func==&amp;quot;*&amp;quot;) fout = fa * fb;&lt;br /&gt;
        if(func==&amp;quot;/&amp;quot;) fout = fa / fb;&lt;br /&gt;
        if(func==&amp;quot;sin&amp;quot;) fout = llSin(fa);&lt;br /&gt;
        if(func==&amp;quot;cos&amp;quot;) fout = llCos(fa);&lt;br /&gt;
        if(func==&amp;quot;abs&amp;quot;) fout = llFabs(fa);&lt;br /&gt;
        rout = (string)fout;&lt;br /&gt;
        if(func==&amp;quot;round&amp;quot;) {iout = llRound(fa); rout = (string)iout;}        &lt;br /&gt;
    }&lt;br /&gt;
    else { //integer&lt;br /&gt;
        integer ia = (integer)a;&lt;br /&gt;
        integer ib = (integer)b;&lt;br /&gt;
        if(func==&amp;quot;+&amp;quot;) iout = ia + ib;&lt;br /&gt;
        if(func==&amp;quot;-&amp;quot;) iout = ia - ib;&lt;br /&gt;
        if(func==&amp;quot;*&amp;quot;) iout = ia * ib;&lt;br /&gt;
        if(func==&amp;quot;/&amp;quot;) iout = ia / ib;&lt;br /&gt;
        if(func==&amp;quot;%&amp;quot;) iout = ia % ib;&lt;br /&gt;
        if(func==&amp;quot;abs&amp;quot;) iout = llAbs(ia);&lt;br /&gt;
        if(func==&amp;quot;ceil&amp;quot;) iout = llCeil((float)a);&lt;br /&gt;
        if(func==&amp;quot;floor&amp;quot;) iout = llFloor((float)a);&lt;br /&gt;
        rout = (string)iout;&lt;br /&gt;
    }&lt;br /&gt;
    return rout;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//  two calculation samples - implement your own clever input providing to the calculator &lt;br /&gt;
list rpntask1 = [ &amp;quot;3&amp;quot;, &amp;quot;4&amp;quot;, &amp;quot;+&amp;quot;, &amp;quot;2&amp;quot;, &amp;quot;1&amp;quot;, &amp;quot;+&amp;quot;, &amp;quot;+&amp;quot;, &amp;quot;2&amp;quot;, &amp;quot;*&amp;quot;, &amp;quot;20&amp;quot;, &amp;quot;-&amp;quot;]; // sample 1&lt;br /&gt;
                // does: (((3+4)+(2+1))*2)-20&lt;br /&gt;
list rpntask2 = [ &amp;quot;3.14&amp;quot;, &amp;quot;sin&amp;quot;, &amp;quot;0.001593&amp;quot;, &amp;quot;/&amp;quot;, &amp;quot;1&amp;quot;, &amp;quot;-&amp;quot;]; // sample 2&lt;br /&gt;
                // does: (sin(3.14)/0.001593)-1&lt;br /&gt;
                &lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry() { // provide some input to the calculator&lt;br /&gt;
        inlist = rpntask2;&lt;br /&gt;
    }&lt;br /&gt;
    touch_start(integer num_detected) { // start calculation when touched&lt;br /&gt;
        state running;&lt;br /&gt;
    }  &lt;br /&gt;
}&lt;br /&gt;
state running&lt;br /&gt;
{&lt;br /&gt;
    state_entry() { //RPN calculation :-) do what we have to do while we are active&lt;br /&gt;
        integer inpointer=0;    // point to an item in inlist &lt;br /&gt;
        string _out;            // the special variable _out&lt;br /&gt;
        string b;               // the second operator variable&lt;br /&gt;
        string _last;           // keep the last input token till calculation&lt;br /&gt;
        //by intention written with jumps to make it compareable to the rpn domme program - the batch language of my Inworld computers&lt;br /&gt;
        @next;&lt;br /&gt;
        _out=llList2String(inlist,inpointer);   // take next&lt;br /&gt;
        _last=_out;&lt;br /&gt;
        inpointer++;&lt;br /&gt;
        if(_out==&amp;quot;&amp;quot;) jump end;&lt;br /&gt;
        if(llSubStringIndex(&amp;quot;+-*/%&amp;quot;,_out)&amp;gt;=0) jump args2;                 // ifin _out +-*/% args2&lt;br /&gt;
        if(llSubStringIndex(&amp;quot;sincosroundceilfloor&amp;quot;,_out)&amp;gt;=0) jump args1;  // ifin _out sincosroundceilfloor args1&lt;br /&gt;
        push(_out);             // push _out&lt;br /&gt;
        jump next;&lt;br /&gt;
        @args2;&lt;br /&gt;
        b=pop();                // pop , var b _out&lt;br /&gt;
        @args1;&lt;br /&gt;
        _out=pop();             // pop&lt;br /&gt;
        _out=abop(_out,b,_last);// abop _out b _last&lt;br /&gt;
        llSay(0,_out);          // out&lt;br /&gt;
        push(_out);             // push _out&lt;br /&gt;
        jump next;&lt;br /&gt;
        @end;&lt;br /&gt;
        llSay(0,&amp;quot;RPN calculation finished&amp;quot;);          // finished&lt;br /&gt;
        llResetScript();&lt;br /&gt;
    }    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;/div&gt;</summary>
		<author><name>Subus Tremor</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CatInterpreters&amp;diff=1179385</id>
		<title>CatInterpreters</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CatInterpreters&amp;diff=1179385"/>
		<updated>2013-06-23T09:14:03Z</updated>

		<summary type="html">&lt;p&gt;Subus Tremor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}{{RightToc}}&lt;br /&gt;
==Interpreters and Emulators==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;sortable&amp;quot; {{Prettytable}}&lt;br /&gt;
|- {{Hl2}}&lt;br /&gt;
! &#039;&#039;&#039;Name&#039;&#039;&#039;&lt;br /&gt;
! &#039;&#039;&#039;Creator&#039;&#039;&#039;&lt;br /&gt;
! &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
||[[Assembly Programming Language|Assembly-Like Programming Language]]&lt;br /&gt;
||[[User:Xaviar Czervik|Xaviar Czervik]]&lt;br /&gt;
||A compiler that runs assembly-like programs.&lt;br /&gt;
|-&lt;br /&gt;
||[[Computer:jaycoonlanguage]]&lt;br /&gt;
||[[User:jayco121 Bing|jayco121 Bing]]&lt;br /&gt;
|| A language written in LSL that is meant for my computer (available at the shop).&lt;br /&gt;
|-&lt;br /&gt;
||[[Scheme_Interpreter|Scheme Interpreter]]&lt;br /&gt;
||[[User:Xaviar Czervik|Xaviar Czervik]]&lt;br /&gt;
||A scheme interpreter capable of handling most scheme expressions, including lambda and lists.&lt;br /&gt;
|-&lt;br /&gt;
||[[Brainf***_Interpreter|Brainf*** Interpreter]]&lt;br /&gt;
||[[User:Subus Tremor|Subus Tremor]]&lt;br /&gt;
||A Brainf*** interpreter capable of handling short correct Brainf*** code.&lt;br /&gt;
|-&lt;br /&gt;
||[[RPN_Interpreter|RPN Interpreter]]&lt;br /&gt;
||[[User:Subus Tremor|Subus Tremor]]&lt;br /&gt;
||A RPN (reverse polish notation) interpreter for calculation of rpn expressions.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{LSLC|}}&lt;/div&gt;</summary>
		<author><name>Subus Tremor</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Brainf***_Interpreter&amp;diff=1179384</id>
		<title>Brainf*** Interpreter</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Brainf***_Interpreter&amp;diff=1179384"/>
		<updated>2013-06-23T09:08:59Z</updated>

		<summary type="html">&lt;p&gt;Subus Tremor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;(http://www.gnu.org/copyleft/fdl.html) in the spirit of which this script is GPL&#039;d. Copyright (C) 2013 Subus Tremor&lt;br /&gt;
&lt;br /&gt;
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.&lt;br /&gt;
&lt;br /&gt;
This is an esoteric language - that implies a useless programming language (except for the fun of it). &lt;br /&gt;
It interprets correct Brainf*** code. &lt;br /&gt;
There is no debugging etc. provided.&lt;br /&gt;
&lt;br /&gt;
Create a box, and drop this script in it. Then edit the script and assign a valid Brainf*** program code to variable program.&lt;br /&gt;
Save the script and touch your box to run the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
// The esoteric computer language Brainf*** - Interpreter for SL by Subus Tremor&lt;br /&gt;
//&lt;br /&gt;
// Data to the Interpreter - replace the string by any valid Brainf*** program&lt;br /&gt;
// if it&#039;s a valid progam AND has correct syntax AND does not run out of space -&lt;br /&gt;
// then it runs :-) otherwise not :-( have fun.&lt;br /&gt;
&lt;br /&gt;
//sample program1&lt;br /&gt;
string program1 = &amp;quot;Hello World program&lt;br /&gt;
++++++++++ initialize&lt;br /&gt;
[ start loop&lt;br /&gt;
&amp;gt;+++++++&amp;gt;++++++++++&amp;gt;+++&amp;gt;+&amp;lt;&amp;lt;&amp;lt;&amp;lt;- set some values&lt;br /&gt;
] end loop&lt;br /&gt;
&amp;gt;++. H out&lt;br /&gt;
&amp;gt;+. e out&lt;br /&gt;
+++++++. l out&lt;br /&gt;
. l out&lt;br /&gt;
+++. o out&lt;br /&gt;
&amp;gt;++. blank out&lt;br /&gt;
&amp;lt;&amp;lt;+++++++++++++++. W out&lt;br /&gt;
&amp;gt;. o out&lt;br /&gt;
+++. r out&lt;br /&gt;
------. l out&lt;br /&gt;
--------. d out&lt;br /&gt;
&amp;gt;+. ! out&lt;br /&gt;
&amp;gt;. lineend &lt;br /&gt;
&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
//sample program2&lt;br /&gt;
string program2 = &amp;quot;this brainf*** program asks for your name and then greets you&lt;br /&gt;
&amp;gt;+++++++++++[&amp;lt;++++++++&amp;gt;-]&amp;lt;-.&amp;gt;++++[&amp;lt;++++&amp;gt;-]&amp;lt;+.-------.&amp;gt;+++++&lt;br /&gt;
[&amp;lt;++++&amp;gt;-]&amp;lt;-.[-]&amp;gt;++++++++[&amp;lt;++++&amp;gt;-]&amp;lt;.&amp;gt;+++++++++[&amp;lt;++++++++&amp;gt;-]&amp;lt;&lt;br /&gt;
+.++++++++++.[-]&amp;gt;++++++++[&amp;lt;++++&amp;gt;-]&amp;lt;.&amp;gt;+++++++++++[&amp;lt;++++++++&amp;gt;&lt;br /&gt;
-]&amp;lt;+.----------.++++++.---.[-]&amp;gt;++++++++[&amp;lt;++++&amp;gt;-]&amp;lt;.&amp;gt;++++++++&lt;br /&gt;
+++++[&amp;lt;++++++&amp;gt;-]&amp;lt;.-------------.++++++++++++.--------.&amp;gt;++++&lt;br /&gt;
++[&amp;lt;------&amp;gt;-]&amp;lt;--.[-]+++++++++++++.---.[-]+[&amp;gt;,-------------]&lt;br /&gt;
&amp;gt;+++++++++[&amp;lt;++++++++&amp;gt;-]&amp;lt;.&amp;gt;+++++++[&amp;lt;++++&amp;gt;-]&amp;lt;+.+++++++..+++.[&lt;br /&gt;
-]&amp;gt;++++++++[&amp;lt;++++&amp;gt;-]&amp;lt;.[-]&amp;lt;-[&amp;lt;-]&amp;gt;[++++++++++++++.&amp;gt;]+++++++++&lt;br /&gt;
+.&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
list input = [82, 117, 116, 104, 13]; // input Ruth (the &amp;quot;name&amp;quot; the program is asking for)&lt;br /&gt;
integer n=0;&lt;br /&gt;
&lt;br /&gt;
// The Brainf*** interpreter&lt;br /&gt;
integer commandpointer = 0;         //point to 0 at start&lt;br /&gt;
string  command = &amp;quot;&amp;quot;;               &lt;br /&gt;
list  storage = [&amp;quot;0&amp;quot;];              //first storage cell inizialized to 0&lt;br /&gt;
integer cellpointer = 0;&lt;br /&gt;
integer cell=0;                     &lt;br /&gt;
&lt;br /&gt;
string  bfelements = &amp;quot;+-&amp;gt;&amp;lt;[].,&amp;quot;;    //the Brainf*** commands&lt;br /&gt;
integer pl=0;                       //program lenght&lt;br /&gt;
integer pc=0;                       //blockcounter&lt;br /&gt;
integer si=0;                       //stackindex&lt;br /&gt;
string program;                     //contains the progeam to be interpreted&lt;br /&gt;
&lt;br /&gt;
list blocklist;&lt;br /&gt;
integer waitforchar=FALSE;&lt;br /&gt;
&lt;br /&gt;
makeblocklist() { // to avoid searching - loop structure [ ] is evaluated in advance&lt;br /&gt;
    integer i=0;&lt;br /&gt;
    list stack;&lt;br /&gt;
    integer s;&lt;br /&gt;
    integer ie = llStringLength(program);&lt;br /&gt;
    for(; i &amp;lt; ie; i+=1) {&lt;br /&gt;
        if(llGetSubString(program, i, i)==&amp;quot;[&amp;quot;) { //begin&lt;br /&gt;
        stack = i + stack;        &lt;br /&gt;
        }&lt;br /&gt;
        if(llGetSubString(program, i, i)==&amp;quot;]&amp;quot;) { //end&lt;br /&gt;
            if(llGetListLength(stack)&amp;gt;0) {&lt;br /&gt;
                s = llList2Integer(stack,0);&lt;br /&gt;
                stack = llDeleteSubList(stack,0,0);&lt;br /&gt;
                blocklist = blocklist + s + i;&lt;br /&gt;
            }  &lt;br /&gt;
        }&lt;br /&gt;
    }   &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        program=program1;   // assign valid Brainf*** code to the variable program&lt;br /&gt;
                            // either program1 or program2 or your own code&lt;br /&gt;
        makeblocklist();    // build the loop structure in advance&lt;br /&gt;
    }&lt;br /&gt;
    touch_start(integer total_number)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;Interpreter start&amp;quot;);&lt;br /&gt;
        state interpret;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
state interpret {&lt;br /&gt;
    state_entry() // run the Brainf*** Interpreter&lt;br /&gt;
    {&lt;br /&gt;
        do { // interpret the Brainf*** code in variable program&lt;br /&gt;
            command = llGetSubString( program, commandpointer, commandpointer );&lt;br /&gt;
            if(command==&amp;quot;+&amp;quot;) { // increment cell at cellpointer&lt;br /&gt;
                cell = llList2Integer(storage,cellpointer)+1;&lt;br /&gt;
                storage = llListReplaceList(storage, [cell], cellpointer, cellpointer);&lt;br /&gt;
            }&lt;br /&gt;
            if(command==&amp;quot;-&amp;quot;) { // decrement cell at cellpointer&lt;br /&gt;
                cell = llList2Integer(storage,cellpointer)-1;&lt;br /&gt;
                storage = llListReplaceList(storage, [cell], cellpointer, cellpointer);&lt;br /&gt;
            }&lt;br /&gt;
            if(command==&amp;quot;&amp;gt;&amp;quot;) { // point at next cell&lt;br /&gt;
                if((llGetListLength(storage)-1)==cellpointer) storage += 0;&lt;br /&gt;
                cellpointer+=1;&lt;br /&gt;
                cell = llList2Integer(storage,cellpointer);&lt;br /&gt;
            }&lt;br /&gt;
            if(command==&amp;quot;&amp;lt;&amp;quot;) { // point ar previous cell&lt;br /&gt;
                cellpointer-=1;&lt;br /&gt;
                cell = llList2Integer(storage,cellpointer);&lt;br /&gt;
            }&lt;br /&gt;
            if(command==&amp;quot;.&amp;quot;) { // output one character&lt;br /&gt;
                cell = llList2Integer(storage,cellpointer);&lt;br /&gt;
                llSay(0,llGetSubString(llBase64ToString(llIntegerToBase64((integer)cell &amp;lt;&amp;lt; 24)),0,0));&lt;br /&gt;
            }&lt;br /&gt;
            if(command==&amp;quot;,&amp;quot;) { // input one character&lt;br /&gt;
                if(waitforchar==FALSE) {&lt;br /&gt;
                    waitforchar=TRUE;&lt;br /&gt;
                    llSay(0,&amp;quot;reading 1 input char now&amp;quot;);&lt;br /&gt;
                    state waitchar;&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    waitforchar = FALSE;&lt;br /&gt;
                    storage = llListReplaceList(storage, [cell], cellpointer, cellpointer);&lt;br /&gt;
                }&lt;br /&gt;
            }            &lt;br /&gt;
            if(((command==&amp;quot;]&amp;quot;)&amp;amp;&amp;amp;(cell!=0))||((command==&amp;quot;[&amp;quot;)&amp;amp;&amp;amp;(cell==0))) { // handle loops &lt;br /&gt;
                    integer bindex = llListFindList(blocklist,[commandpointer]);&lt;br /&gt;
                    if(command==&amp;quot;[&amp;quot;) bindex++; else bindex--;&lt;br /&gt;
                    commandpointer = llList2Integer(blocklist, bindex)+1;&lt;br /&gt;
            }&lt;br /&gt;
            else commandpointer++; // point at next instruction&lt;br /&gt;
        } while (commandpointer&amp;lt;llStringLength(program)-1);&lt;br /&gt;
        llSay(0,&amp;quot;Interpreter finished&amp;quot;);&lt;br /&gt;
        llResetScript();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
state waitchar {&lt;br /&gt;
    state_entry() // get inputcharacters, input ends if char hex 13 is detected&lt;br /&gt;
    {&lt;br /&gt;
        if(n&amp;lt;llGetListLength(input)) {&lt;br /&gt;
            cell = llList2Integer(input,n);&lt;br /&gt;
            n++;&lt;br /&gt;
        }&lt;br /&gt;
    state interpret;        &lt;br /&gt;
    }  &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;/div&gt;</summary>
		<author><name>Subus Tremor</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Brainf***_Interpreter&amp;diff=1179380</id>
		<title>Brainf*** Interpreter</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Brainf***_Interpreter&amp;diff=1179380"/>
		<updated>2013-06-22T17:12:23Z</updated>

		<summary type="html">&lt;p&gt;Subus Tremor: Created page with &amp;quot;(http://www.gnu.org/copyleft/fdl.html) in the spirit of which this script is GPL&amp;#039;d. Copyright (C) 2013 Subus Tremor  This program is free software; you can redistribute it and/or…&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;(http://www.gnu.org/copyleft/fdl.html) in the spirit of which this script is GPL&#039;d. Copyright (C) 2013 Subus Tremor&lt;br /&gt;
&lt;br /&gt;
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.&lt;br /&gt;
&lt;br /&gt;
This is an esoteric language - that implies a useless programming language (except for the fun of it). &lt;br /&gt;
It interprets correct Brainf*** code. &lt;br /&gt;
There is no debugging etc. provided.&lt;br /&gt;
&lt;br /&gt;
Create a box, and drop this script in it. Then edit the script and assign a valid Brainf*** program code to variable program.&lt;br /&gt;
Save the script and touch your box to run the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
// The esoteric computer language Brainf*** - Interpreter for SL by Subus Tremor&lt;br /&gt;
//&lt;br /&gt;
// Data to the Interpreter - replace the string by any valid Brainf*** program&lt;br /&gt;
// if it&#039;s a valid progam AND has correct syntax AND does not run out of space -&lt;br /&gt;
// then it runs :-) otherwise not :-( have fun.&lt;br /&gt;
&lt;br /&gt;
//sample program1&lt;br /&gt;
string program1 = &amp;quot;Hello World program&lt;br /&gt;
++++++++++ initialize&lt;br /&gt;
[ start loop&lt;br /&gt;
&amp;gt;+++++++&amp;gt;++++++++++&amp;gt;+++&amp;gt;+&amp;lt;&amp;lt;&amp;lt;&amp;lt;- set some values&lt;br /&gt;
] end loop&lt;br /&gt;
&amp;gt;++. H out&lt;br /&gt;
&amp;gt;+. e out&lt;br /&gt;
+++++++. l out&lt;br /&gt;
. l out&lt;br /&gt;
+++. o out&lt;br /&gt;
&amp;gt;++. blank out&lt;br /&gt;
&amp;lt;&amp;lt;+++++++++++++++. W out&lt;br /&gt;
&amp;gt;. o out&lt;br /&gt;
+++. r out&lt;br /&gt;
------. l out&lt;br /&gt;
--------. d out&lt;br /&gt;
&amp;gt;+. ! out&lt;br /&gt;
&amp;gt;. lineend &lt;br /&gt;
&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
//sample program2&lt;br /&gt;
string program2 = &amp;quot;this brainf*** program asks for your name and then greets you&lt;br /&gt;
&amp;gt;+++++++++++[&amp;lt;++++++++&amp;gt;-]&amp;lt;-.&amp;gt;++++[&amp;lt;++++&amp;gt;-]&amp;lt;+.-------.&amp;gt;+++++&lt;br /&gt;
[&amp;lt;++++&amp;gt;-]&amp;lt;-.[-]&amp;gt;++++++++[&amp;lt;++++&amp;gt;-]&amp;lt;.&amp;gt;+++++++++[&amp;lt;++++++++&amp;gt;-]&amp;lt;&lt;br /&gt;
+.++++++++++.[-]&amp;gt;++++++++[&amp;lt;++++&amp;gt;-]&amp;lt;.&amp;gt;+++++++++++[&amp;lt;++++++++&amp;gt;&lt;br /&gt;
-]&amp;lt;+.----------.++++++.---.[-]&amp;gt;++++++++[&amp;lt;++++&amp;gt;-]&amp;lt;.&amp;gt;++++++++&lt;br /&gt;
+++++[&amp;lt;++++++&amp;gt;-]&amp;lt;.-------------.++++++++++++.--------.&amp;gt;++++&lt;br /&gt;
++[&amp;lt;------&amp;gt;-]&amp;lt;--.[-]+++++++++++++.---.[-]+[&amp;gt;,-------------]&lt;br /&gt;
&amp;gt;+++++++++[&amp;lt;++++++++&amp;gt;-]&amp;lt;.&amp;gt;+++++++[&amp;lt;++++&amp;gt;-]&amp;lt;+.+++++++..+++.[&lt;br /&gt;
-]&amp;gt;++++++++[&amp;lt;++++&amp;gt;-]&amp;lt;.[-]&amp;lt;-[&amp;lt;-]&amp;gt;[++++++++++++++.&amp;gt;]+++++++++&lt;br /&gt;
+.&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
list input = [82, 117, 116, 104, 13]; // input Ruth (the &amp;quot;name&amp;quot; the program is asking for)&lt;br /&gt;
integer n=0;&lt;br /&gt;
&lt;br /&gt;
// The Brainf*** interpreter&lt;br /&gt;
integer commandpointer = 0;         //point to 0 at start&lt;br /&gt;
string  command = &amp;quot;&amp;quot;;               &lt;br /&gt;
list  storage = [&amp;quot;0&amp;quot;];              //first storage cell inizialized to 0&lt;br /&gt;
integer cellpointer = 0;&lt;br /&gt;
integer cell=0;                     &lt;br /&gt;
&lt;br /&gt;
string  bfelements = &amp;quot;+-&amp;gt;&amp;lt;[].,&amp;quot;;    //the Brainf*** commands&lt;br /&gt;
integer pl=0;                       //program lenght&lt;br /&gt;
integer pc=0;                       //blockcounter&lt;br /&gt;
integer si=0;                       //stackindex&lt;br /&gt;
string program;                     //contains the progeam to be interpreted&lt;br /&gt;
&lt;br /&gt;
list blocklist;&lt;br /&gt;
integer waitforchar=FALSE;&lt;br /&gt;
&lt;br /&gt;
makeblocklist() { // to avoid searching - loop structure [ ] is evaluated in advance&lt;br /&gt;
    integer i=0;&lt;br /&gt;
    list stack;&lt;br /&gt;
    integer s;&lt;br /&gt;
    integer ie = llStringLength(program);&lt;br /&gt;
    for(; i &amp;lt; ie; i+=1) {&lt;br /&gt;
        if(llGetSubString(program, i, i)==&amp;quot;[&amp;quot;) { //begin&lt;br /&gt;
        stack = i + stack;        &lt;br /&gt;
        }&lt;br /&gt;
        if(llGetSubString(program, i, i)==&amp;quot;]&amp;quot;) { //end&lt;br /&gt;
            if(llGetListLength(stack)&amp;gt;0) {&lt;br /&gt;
                s = llList2Integer(stack,0);&lt;br /&gt;
                stack = llDeleteSubList(stack,0,0);&lt;br /&gt;
                blocklist = blocklist + s + i;&lt;br /&gt;
            }  &lt;br /&gt;
        }&lt;br /&gt;
    }   &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        program=program1;   // assign valid Brainf*** code to the variable program&lt;br /&gt;
                            // either program1 or program2 or your own code&lt;br /&gt;
        makeblocklist();    // build the loop structure in advance&lt;br /&gt;
    }&lt;br /&gt;
    touch_start(integer total_number)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;Interpreter start&amp;quot;);&lt;br /&gt;
        state interpret;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
state interpret {&lt;br /&gt;
    state_entry() // run the Brainf*** Interpreter&lt;br /&gt;
    {&lt;br /&gt;
        do { // interpret the Brainf*** code in variable program&lt;br /&gt;
            command = llGetSubString( program, commandpointer, commandpointer );&lt;br /&gt;
            if(command==&amp;quot;+&amp;quot;) { // increment cell at cellpointer&lt;br /&gt;
                cell = llList2Integer(storage,cellpointer)+1;&lt;br /&gt;
                storage = llListReplaceList(storage, [cell], cellpointer, cellpointer);&lt;br /&gt;
            }&lt;br /&gt;
            if(command==&amp;quot;-&amp;quot;) { // decrement cell at cellpointer&lt;br /&gt;
                cell = llList2Integer(storage,cellpointer)-1;&lt;br /&gt;
                storage = llListReplaceList(storage, [cell], cellpointer, cellpointer);&lt;br /&gt;
            }&lt;br /&gt;
            if(command==&amp;quot;&amp;gt;&amp;quot;) { // point at next cell&lt;br /&gt;
                if((llGetListLength(storage)-1)==cellpointer) storage += 0;&lt;br /&gt;
                cellpointer+=1;&lt;br /&gt;
                cell = llList2Integer(storage,cellpointer);&lt;br /&gt;
            }&lt;br /&gt;
            if(command==&amp;quot;&amp;lt;&amp;quot;) { // point ar previous cell&lt;br /&gt;
                cellpointer-=1;&lt;br /&gt;
                cell = llList2Integer(storage,cellpointer);&lt;br /&gt;
            }&lt;br /&gt;
            if(command==&amp;quot;.&amp;quot;) { // output one character&lt;br /&gt;
                cell = llList2Integer(storage,cellpointer);&lt;br /&gt;
                llSay(0,llGetSubString(llBase64ToString(llIntegerToBase64((integer)cell &amp;lt;&amp;lt; 24)),0,0));&lt;br /&gt;
            }&lt;br /&gt;
            if(command==&amp;quot;,&amp;quot;) { // input one character&lt;br /&gt;
                if(waitforchar==FALSE) {&lt;br /&gt;
                    waitforchar=TRUE;&lt;br /&gt;
                    llSay(0,&amp;quot;reading 1 input char now&amp;quot;);&lt;br /&gt;
                    state waitchar;&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    waitforchar = FALSE;&lt;br /&gt;
                    storage = llListReplaceList(storage, [cell], cellpointer, cellpointer);&lt;br /&gt;
                }&lt;br /&gt;
            }            &lt;br /&gt;
            if(((command==&amp;quot;]&amp;quot;)&amp;amp;&amp;amp;(cell!=0))||((command==&amp;quot;[&amp;quot;)&amp;amp;&amp;amp;(cell==0))) { // handle loops &lt;br /&gt;
                    integer bindex = llListFindList(blocklist,[commandpointer]);&lt;br /&gt;
                    if(command==&amp;quot;[&amp;quot;) bindex++; else bindex--;&lt;br /&gt;
                    commandpointer = llList2Integer(blocklist, bindex)+1;&lt;br /&gt;
            }&lt;br /&gt;
            else commandpointer++; // point at next instruction&lt;br /&gt;
        } while (commandpointer&amp;lt;llStringLength(program)-1);&lt;br /&gt;
        llSay(0,&amp;quot;Interpreter finished&amp;quot;);&lt;br /&gt;
        llResetScript();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
state waitchar {&lt;br /&gt;
    state_entry() // get inputcharacters, input ends if char hex 13 is detected&lt;br /&gt;
    {&lt;br /&gt;
        if(n&amp;lt;llGetListLength(input)) {&lt;br /&gt;
            cell = llList2Integer(input,n);&lt;br /&gt;
            n++;&lt;br /&gt;
            state interpret;&lt;br /&gt;
        }&lt;br /&gt;
    state interpret;        &lt;br /&gt;
    }  &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;/div&gt;</summary>
		<author><name>Subus Tremor</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CatInterpreters&amp;diff=1179379</id>
		<title>CatInterpreters</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CatInterpreters&amp;diff=1179379"/>
		<updated>2013-06-22T16:48:28Z</updated>

		<summary type="html">&lt;p&gt;Subus Tremor: /* Interpreters and Emulators */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}{{RightToc}}&lt;br /&gt;
==Interpreters and Emulators==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;sortable&amp;quot; {{Prettytable}}&lt;br /&gt;
|- {{Hl2}}&lt;br /&gt;
! &#039;&#039;&#039;Name&#039;&#039;&#039;&lt;br /&gt;
! &#039;&#039;&#039;Creator&#039;&#039;&#039;&lt;br /&gt;
! &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
||[[Assembly Programming Language|Assembly-Like Programming Language]]&lt;br /&gt;
||[[User:Xaviar Czervik|Xaviar Czervik]]&lt;br /&gt;
||A compiler that runs assembly-like programs.&lt;br /&gt;
|-&lt;br /&gt;
||[[Computer:jaycoonlanguage]]&lt;br /&gt;
||[[User:jayco121 Bing|jayco121 Bing]]&lt;br /&gt;
|| A language written in LSL that is meant for my computer (available at the shop).&lt;br /&gt;
|-&lt;br /&gt;
||[[Scheme_Interpreter|Scheme Interpreter]]&lt;br /&gt;
||[[User:Xaviar Czervik|Xaviar Czervik]]&lt;br /&gt;
||A scheme interpreter capable of handling most scheme expressions, including lambda and lists.&lt;br /&gt;
|-&lt;br /&gt;
||[[Brainf***_Interpreter|Brainf*** Interpreter]]&lt;br /&gt;
||[[User:Subus Tremor|Subus Tremor]]&lt;br /&gt;
||A Brainf*** interpreter capable of handling short correct Brainf*** code.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{LSLC|}}&lt;/div&gt;</summary>
		<author><name>Subus Tremor</name></author>
	</entry>
</feed>