Finite looping automaton

From Esolang
Jump to navigation Jump to search

Finite looping automaton is a misleading, or outright incorrectly named esoteric programming language attempt invented by User:A where some programs, demonstrated by the examples below, can loop infinitely. It could theoretically simulate only loops with predicted numbers of iterations (e.g., for loops), but using self-modification, it can simulate infinite loops.

Syntax

  • n ... ]: loop ... n times, with n decremented after each looping process. Executing 0 times is a comment.
  • >: Move the program pointer (not the program counter, its motion depends on the program) right.
  • <: Move the program pointer left.
  • +: Increment the instruction's ASCII code pointed by the program pointer.
  • -: Decrement the instruction's ASCII code pointed by the program counter.
  • *: Halts the program.
  • Any other command puts that ASCII code into the program.

The whole program gets outputted on the end of the execution.

Example programs

Infinite loop

9+]

-

Looping counter

This evaluates only 1 iteration. The user should execute the outputted program repeatedly.

0+

This loops forever:

90+>+<]

Downward counter from 9 to 0

This is used as a counter-argument. It is usable for computation...

9-]