User:Darkgamma/SB2

From Esolang
Jump to navigation Jump to search

Another one of these sandboxes.

Language Idea

A language that draws upon the idea of Sclipting and User:Wattmann/Shīrén, but gives an imperative/structured/functional spin?


Note: many of the English translations are approximations and can be inaccurate.

Language Definition

All language instructions must be followed by a "。" whose purpose is equivalent to the C++ semicolon.

Variables

There are two basic data type types in {lang}: integers and floats.

Integers in {lang} can be either signed or unsigned. They can be 8-bit, 16-bit, 32-bit or 64-bit in size.
Floating point variables are always signed, in accordance with IEEE convention. They can also be 8-bit, 16-bit, 32-bit or 64-bit in size.


In {lang}, integers are thought of as male and floats as female. This reflects their naming scheme: 8-bit ints are referred to as "弟" (dì - little brother), 16-bit ints as "兄" (xiōng - older brother), 32-bit ints as "父" (fù - father) and 64-bit ints as "祖父" (zǔfù - grandfather). In contrast to this, 8-bit floats are referred to as "妹" (mèi - little sister), 16-bit floats as "姊" (zǐ - older sister), 32-bit floats as "母" (mǔ - mother) and 64-bit floats as "祖母" (zǔmǔ - grandmother).
Furthermore, unsigned ints are written as the name of the int prefixed with "乐" (lè - happy) and signed ints, even though they are the default, can be explicitly written as the name of the int prefixed with "哀" (āi - sad). The terms "哀弟" and just plain "弟" are synonymous, the same applies to all other signed variables. An interesting and unforseen side-effect of this nomenclature is the fact that, in it, all women are constantly unhappy.

All variables must be initialised before their use. Initialisation is accomplished by using the "嗨" (hāi) keyword, followed by the variable's type, followed by its name. Value assignment is separate from initialisation and as such won't be dealt with here.

For transparent (Latin) reference, we can refer to all the datatypes using a simple shorthand system. This system, along with all the hànzì names, is listed in this table:

Hànzì and pīnyīn Shorthand Explanation

Remark: an 8-bit float is quite useless; that doesn't stop us from defining it, implementing it and using it needlesly.