How to make a Post Machine for $a^nb^n$? I have tried to make a Post machine for that all words of the form $a^nb^n$ by the following steps.


add a marker '#'
read first 'a'
read next 'a's and add them
read first 'b'
read next 'b's and add them
read '#' (that we added in the first step)


repeat steps while input tape is not empty

but this algorithm also accepts words of the form $(ab)^n$ e.g abab, ababab
I want to make a Post machine that only accepts words of the form $a^nb^n$
How to do that?
This language $a^nb^n$ can be recognized by a one counter automaton,
i.e. a pushdown automaton with only one kind of stack symbol (other than the stack bottom).

That can be easily mimicked by a Post machine (with capital P, like
Turing), according to the Wikipedia definition.

So first try to design the PDA with a single stack symbol (that is
easy), and then translate it to a Post machine.

But I am not sure you are using the same type of Post machine as described in Wikipedia, and you did not describe your model.