Skip to main content

Interpreter for the Shrug Programming Language

Project description

ShrugProgrammingLanguage Build Status Coverage Status

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

print

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

shrug-lang-0.0.4.tar.gz (10.4 kB view hashes)

Uploaded Source

Built Distribution

shrug_lang-0.0.4-py3-none-any.whl (13.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page