BitCode/PicCode

From Esolang
Jump to navigation Jump to search

Bitcode is an image programming language. It uses pixels in an image as characters for code, unlocking the ability to use a normal image, like one of a sunset, as code. With advanced programs you might even end up with a rainbow!

The "bit" in "bitcode" comes from "bitmap", since the interpreter uses a bitmap version of the image to read the image's pixels. A nickname/second name for it is "piccode" because programs in it are pictures. The "pic" comes from "picture".

Bitcode will have decent error handling faster than I even started on error handling for NScript since it's way easier to tell the user where the error occurred.

The system

The idea of the system is that the red value of the color represents a "channel". For example, characters use channel 1, builtin methods use 2, variables use 3, user-defined methods use 4 The system is basically [channel,arg1,arg2] or [channel,arg,sub-arg] Using this method, 255 different channels can be made.. more than enough.

I chose the [channel,arg,sub-arg] system because it makes the programming lang easy to learn&use.

Image langs are virtually infinitely expandable, with over 16M different color combinations possible, so you'll never run out of commands. Unicode has 143,859 characters, a tiny fraction of how many is possible.

Because of the [channel,arg,sub-arg] system and the way characters are used in it, only 255 characters are actually possible. Soon this will be changed by having different "scripts"/"alphabets", though only 65k characters are possible even with 255 alphabets to chose from.

Usage

Characters will use Red-1, Green-charnum, Blue-capital (1 = capital, 0 = lowercase) Example: [1,3,1] - C / [1,7,0] - g / [1,30,0] - 3 Builtin methods will use Red-2, Green-methodnum, Blue-arg

The characters are: "abcdefghijklmnopqrstuvwxyz 1234567890~!@#$%^&*()_+=-`{}[]\\|:;\"'<>,.?/" a is 1, b is 2, c is 3, and so on.. a space is 27.

Quotation marks are not listed but are [1,0,0]. Quotation marks are not listed because they represent a print() statement event without any special "initializers" to tell the interpreter if its as an argument or something else.

Numbers are not possible yet.

Comments are impossible.

Hello world: https://imgur.com/a/3slP761

Reading it

Reading it easily requires an editor for ONLY bitcode,