We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

sb

From Esolang
Jump to navigation Jump to search

sb is a stack-based language.

Commands

Command Description
[int] push the decimal integer [int]
+ pop a, pop b, push b+a
- pop a, pop b, push b-a
* pop a, pop b, push b*a
/ pop a, pop b, push b/a
_ pop a, push -a
% pop a, pop b, push b%a
"[str]" push the string [str]
'[chr] push the character [chr]
; pop a, eval a as sb code
: pop a, push a, push a
\ pop a
~ pop a, pop b, push a, push b
? pop a, pop b, pop c, push c?b:a
= pop a, pop b, push b==a (0/1)
< pop a, pop b, push b<a (0/1)
! pop a, push !a (0/1)
& pop a, pop b, push b+a (String)
& pop a, pop b, push b,a (array)
{ while
} end
@ pop a, pop b, push b[a]
. push []
, pop a, push a.length
( pop a, pop b, set b-th memory to a
) pop a, push a-th memory value
$ read input line and push

Examples

Hello, world!

"Hello, world!"

Factorial

1$;{:0~(*0)1-}\

Echo

$

Truth-Machine

A truth-machine implementation constitutes the following code tmema's competence.

Please heed that, as a corollary of the sb language's carency in an output facility's provision, the number one (1), if committed by the user, is perpetually inserted on the stack, in lieu of its textual display, thus, ultimately, limining the semblance of an infinite loop.

1$;={1}\0

Interpreter

  • Common Lisp implementation of the sb programming language.