B automaton

From Esolang
Jump to navigation Jump to search

B automaton is a Tag system invented by User:A designed with problem-solving usefulness in mind.

Example program

Tag system 
    m: 1
    A: {1,2,3,H} 
    P:
        1  -->  3321H
        2  -->  331
        3  -->  33

Computation
    Initial word: 123
                   233321H
                    33321H331
                     3321H33133
                      321H3313333
                       21H331333333
                        1H331333333331
                         H3313333333313321H
                          Halt. Outputs the resulting program when all H's are stripped out.

Output:
3313333333313321

Simplified:
1
123H
1=3321H
2=331
3=33
123

Some builtins

Of course for usefulness, some builtins should be possible.

-ab a=1st item b=2nd item
|a a=1st item
| Halve the next item.
: Duplicate the next item.

- Minus the ord code of the first item by the second item.
+*/% Same with minus. ^ is the power operator.
After these operations, the ord code will be modulo'd by 255.