{"id":13780402,"url":"https://github.com/AaronCGoidel/SlothLang","last_synced_at":"2025-05-11T13:32:07.839Z","repository":{"id":186204624,"uuid":"144057203","full_name":"AaronCGoidel/SlothLang","owner":"AaronCGoidel","description":"The World's Greatest Sloth Based Programming Language","archived":false,"fork":false,"pushed_at":"2020-10-06T03:15:20.000Z","size":131,"stargazers_count":11,"open_issues_count":4,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-03T18:15:04.748Z","etag":null,"topics":["c","esoteric-language","esoteric-programming-language","interpreter","sloth","sloths"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AaronCGoidel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-08-08T19:12:03.000Z","updated_at":"2023-03-25T19:44:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"a31c9b39-4105-4d2f-9877-785aa5494a48","html_url":"https://github.com/AaronCGoidel/SlothLang","commit_stats":null,"previous_names":["aaroncgoidel/slothlang"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaronCGoidel%2FSlothLang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaronCGoidel%2FSlothLang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaronCGoidel%2FSlothLang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaronCGoidel%2FSlothLang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AaronCGoidel","download_url":"https://codeload.github.com/AaronCGoidel/SlothLang/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225056810,"owners_count":17414215,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","esoteric-language","esoteric-programming-language","interpreter","sloth","sloths"],"created_at":"2024-08-03T18:01:15.339Z","updated_at":"2024-11-17T15:31:10.062Z","avatar_url":"https://github.com/AaronCGoidel.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"![SlothLang][logo] \n# SlothLang \n[![Build Status](https://travis-ci.com/AaronCGoidel/SlothLang.svg?branch=master)](https://travis-ci.com/AaronCGoidel/SlothLang) [![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)\n\n\nSlothLang is an esoteric programming language by Aaron Goidel\n\n# Features\n\n  - Write code in a highly efficient and easy to read language\n  - Slothy sloths are slothy\n\n## Tech\n\nSlothLang is parsed and executed in C. \n\nAnd of course the code behind the SlothLang VM itself is open source and can be found on [GitHub][slgit].\n\n## Usage\nA Sloth program is parsed as new-line deliminated instructions. Every line starts a new instruction at ```0x00```. Each occurrence of the word `sloth` on a line increases the instruction code by one. At the end of each line the resulting instruction code is pushed and the next line is read. \n\nSince a Sloth command is generally based on the number of times the word sloth appears in a row, the syntax will be documented as a multiplication. For example the documentation `sloth * 3` means `sloth sloth sloth` in Sloth code.\n\nTo save time and effort, there are a few commands which do not follow the scheme outlined above. These will be outlined below. \n\nNote: the `and` operator is used to separate arguments.\n\n# Syntax and Effects\n### Exit\n**Syntax:** `nap`  \n**Effect:** will terminate the execution of the program and return the top element from the stack.  \n**NOTE:** every Sloth file must end in `nap`.  \n\n### Add\n**Syntax:** `sloth * 2`  \n**Effect:** pops the first two values off the stack and pushes their sum.  \n**Stack:** `S, x, y -\u003e S, x+y`  \n\n### Subtract\n**Syntax:** `sloth * 3`  \n**Effect:** pops the first two values off the stack and pushes their difference.  \n**Stack:** `S, x, y -\u003e S, x-y`\n\n### Multiply\n**Syntax:** `sloth * 4`  \n**Effect:** pops the first two values off the stack and pushes their product.  \n**Stack:** `S, x, y -\u003e S, x*y`  \n\n### Divide\n**Syntax:** `sloth * 5`  \n**Effect:** pops the first two values off the stack and pushes their quotient.  \n**Stack:** `S, x, y -\u003e S, x/y`  \n**NOTE:** Division in SlothLang is integer division, meaning divide will always round fractions down. e.g. 3/2 = 1\n\n### Compare \\\u003cc\u003e\n  \n**Syntax:** `sloth * 6 and sloth * c`  \n\n\u003e Notice that the **compare** instruction requires an argument. The number of sloths after the `and` will determine which comparison should be made. See [Comparison Codes](#comparison-codes) for reference.\n\n**Effect:** pops the first two values off the stack and pushes the truthiness of a comparison between them.  \n**Stack:** ``S, x, y -\u003e S, 1 if true 0 if false``  \n\n### Input \\\u003ct\u003e\n  \n**Syntax:** `sloth * 7 and sloth * t`  \n  \n\u003e The **input** instruction takes a type code to determine what kind of data is being read. See [Type Codes](#type-codes) for reference.\n\n**Effect:** reads in either an integer or an ASCII character from standard in.  \n**Stack:** `S -\u003e S, x`\n\n### Output \\\u003ct\u003e\n  \n**Syntax:** `sloth * 8 and sloth * t`\n\n\u003e The **output** instruction takes a type code to determine what kind of data is being displayed. See [Type Codes](#type-codes) for reference.\n\n**Effect:** pops the top value off the stack and writes it to standard out.  \n**Stack:** `S, x -\u003e S`  \n\n### GOTO \\\u003cn\u003e\n  \n**Syntax:** `sloth * 9 and sloth * n`\n\n\u003e The **GOTO** instruction takes a number of sloths as the destination if the result is true.\n\n**Effect:** pops the top value off the stack, if the value is 1, the program counter is set to specified instruction, else continues as normal.  \n**Stack:** `S, x -\u003e S`  \n\n### Push \\\u003ci\u003e\n  \n**Syntax:** `slothy sloth * i`  \n**Effect:** pushes the integer value of the number of sloths following slothy onto the stack.  \n**Stack:** `S -\u003e S, x`  \n**Example:** `slothy sloth sloth sloth` pushes 3 onto the stack.  \n\n### Duplicate\n  \n**Syntax:** `sloth * 10`  \n**Effect:** pops an element off the stack and pushes it twice.  \n**Stack:** `S, x -\u003e S, x, x`  \n\n## Operation, Comparison, and Type Codes\nSlothLang relies on the translation of a number of sloths to a numeric code in order to perform specific operations. \n\n### Comparison Codes\nThe **Compare** function uses `\u003cc\u003e` sloths in order to select what kind of comparison is being made.\n\n| Comparison Code | Operation |\n|-----------------|-----------|\n| `0x01`          | `x == y`  |\n| `0x02`          | `x != y`  |\n| `0x03`          | `x \u003c y`   |\n| `0x04`          | `x \u003c= y`  |\n| `0x05`          | `x \u003e y`   |\n| `0x06`          | `x \u003e= y`  |\n\n### Type Codes\nType Codes `\u003ct\u003e` are used in the **Input** and **Output** instructions in order to determine what kind of data is being read or written.\n\n| Type Code | Type of I/O              |\n|-----------|--------------------------|\n| `0x01`    | A signed integer value   |\n| `0x02`    | A single ASCII character |\n\n### Operation Codes\nSloth code is read in by the SlothVM as bytecode. The following is the bytecode for each SlothLang instruction.\n\n| Byte Code | Name         |\n|-----------|--------------|\n| `0x00`    | Exit         |\n| `0x01`    | Push \\\u003ci\u003e    |\n| `0x02`    | Add          |\n| `0x03`    | Subtract     |\n| `0x04`    | Multiply     |\n| `0x05`    | Divide       |\n| `0x06`    | Compare \\\u003cc\u003e |\n| `0x07`    | Input \\\u003ct\u003e   |\n| `0x08`    | Output \\\u003ct\u003e  |\n| `0x09`    | GOTO \\\u003co\u003e    |\n| `0x0A`    | DUP          |\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n\n### Thanks To\n - Mariana Ortiz Luna for the awesome logo\n\n   [slgit]: \u003chttps://github.com/AaronCGoidel/SlothLang\u003e\n   [logo]: SlothLogo.png\n \"Sloth Logo by Mariana Ortiz Luna \"\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAaronCGoidel%2FSlothLang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAaronCGoidel%2FSlothLang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAaronCGoidel%2FSlothLang/lists"}