Bantas

From Esolang
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

Bantas is an esoteric programming language developed by Jon Velasco and inspired by Blank. The word Bantas is a Filipino/Tagalog term for punctuation mark.

Commands

Cmd Description
@ Sets the pointer position or stack number.
? Prints or displays output to the console.
> Receives user input from the console.
< Pushes a value onto the stack.
~ A debugging tool that displays the current values of the stack and outputs them to a file.
x A loop that iterates through the stack and displays its values horizontally.
X A loop that iterates through the stack and displays its values vertically.
% Sets the title of the console window.
+ Addition: Adds a specified value or another stack's value to a stack.
- Subtraction: Subtracts a specified value or another stack's value from a stack.
* Multiplication: Multiplies a stack's value by a specified value or another stack's value.
/ Division: Divides a stack's value by a specified value or another stack's value.
^ Exponentiation: Raises a value to a power.
& Concatenation: Joins two strings together.
| Loads or initializes values in the stack.
[] Defines a block of code for repetition or looping. (See sample codes for examples).
() Used for string manipulation.
_ Returns the length of a string.
{ Calculates the sine of a value.
} Calculates the cosine of a value.
\ Calculates the tangent of a value.

Examples

Hello World

?,Hello World!

99 bottles of beer

%,PROGRAM : 99 Bottles of Beer
@,1
<,99
[,1
   @,2
   <,@1
   @,3
   <,@1
   &, 
   &,bottles of beer on the wall, 
   &,@1
   &, bottles of beer
   ?,@3
   @,2
   -,1
   @,4
   <,Take one down, pass it around, 
   &,@2
   &, bottles of beer
   ?,@4
   ?,
   @,1
   -,1
],1

Fibonacci sequence

%,PROGRAM : Fibonacci Sequence
@,1
<,1
@,2
<,1
@,3
<,
@,4
<,1
[,4
   @,3
   &,@1
   &, 
   &,@2
   &, 
   @,1
   +,@2
   @,2
   +,@1
   @,4
   +,1
],10
?,@3

Factorial of a Number

@,1
>,Enter a number:
@,2
<,1
[,1
   @,2
   *,@1
   @,1
   -,1
],1
?,@2

Reverse

%,PROGRAM : REVERSE A STRING
@,1
<,1
@,2
>,Enter a string:
@,4
<,
@,5
_,@2
[,1
   @,3
   <,@2
   ),@1
   (,1
   @,4
   &,@3
   @,1
   +,1
],@5
?,@4

Radians to degrees

%,PROGRAM : RADIANS TO DEGREES
@,1
>,Enter angle value in radians:
@,2
<,180
/,3.1416
*,@1
@,3
<,The value in degrees is 
&,@2
?,@3

External resources