From Esolang
Jump to: navigation, search


When I first read about the "rewriting paradigma" for computer languages, well soon after it came to my mind this could be something for a 16th century or medieval "computer".

I will present shortly some designs , some use two drums like early twenty century drum memory. Another uses just a punched tape.

I googled and found rescriptor is already in use for some medicine ....

For practical reason all those models should be modified to allow some form of output to a printer or tape puncher.

The Punched Tape Rescriptor/Reskribilo

Being the most simple design I present it first. Each tape is 96 bits width the length can vary but the tape must be fixed together on the ends so that it can rotate without further logic.

Every turn the 96 reading heads detect a pattern and compare it with what is stored in the probably mechanic or magnetic relays. Let's say there a 48 of them.

Every time a pattern is read by the reading heads they compare the first 48 bits of it with the content of the relays and if it's equal the relay content will be overwritten by the other half of the 96 bits.

Suppose that is read: G O O D - - - - M O R N I N G -

and that is the content of the relays : G O O D Y E A R

The - represents 111111. Six Bits form one character. A comparison with the - character returns always a true result. Every Character in the Relays is compared with the Pattern and if the result for all characters is true then the Pattern is replaced with the Replacement.

Thus in this sample GOODYEAR is replaced with MORNING. Because the replacement pattern is MORNING- the relays contain now MORNINGR because the R from GOODYEAR is not replaced.

There is no halt defined , however the Reskribilo can be halted and the status of the Relays can be checked.

The Punched Tape Rescriptor/Reskribilo does not match

- G O O D - - - - M O R N I N G -



which would somehow be desireable ( compare with the Thue-command GOOD::=MORNING ).For this reason more commands are needed , thus for our sample 4 more commands.

  G O O D - - - - M O R N I N G - 
  - G O O D - - - M O R N I N G - 
  - - G O O D - - M O R N I N G - 
  - - - G O O D - M O R N I N G - 
  - - - - G O O D M O R N I N G - 

I have choosen the 96 bits because of the ease for giving a sample. Of course it could be longer or smaller. The idea was using a fixed number of bits.

The Shifted Punched Tape Rescriptor/Reskribilo

Works like the unshifted one but shifts for every character, so that

- G O O D - - - - M O R N I N G -

matches G O O D Y E A R. Actually in my implementation the shifting is performed in the state and the rule pattern does not shift, although it could be quite the opposit.

The Two Drum Rescriptor/Reskribilo

uses two memory drums who rotate independently to provide the reading headers with fresh bits. One drum is for the rules the other one is for the state. It is like the Punched Tape Rescriptor/Reskribilo however for the relays there's another drum and machine can have more states/statuses ...

However there's also the shifting problem for matching and thus there is also a Shifted Two Drum Rescriptor/Reskribilo. As for the other designs there's no other form of obtaining result then switching of the machine and reading the memory in this case the state drum. For practical reason all those models should be modified to allow some form of output to a printer or tape puncher.

The Correcting Two Drum Resriptor/Reskribilo

is like the one above however, when no rules can be performed for some turns, this is recognized and one Drum actually becomes the rule Drum while the other one changes its role and becomes the state Drum. Until the rules of both Drums can not be performed for some turns.

There is no need for the rule Drum being twice as broad as the state Drum. It is just a matter of interpretation.

Implementation of the The Shifted Punched Tape Reskribilo (SPTR)

/*implementation of the rEsKrIb!lo machine */
/* the 96 bit Shifted Punched Tape Rescriptor/Reskribilo */

/* Usage: reskribilo rule-file input-string */
/* Example: reskribilo prog.x GOODYEAR */ 
/* there are no syntax checks so check for yourself*/


char R[4096]; 

void main(int argc,char *argv[])
{FILE *f; 
 int i,j,k,e,t,s;
 char Z[12],c; 

  /*the reads the input-string (just eight characters)*/ 

  /*get rules from file --- just reads the first 4096 bytes */
  /* q should end the whole loop by setting i to 32767 */
    if(R[i]=='-'){R[i]='-';} /*the speacial - character*/
    if(R[i]=='q'){k=i;i=32767;} /*the halting character*/

  /*program loop ... yawn ! zn aischloufn */
   {i=k; /*note that*/
       for(s=0;s<8;++s)/*shifting loop*/
       /*checking for equality and special character '-'*/

       printf("current rule: %s  current state: %s  ",&R[k],Z); 
       /*replacing , - in the replacement will not replace */
       /*The ShIfting*/
      }/*shifting loop*/   
    scanf("%c",&c);/*input q to exit program or something else to continue*/ 
    printf("Turn %d State %s\n",t,Z);
    ++t; /*and one more */

Sample Program for Testing for the Implementation above

--GOOD----THIS--q comment: use something like GOODYEAR as input string