User:Gilbert189/Jumble

From Esolang
Jump to navigation Jump to search
This article is just a draft. See User:Gilbert189#Drafts for more info.

Jumble is a letter-only, object-oriented esolang that consists of jumbled (maybe nonsensical) pseudo-English words (i guess). It is made by User:Gilbert189.

Note that proper Jumble code has no space nor symbols and numbers; it's a letter-only esolang. For example purposes, spaces has been added to codes so that the code becomes somewhat readable, but note that that program will fail to run.

Warm-up

Here's an example code in Jumble:

divintfarscttesteqsstop

If we add spaces to the code, it will become this:

div int far sct test eqs stop

The keyword div defines something, in this case a number, signed by the int keyword after it. The far keyword means we're defining a variable. The text encased in sct and eqs are the name of the variable. Finally, we get stop, which terminates the statement (like a semicolon).

Syntax

The overall syntax looks like this EBNF syntax:

literal = "sct", {? all allowed characters ?}, "end";
line = starting_statement, data_type, {argument, literal}, "stop";
program = {line};

To better explain the example codes, examples are formatted like this:

Jumble code

Jumble code with spaces

Java-ish code

Literal

There is only one literal in Jumble. It's encased in sct and eqs. Literals can store anything, from strings, numbers, and even codes.

Here's an example of a literal:

sctfooeqs

sct foo eqs

// Could be "foo", {foo}, [foo], or just foo.

div starting statement

Keyword div defines something. If used alone, it becomes an anonymous object with a null value.

divint

div int

new Double();

If used with the far argument, it will assign a variable. (if used without far, it will become a anonymous object)

divintfarsctnumbereqs

div int far sct number eqs

double number;

If used with the par argument, it will assign inputs (for use with functions and classes)

divfunfarsctfooeqsparsctdivintfarsctnumbereqseqs

div fun far sct foo eqs par sct div int far sct number eqs eqs

function foo(int number);

If used with the kon argument, it will assign the value of the object.

divstrfarsctfooeqskonsctbareqs

div str far sct foo eqs kon sct bar eqs

String foo = "bar";

net starting statement

Keyword net gets/executes something.

netint

net int

// nothing

The far argument must be included at least once to define the variable.

netintfarsctnumbereqs

net int far sct number eqs

number; // a variable called number

If the far argument is used more than once, it will act like a dot notation.

netklasfarsctsyseqsfarsctstdouteqsfarsctwriteeqs

net klas far sct sys eqs far sct stdout eqs far sct write eqs

sys.stdout.write;

If used with the par argument, it will assign parameters of variable. The stop keyword seperates parameters.

netklasfarsctsyseqsfarsctstdouteqsfarsctwriteeqsparsctnetintfarsctfooeqseqs

net klas far sct sys eqs far sct stdout eqs far sct write eqs par sct net int far sct foo eqs eqs

sys.stdout.write(foo);

Data types

There is 5 types of data in Jumble: int, str, are, fun, and klas.

int type

int is a number. Despite its name, it's not restricted to integers. Since number characters aren't allowed, you have to use a workaround:

divintfarsctfooeqskonsctabcdefghijkaeqs

div int far sct foo eqs kon sct abcdefghijka eqs

double foo = "1234567890.1"

In this case, a becomes 1, b becomes 2, and so on until j, which becomes 0. k becomes a decimal point.

str type

str is a string. Nothing unusual.

divstrfarsctfooeqskonsctbareqs

div str far sct foo eqs kon sct bar eqs

String foo = "bar"

Using par instead of kon will allow you to create string character by character:

divstrfarsctfooeqsparsctdivintkonsctcbeqseqs

div str far sct foo eqs par sct div int kon sct cb eqs eqs

String foo = " "

Here's how it works:

divstrfarsctfooeqs                           ------ defines a str variable named foo
                  parsct                 eqs ------ using characters to make string
                        divintkonsctcbeqs --------- number 32 is space in ASCII

You can seperate numbers by the stop keyword.

are type

are is an array. It can store any data type.

divarefarsctfooeqskonsctdivstrfarsctfooeqskonsctbareqseqs

div are far sct foo eqs kon sct div str far sct foo eqs kon sct bar eqs eqs

Array foo = {"bar"}

You can seperate numbers by the stop keyword.

Using par will allow you to index the array:

divarefarsctfooeqsparsctdivintkonsctjeqseqs

div are far sct foo eqs par sct div int kon sct j eqs eqs

foo[0]

klas type

klas is a class. It

Some OOP junk

jazz keyword

jazz refers to the current object.

Code snippets

Here's some code snippets for you to learn.

Making a function

divfunfarsctfooeqsparsctdivintfarsctbareqseqskonsctnetklasfarsctsyseqsfarsctstdouteqsfarsctwriteeqsparsctnetintfarsctfooeqseqsstopeqsstop

div fun far sct foo eqs par sct div int far sct bar eqs eqs kon sct
	net klas far sct sys eqs far sct stdout eqs far sct write eqs par sct net int far sct bar eqs eqs stop
eqs stop

function foo(double bar){
	sys.stdout.write(bar);
}