String-rewriting paradigm
Jump to navigation
Jump to search
- Not to be confused with String rewriting paradigm, nor Category:String-rewriting paradigm.
Syntax
It only has 2 extremely simple commands. They are:
>
This moves the first byte of the program to the end of the program.
Any other byte
That is printed into console and is deleted. Code is executed in cyclic sequence.
Examples
Hello, World!
Infinite loop:
>>>
Interpreter
Written in Python.
def string_rewriting_paradigm(program): program = list(program) i = 0 while program: if program[i] == ">": program.append(program.pop(0)) else: print(end=program[i]) del program[i] if i == len(program): i = 0