Backshar

From Esolang
Jump to navigation Jump to search

Backshar is a programmable language with actual commands similar to real languages such as C#, C++, JS, Python, and more. Nothing about it, excluding strings, comments and variable values, use A-Z & 0-9. It's all symbols. This is the first functional language by threesodas. Unlike the rest, it actually has IO capability. You are 100% allowed to create a compiler for this. It'd be appreciated!

Syntax

Print & read input

(string)=>[@] : Print a string.
()<=[@] : Read a user input. Does not set input to anything.

Variables

#[var name]=>[value] : Set a variable to value.
#[var name]<=[@] : Set a variable to user input.
#[var name]<=[var name] : Set a variable to another variable's value.
#[var name]<=(type) : Convert a variable to a certain type (string, int, bool, etc.)

Condition Statements

$%(value or var) (condition) (value or var) & : If statement
$&(value or var) & : Switch statement
$@ (condition)=> (action) : Case (Switch statement)

Operators & Conditions

Conditions
!# : Equals (==)
$# : Not equals (!=)
&# : Greater than (>)
*# : Less than (<)
+# : Or (||)
-# : And (&&)
Operators
^% : Plus (+)
@% : Minus (-)
*% : Times(*)
!% : Divide (/)
?% : Join (+)

Comments

_(string) : Single Line Comment
!( + )/ : Multi Line Comment

Functions

@[func name]( + )@ : Function

Time & Date

All info is returned as a numerical value.
*! : Current Day of Month
!! : Current Year
?! : Current Day of Week
$! : Current Month
&! : Current Week
^^ : Current Hour
@^ : Current Minute
#^ : Current Second
Timezones are returned as UTC-6:00 or UTC+5:00.
$^ : Timezone

Program Examples

Print Hello, World!

("Hello, World!")=>[@]

Simple addition calculator

("Input your first number.")=>[@]
#[x]<=[@]
("Input your second number.")=>[@]
#[y]<=[@]
#[z]<=[x] ^% [y]
("The sum of " ?% [x] ?% " and " ?% [y] ?% " is " ?% [z])=>[@]

"Predict" the future

("Hmm, yes... 5 days from now, it will be the " ?% *! ?%  "th of month " ?% $!?% " of " ?% !! ?% ".")=>[@]

Family