Post-preprocessor

From Esolang
Jump to navigation Jump to search

This esolang is made by User:A, inspired by preprocessor.

Syntax

= command

There are three types of = commands, object-like, if-like and function-like. Object-like macros do not take parameters; function-like macros do (although the list of parameters may be empty). The generic syntax for declaring an identifier as a macro of each type is, respectively:

<identifier>=<replacement token list>                    // object-like
<identifier>(<parameter list>)=<replacement token list>  //Function-like
<condition>=<replacement token list>            //If-like

Note that a function or if defenition can take more than 1 lines, as long as it ends with end. There are, of course, operators(math,logic,comparison)which are not listed here.(They are exactly the same as in C) Oh, just forgot to tell you how to call the function:

function()

To use a macro value:

macro

Computational Class

This is an attempt to compile Home Row into Preprocessor, using only 2(2 is enough, as said here) variable-macros.

Well, if that is wrong, you can define 8.

Define 2 variables:

a=0
b=0

a:

a=a+1

Just note that a can be both a and b.

s:

a=a-1

d and f

This does not produce direct code(Just switch the variables).

k and ;

This also doesn't produce any code, but(I think) this woultn't affect TC-ness.

j

Well, that is easy:

n!=0=
 //1st command
end
//second command

l

more complicated...

loop()=
    a != 0 =
        //Stuff all your loop commands HERE
        loop()
    end
    a == 0 =
    end
end

There is only 1 instruction.

Try to compile 3-cell Brainfuck

This 3-cell no I/O Brainfuck can implement the Collatz Function, so it is Turing-complete. Define 3 variables.

a=0
b=0
c=0

+

a=a+1

where a= any variable from a to c.

-

a=a-1

> and <

These don't directly produce code---they just imple switching variables.

[ and ]

//Very complicated-don't get yourself dizzy.
loop()=//main loop function. For nested loops, change it into loop1, loop2, etc.
    a != 0=//a is the cell you want to check
        //Stuff all your loop commands HERE
        loop()//repeat the loop function
    end
    a == 0 =//Do nothing after the cell a is 0
    end
end