Interpreter for the Shrug Programming Language
Project description
ShrugProgrammingLanguage
WORK IN PROGRESS
Interpreter for the Shrug Programming Language
Shrug is a imperative, dynamically-typed, very very high-level, general-purpose programming language
Example
>> a 10
>> b 11
>>
>> # Arithmetic operations
>> ¯\_(ツ)_/¯ a 3
13
>> ¯\_(ツ)_/¯ "str" "ing"
string
>> ¯\_(ツ)_/¯ a ¯\_(ツ)_/¯ 3
7
>> ¯\_(ツ)_/¯ a ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ b
110
>> ¯\_(ツ)_/¯ a ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ 3
3
>> ¯\_(ツ)_/¯ b ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ 4
3
>>
>> # Comparisons
>> ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ a b
False
>> ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ a ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ b
False
>> ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ a ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ b
True
>>
>> # Conditional statements
>> ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ True
>> "printed"
printed
>> ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ False
>> "not printed"
>> ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ a ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ b
>> "a is less than b"
a is less than b
Usage
Requires Python 3.6+
Install
pip install shrug-lang
Start interpreter
shruglang
To run a file:
cat program.shrug | shruglang
Language spec
Comments start with #; no inline comments
# comment
n
assignment
n 1
math operators start with ¯\_(ツ)_/¯
addition
¯\\\_(ツ)\_/¯ n 3
subtraction
¯\\\_(ツ)\_/¯ n ¯\\\_(ツ)\_/¯ 3
multiplication
¯\\\_(ツ)\_/¯ n ¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ 4
division
¯\\\_(ツ)\_/¯ n ¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ 4
modulus
¯\\\_(ツ)\_/¯ n ¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ 4
comparators start with ¯\_(ツ)_/¯ ¯\_(ツ)_/¯
equality
¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ n m
inequality
¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ n ¯\\\_(ツ)\_/¯ m
greater than
¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ n ¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ m
greater than or equal
¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ n ¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ m
less than
¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ n ¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ m
less than or equal
¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ n ¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ m
conditional statements start with ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯
¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ ¯\\\_(ツ)\_/¯ condition
statement
Statement is indented by one more than conditional line No alternate conditions (elif/else)
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 Distribution
Hashes for shrug_lang-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55718dcf6c435a9c2572771bb6376d5085edb6517f3c197f090e4b05d5b6da9c |
|
MD5 | 3989ff5658b3c6dbb81743c8f8394b5e |
|
BLAKE2b-256 | f5fd648a55a51e0dc9ab98a0580c8a49f423d26f02eadef8b2cdaa52a7869655 |