Exolang that can take any utf8 text as valid code and return some result out of it
Project description
WIP: This is a work in progress, there is nothing working yet
Mangle
An exolang (A scripting programming language just for fun) without any reserved keywords that can run any utf8 compatible with more than 2 space separated words on it.
Installation
cargo install mangle
Python bindings
Python bindings are available for python > 3.7. You can install them with:
pip install mangle
Then you can get started evaluating mangle from python with:
import mangle
mangle.eval("cat is fat")
>> '5'
How it works
There are only labels, variables and operators. All variables are globally scoped, there are no locals, classes or anything fancy. All variables are dynamically typed and shadowed.
Sentences
The only type of scope is sentences. Sentences are like english sentences, any text that comes before the punctuation marks: .,;:?!
. All the other symbols will be interpreted as variable names, operators, labels, strings or numbers.
If a text has none of those punctuation marks it will run as a single sentence.
Sentence Labels
The label of a sentence is the last word before the punctuation mark except by the first sentence. Labels are the way to have subroutines on this language. They define a scope with a body that you can goto
from any other subroutine.
The first sentence on the interpreted code is the equivalent of the main function in another languages, so it has no need for a label. If the first sentence doesn't call any function, all the others labels will execute in the order they are until you exit or jump to another label.
Data Types
The only types are strings, ints and stacks.
Int
The length of a word - 1
define its numerical value. For example "a" evaluates to 0 and "cat" to 2.
Strings
The words themselves can be also interpreted as strings. You can't easily build multiword strings like "a bird" though since that would read as: "a
and bird"
each as individual words.
Stacks
Strings themselves are a stack of ints that the interpreter itself decodes at runtime. You can add ints to a stack by adding to its variable.
WIP...
Operator
Operators are defined by the word's length. Here is the table of operators on this language
Word Length | Operator | syntax | Example | Description |
---|---|---|---|---|
1 | ||||
2 | Assign | OP receiver Value | is cat fat | Assigns variable cat to value 3 |
3 | ||||
4 | ||||
5 | ||||
6 | ||||
7 | ||||
8 | ||||
9 | ||||
10 | ||||
11 |
But then spaces are keywords heh?
Well... In some interpretation yes, I guess I lied then, sorry about it. You can still pass the -F
argument to change the word separator (like field separator in awk) to any other character.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for mangle-0.0.2-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc1baaa2b627346756bb8e1d657aaaf882c34426fed3612e1c9568190560b4ee |
|
MD5 | 8fa7b22585a94a7d972575aa7bfc85c7 |
|
BLAKE2b-256 | 547072413539a25e947fb904cda5f37c003b79038e09680742ffea843b455fea |
Hashes for mangle-0.0.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6de7052c3896928a5a0ec5caf670b211c457a59bd0b365ac839ad41454b01556 |
|
MD5 | e2260a9dbc98346ab366dde5014ab1bf |
|
BLAKE2b-256 | f980a7d24e3af326cfc08e7b316ca76a8a0fa2a049bf4b882c35277195c1fec9 |
Hashes for mangle-0.0.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f21ca5d3771014c4f3a1ee3d5351c71519bb243b2124fcf8622d47a9de7b51f |
|
MD5 | 870fe00bb81d6f191e658e4acc4920b2 |
|
BLAKE2b-256 | 6f09632985c9b5ea5caf1588754b8cdff9766fec029c65b2eb62445f8873dff0 |
Hashes for mangle-0.0.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b914fa1ead368acd3808cb17995e351802859f3faa01748f2010be3b6b96a94 |
|
MD5 | 2d8190f82e4ca23194a758f65b08db53 |
|
BLAKE2b-256 | 92baddff3d50e4dab4fe2dd11eb15ac2c8f6830d181c4e9a81d82cb9b27616a6 |
Hashes for mangle-0.0.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ccf847a5813b24ae43fd7d737667a4da5d74cca934c36d3d446bd67e7a3b63f |
|
MD5 | 539ddee261d47fc5109e05a1774ad8db |
|
BLAKE2b-256 | 5fa77ee934b8d805f4536b7e7896bc24da6b845305b7b6aaddb43b6223501746 |