LTMCBCBYCII

From Esolang
Jump to navigation Jump to search

Esolang, created by User:R3D in July 2021.

Full name is Language That May Cause Brain Cancer But You Can Ignore It, the shortest one is BCL.

Heavily inspired by INTERCAL.


The name was chosen by /dev/null, his discord is sas24#9133.


Extensions: .bcl.

Basics of BCL

Every line should start with DO

Labels and variables can be only numbers

Valid symbols are only aA-zZ, 0-9, and ^%$.

Variables

There are only 2 variable type: shelf and box (array/string and integer)

To make shelf, use:

DO MATERIALIZE $shelfid ^shelfsize

To set shelf index, use:

DO $shelfid ^1-based index: number or shelfsection or box

To use it:

$shelfid

Or get shelf element:

$shelfid ^1-based index


To make box, use:

DO MATERIALIZE %boxid

To set box, use:

DO %boxid: number or shelfsection or box

To use it:

%boxid


There are some built-in variables:

ID Type Description
1000 box Return 0 always, ignores all set commands
1001 box Command pointer of the program
1002 box Returns randomly 0 or 1
1100 box Returns its value + 1
1101 box Returns its value - 1

Also, variables from -1 to -64 used as arguments and to store return value. (-1 to -32 is shelfs, -33 to -64 is boxes)

I/O functionality

Currently, you can only read/write from files or console.

Writing:

DO WRITE "filename, or <sout> for console" $SHELFID or %BOXID

Reading:

DO READ "filename, or <sin> for console" $SHELFID or %BOXID

Also, DO WRITE "<sout>" "Hello World!\n" is considered as valid command and executes as expected. But, oficially, this is a interpreter bug and will be fixed in next release.

Acquiring

DO ACQUIRE "lib.std" is a command, that will import ./lib/std.py and will use subroutines from it later

Flying, flapping, and coming from

DO FLY TO 1 flies (goto) to label 1.

DO FLAP TO 1 flaps (subroutine) to label 1. To return, use DO BACKFLIP

DO COME FROM 1 comes from (reversed goto) from label 1.

(1) DO SOMETHING creates label 1 at this line.


All of this can use not only numbers, but shelfs and boxes.


Comments

Comments are created by starting line with DO NOT, like in INTERCAL.

So, you can do DO NOT FLAP TO 1, or, DO NOTE THAT THIS LANGUAGE IS SHIT.

Shelf copying

You can copy chelf contents using DO COPY $1 $2.

It will take all $2 elements and paste it in $1. If $1 was bigger, it will overwrite only $2 length items.

std library

lib.std contains only 5 flaproutines:

- 1000: prints shelf -1

- 1001: sums -33 and -34 and stores it in -35

- 1002: subs -33 and -34 and stores it in -35

- 1003: muls -33 and -34 and stores it in -35

- 1003: divs -33 and -34 and stores it in -35

Flow control

In BCL, there are no straight IF, FOR and WHILE, same as INTERCAL. But, it has no abstain or reinstain commands.

There are fly + math comes into the game.

For example, this code flies to 1 if %1 is not zero, or to 2 if zero.

DO MATERIALIZE %10

DO %10: %1

DO %1100: %10

DO %10: %1100


DO %-33: 1

DO %-34: %10

DO FLAP TO 1004

DO %-33: 1

DO %-34: %-35

DO FLAP TO 1001

DO %10: %-35

DO FLY TO %10

It uses lib.std and formula 1/(x + 1) to get the result. There is no floats, so it works perfectly.

Hello World

DO ACQUIRE "lib.std"

DO MATERIALIZE $1 ^12

DO $1 ^1: 72

DO $1 ^2: 101

DO $1 ^3: 108

DO $1 ^4: 108

DO $1 ^5: 111

DO $1 ^6: 32

DO $1 ^7: 87

DO $1 ^8: 111

DO $1 ^9: 114

DO $1 ^10: 108

DO $1 ^11: 100

DO $1 ^12: 33

DO WRITE "<sout>" $1

Let's take a look.

DO ACQUIRE "lib.std" imports standard library (not used in current example)

DO MATERIALIZE $1 ^12 creates shelf with id 1 and height 12

DO $1 ^N: LC sets section N of shelf 1 to ASCII character code LC

DO WRITE "<sout>" $1 writes shelf 1 as string


Interpreter

Currently only Python implementation available for my language.

To use it, do:

$ python3 main.py <filename> [dbg]

Turing completness

I'm not sure, if this is turing complete, but i will maybe prove it later, by writing BF interpreter in it.

External links