Stack-based+

From Esolang
Jump to navigation Jump to search

Stack-based+ is a derivative of Stack-based, its goal is to make progrmming in Stack-based easier.

Procedures

Programs in Stack-based+ are separated into subprograms called procedures. Two procedures are separated by exactly one blank line.

For example:

VAR a

VAR b

has two procedures but:

VAR a


VAR b

has three.

By default, when procedure terminates, control flow goes to the next procedure.

Procedures makes coding more logical, it is convenient but not needed for one to write a comment for each procedure for what it does.

Jumps

Stack-based+ removes JA and JB, but there are two other commands for jumping: J and NJ.

J x integer

Jump to the integer-th procedure if x is nonzero.

NJ x integer

Jump to the integer-th procedure if x is zero.

Examples

Hello World

P "Hello World!"

Cat program

VAR c

IC c
OC c
J c 2

Stack-based improved

Stack-based improved or Stack-based++ is an improved version of Stack-based. It adds another feature: labels.

Commands

L "string"

Defineds a label named string

JL "string"

Jump to the string-th label if x is nonzero.

NJL "string"

Jump to the string-th label if x is zero.

See also