.m@dpr'a'prozessor

From Esolang
Jump to navigation Jump to search

By the way in case you have not read the page about .mOdMoDwOrM I recommend you to do so for understanding better what is now coming.

The m@dpr'a'prozessor creates input data or worm files for moDMoDwOrM, because it hardly can do without that. Its purpose is thus to define how the input data should be processed so that it can be best processed by mOdMoDwOrM. Don't ask me why I have not called it worm creator what it obviously is.

Suppose we want to write a brainfuck interpreter for moDMoDwOrM, but it can not process the brainfuck input because it is no valid worm , Iworm , worm file or whatever, in the same way hieroglyphs are much likely not understood by your neighbour next door.

So right now some m@dpr'a'prozessor code for the processing of brainfuck.

order +
symbol [ [
symbol ] ]
symbol < <
symbol > >
symbol + +
symbol - -
symbol . .
symbol , ,
length c 
end 

So what does this all mean. The first line means that the order of the brainfuck instructions should be preserved, because that is required for a useful execution of the program. They symbol lines are of importance, because they define what symbols are in the source file and to which moDMoDwOrM symbols they should be translated. It is possible to translate more than one different source file symbols to one moDMoDwOrM symbol.

A source file symbol can be more than one characters long. Thus following would be a valid line of m@dpr'a'prozessor code.

symbol end q 

By the way I can also explain the first line a bit further. The command order must come first and have one of the following parameters + or -. - means that the order of the symbols should be completly ignored and only there quantity of appearance be counted. The order command can appear more than once in a m@dpr'a'prozessor file, but there should be dealed later with it.

The length c line means that c should contain the number of symbols counted int the source file. (More later)

The end command obviously marks the end of the file and must only occur only once in the file.

So how is the worm created.

The brainfuck source file

>+<[]-.

Every occurence of > is marked with 1 , every non-occurence with 0 and the same with all other symbols.

Thus

[ 0001000
] 0000100
< 0010000
> 1000000
+ 0100000
- 0000010
. 0000001
, 0000000    

Obviously those are binary numbers which are converted to decimal. However its better we turn them so that 0000100 gets 0010000.

Thus we get 
[0001000]0010000<0000100>0000001+0000010-0100000.1000000
and finally 
[8]16<4>1+2-32.64

So that should be almost the worm file. Remember the length c line. Since we had seven symbols in this sample we just add c7 and thus should get

[8]16<4>1+2-32.64c7
II

By replacing order + with order - we should get

[]<>+-.c7
II