TempoVar

From Esolang
Jump to navigation Jump to search

In this programming language TempoVar, there is only one variable and one flag. It also supports backtracking and executing commands on future tempos.

Commands:

  • period: This command steps to the next tempo.
  • number,colon,command: This is a do execution of commands in a future tempo. The number (which must be a integer at least 1) is the number of tempo steps until it is executed. It is executed right on the tempo, and if multiple commands are waiting on a tempo, it is a queue (first in first out) that executes in order all during same step.
  • zero or more commands in curly braces: This counts as one unit so can be used where a command is used.
  • percent,command: This sets the value of variable to that command.
  • at: The at sign executes the command stored in the variable.
  • plus,command: Makes a backtrack point (similar to MAYBE in backtracking INTERCAL, the choice point is added to stack, which contains the entire program state). The command executes now (after the choice-point is added to stack), but not on backtracking.
  • minus,command: Makes another backtrack point but the default is not execute command, and it executes on backtracking.
  • less: This is a GO BACK to the recent backtrack point, and now it is stale. If it is stale it discards instead.
  • greater: This discards the recent backtrack point regardless of stale or not.
  • number,asterisk,command: This will execute the command the number multiples of times.
  • left parenthesis,command: Input one bit and execute command if bit is set.
  • zero,right parenthesis: Output bit 0.
  • one,right parenthesis: Output bit 1.
  • slash: Toggle the flag.
  • question mark,command: Execute command if flag is set.
  • semicolon: Comment until end of line.
  • uppercase letters,command: Define a command letter to be included when using lowercase letters. Each letter can only be defined once, and only at the outer level of the program.
  • underscore,command: Prepends command to the beginning of value of variable.

Example of cat program:

%{?/(/?1)/?0)@}@

Example to copy a flag to a later tempo-step:

?1:{?//}/?1:{?/}/

Example to count up in unary:

E{0)0)1)0)0)0)0)1)} ; exclamation mark
L{0)0)0)0)1)0)1)0)} ; line feed
%{_el@}@