BASE

From Esolang
Jump to navigation Jump to search

BASE (or Basic Assembled System Execution) is a esolang came from here. Created by User:Ractangle

Commands

Command It's Action
ASSIGN Assigns a variable/Makes an array.
CHECK Condition command.
WHILE Reapeats if the condition is true.
PRINT Prints the string next to it.
USER Gets user input.
NOTE Comment.
SUM Math command. You can also do the math with strings
DEFINE Function command.
END Ends the current CHECK operator
STACK Creates a stack
MOVE TO <number/variable> IN <stackname> Self-explanatory
PUSH <something> TO <stackname> Pushes a value to a stack
POP FROM <stackname> Pops a element from a stack
PEEK Prints the top of the stack without poping the element

Examples

Hello, world!

PRINT Hello, world!{N}

Truth-machine

ASSIGN i TO USER
CHECK IF i IS 0 IF YES THEN
  PRINT 0
IF NOT THEN
  WHILE TRUE
     PRINT 1
END

Cat program

ASSIGN i TO USER
PRINT var:i
PRINT {N}

Infinite loop

WHILE TRUE
  PRINT inf
  PRINT {N}

A+B Problem

ASSIGN a TO USER
ASSIGN b TO USER
PRINT SUM a+b
PRINT {N}

Deadfish implementation

ASSIGN a TO 0
WHILE TRUE
  ASSIGN u TO USER
  CHECK IF u IS i IF YES THEN
    SUM a PLU 1
  END
  CHECK IF u IS d IF YES THEN
    SUM a MIN 1
  END
  CHECK IF u IS s IF YES THEN
    SUM a TIM a
  END
  CHECK IF u IS o IF YES THEN
    PRINT var:a
  END

FizzBuzz

ASSIGN num TO 1
WHILE num IS NOT 201
  CHECK IF SUM num MOD 5 IF YES THEN
    PRINT Buzz
  IF NOT THEN
    PRINT var:num
  END
  CHECK IF SUM num MOD 3 IF YES THEN
    PRINT Fizz
  IF NOT THEN
    PRINT var:num
  END

Fun Video Game

ASSIGN num TO 0
ASSIGN i TO USER
WHILE i IS num
  SUM num PLU 1
PRINT FAILURE

Other implementations

See BASE/Other esolang implementations