SIG

From Esolang
Jump to navigation Jump to search

SIG is a language based on signals that was created on May 16, 2008 by revcompgeek. There are two data structures. The first data structure is stack like, but it is more like a napkin holder at restaurants. Simply pushing or pulling (popping) won't do anything. Instead you have to shove and yank. The second data structure is like a tape, but is more like a conveyor belt with no motor. Instead of you moving along the belt, you have to move the belt to where you want it by pushing and pulling it. Numbers in the napkin holder are called napkins, and numbers on the belt are called items.

Commands

SIG signal

Start of a signal block. Only executes if signal has been tripped during the previous run. NOTE: the signal tick is tripped at the end of every run.

TERM

Ends a signal block.

TRIP signal

Trips the signal and causes any same-named signal blocks to be executed turing the next run.

RESET signal

Resets the state of the specified signal. If it was previously tripped during the current run, this undoes what the TRIP command did, which means it will no longer be active during the next run.

PRY

This pries a char from the input stream and shoves it into the napkin holder.

CRAM

This yanks front napkin out of the napkin holder and stuffs it into the output stream as a character, modulo 256 if needed.

IF condition command

IF is a comparison command that compares the current item with the front napkin. Condition can be any of the following:

LESS - less than
MORE - greater than
GOOD - equal to
EVIL - unequal to
CLEAN - napkin holder is empty
DIRTY - napkin holder has something

If the condition is satisfied, then command is executed.

GROW

Adds the front napkin to the current item and burns it.

GROW BY value

Adds value to the current item.

SHRINK

Subtracts the front napkin from the current item and buns it.

SHRINK BY value

Subtracts value from the current item.

ENLARGE

Multiplies the front napkin by the current item and burns it.

ENLARGE BY value

Multiplies the current item by value.

REDUCE

Divides the current item by the front napkin and burns the napkin.

RECUDE BY value

Divides the current item by value.

PURGE

Resets the current value on the belt to zero.

BURN

Burns the front napkin.

SHOVE

Shove the current value on the belt into the napkin holder.

YANK

Yanks the top value out of the napkin holder and put it onto the belt in place of the old value.

CLONE

Duplicates the front napkin and shoves the new one into the napkin holder.

Example programs

The following is the cat program that ignores EOF:

SIG tick PRY CRAM TERM