{"id":15502175,"url":"https://github.com/sungwoncho/tru","last_synced_at":"2025-09-18T08:54:07.832Z","repository":{"id":86179651,"uuid":"284921070","full_name":"sungwoncho/tru","owner":"sungwoncho","description":"An esoteric programming language with prefix-free brackets","archived":false,"fork":false,"pushed_at":"2020-08-09T08:31:19.000Z","size":26,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T14:45:21.048Z","etag":null,"topics":["esolang","esoteric-programming-language","programming-language"],"latest_commit_sha":null,"homepage":"https://sungwoncho.github.io/tru/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sungwoncho.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,"roadmap":null,"authors":null}},"created_at":"2020-08-04T08:24:37.000Z","updated_at":"2024-03-19T21:04:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"f8cae0a3-f1cd-4d11-865a-f41ade847964","html_url":"https://github.com/sungwoncho/tru","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sungwoncho/tru","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sungwoncho%2Ftru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sungwoncho%2Ftru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sungwoncho%2Ftru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sungwoncho%2Ftru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sungwoncho","download_url":"https://codeload.github.com/sungwoncho/tru/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sungwoncho%2Ftru/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275739166,"owners_count":25519601,"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","status":"online","status_checked_at":"2025-09-18T02:00:09.552Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["esolang","esoteric-programming-language","programming-language"],"created_at":"2024-10-02T09:08:35.780Z","updated_at":"2025-09-18T08:54:07.811Z","avatar_url":"https://github.com/sungwoncho.png","language":"Python","funding_links":[],"categories":["Languages"],"sub_categories":[],"readme":"# tru\n\ntru is an esoteric programming language of brackets with prefix-free code.\n\n## Examples\n\nBelow are some tru code examples.\n\n```\n# print hello world\n(0)(10)(33)(100)(108)(114)(111)(119)(32)(44)(111)(108)(108)(101)(72)\u003e\u003e\u003c\u003c[\u003c\u003e\u003c\u003e\u003e\u003c\u003c\u003e\u003e\u003c\u003c]\u003e\u003e\u003e\u003c\u003c\n```\n\n```\n# print 25th Fibonacci number\n(1)(25)(1)\u003e\u003c\u003e(1)(0)\u003e\u003c\u003e(1)\u003e\u003e\u003e\u003e\u003e\u003e\u003c\u003c[(0)\u003e\u003c\u003e(1)\u003e\u003e\u003e\u003e\u003e\u003e\u003c\u003c[\u003e\u003e\u003c\u003e(1)\u003e\u003c\u003e\u003e\u003e\u003c\u003c(0)\u003e\u003c\u003e\u003e\u003e\u003e\u003c\u003e(1)\u003e\u003c\u003e\u003c\u003c\u003c\u003e\u003e\u003c\u003e\u003e\u003e\u003e\u003c\u003e(0)\u003e\u003c\u003e\u003e\u003e\u003c\u003e(1)\u003e\u003e\u003e\u003e\u003e\u003e\u003c\u003c](0)](1)\u003e\u003c\u003e\u003c\u003e\u003c\u003e\u003e\u003c\u003e\u003e\u003e\u003e\u003c\u003c\n```\n\n```\n# sum first 1000 positive integers\n(1000)\u003e\u003e\u003c\u003c\u003e\u003e\u003e\u003c\u003e(1)\u003e\u003c\u003e1(111)[(1)\u003e\u003e\u003e\u003e1\u003e\u003e\u003c\u003c\u003e\u003e\u003e\u003c\u003e(0)\u003e\u003c\u003e0\u003c\u003c\u003c(1)\u003e\u003c\u003e1\u003e\u003e\u003c\u003c(1)\u003c\u003e\u003e\u003e\u003c\u003c](0)\u003e\u003c\u003e\u003c\u003e\u003c\u003e\u003e\u003c\u003e\u003e\u003e\u003e\u003c\u003c\n```\n\n```\n# quine (outputs its own source code)\n(9999)(60)(60)(62)(62)(62)(60)(60)(62)(60)(93)(60)(60)(62)(62)(62)(60)(60)(60)(60)(41)(1)(40)(41)(9998)(40)(60)(60)(62)(62)(93)(41)(0)(40)(62)(60)(62)(41)(0)(40)(41)(7777)(40)(62)(60)(62)(41)(1)(40)(60)(60)(62)(62)(60)(62)(60)(62)(60)(62)(62)(62)(60)(60)(62)(62)(62)(60)(62)(41)(0)(40)(91)(60)(60)(62)(62)(60)(62)(41)(1)(40)(93)(41)(0)(40)(62)(60)(62)(41)(0)(40)(41)(8888)(40)(62)(60)(62)(41)(1)(40)(62)(60)(62)(62)(60)(62)(60)(62)(60)(62)(62)(62)(60)(60)(62)(62)(62)(60)(62)(41)(0)(40)(91)(60)(60)(62)(62)(62)(62)(60)(41)(2)(40)(62)(60)(62)(41)(1)(40)(62)(60)(62)(62)(62)(60)(60)(60)(62)(60)(62)(41)(0)(40)(62)(60)(62)(62)(62)(62)(62)(60)(41)(40)(40)(60)(60)(62)(62)(62)(60)(62)(62)(62)(62)(62)(60)(41)(7777)(40)(62)(60)(62)(41)(1)(40)(91)(41)(1)(40)(41)(1)(40)(41)(8888)(40)(62)(60)(62)(41)(1)(40)(60)(60)(62)(60)(93)(93)(41)(0)(40)(60)(60)(62)(62)(60)(62)(60)(41)(41)(40)(62)(60)(62)(62)(60)(62)(60)(62)(60)(62)(62)(62)(60)(60)(62)(62)(60)(60)(62)(62)(60)(62)(60)(41)(40)(40)(62)(60)(62)(62)(91)(60)(60)(62)(62)(60)(60)(62)(62)(62)(60)(60)(60)(60)(41)(1)(40)(41)(9998)(40)(60)(60)(62)(62)(62)(60)(62)(41)(1)(40)(91)(41)(1)(40)(60)(60)(60)(41)(1)(40)(41)(9998)(40)(62)(60)(62)(41)(0)(40)(60)(60)(62)(62)(60)(62)(60)(41)(41)(40)(62)(60)(62)(62)(60)(62)(60)(60)(60)(60)(41)(1)(40)(41)(9998)(40)(60)(60)(62)(62)(60)(62)(60)(41)(40)(40)(60)(60)(62)(60)(93)(93)(41)(0)(40)(62)(60)(62)(62)(62)(62)(60)(62)(62)(91)(60)(60)(62)(62)(60)(60)(62)(62)(62)(60)(60)(60)(60)(41)(1)(40)(41)(9998)(40)(60)(60)(62)(62)(62)(60)(62)(41)(0)(40)(91)(41)(1)(40)(60)(60)(60)(41)(1)(40)(41)(9998)(40)(62)(60)(62)(41)(1)(40)(1)\u003e\u003c\u003e(9998)(1)\u003c\u003c\u003c(1)[(0)\u003e\u003c\u003e\u003e\u003e\u003c\u003c(9998)(1)\u003c\u003c\u003c\u003c\u003e\u003e\u003e\u003c\u003c\u003e\u003e\u003c\u003c[\u003e\u003e\u003c\u003e\u003e\u003e\u003e\u003c\u003e(0)]]\u003c\u003e\u003c\u003c(40)\u003c\u003e\u003c\u003e\u003e\u003c\u003c(9998)(1)\u003c\u003c\u003c\u003c\u003e\u003c\u003e\u003e\u003c\u003e(41)\u003c\u003e\u003c\u003e\u003e\u003c\u003c(0)\u003e\u003c\u003e(9998)(1)\u003c\u003c\u003c(1)[(1)\u003e\u003c\u003e\u003e\u003e\u003c\u003c(9998)(1)\u003c\u003c\u003c\u003c\u003e\u003e\u003e\u003c\u003c\u003e\u003e\u003c\u003c[\u003e\u003e\u003c\u003e(40)\u003c\u003e\u003c\u003e\u003e\u003c\u003c\u003e\u003e\u003c\u003c\u003e\u003e\u003e\u003c\u003e\u003c\u003e\u003c\u003e\u003e\u003c\u003e(41)\u003c\u003e\u003c\u003e\u003e\u003c\u003c(0)]]\u003c\u003e\u003c\u003c(1)\u003e\u003c\u003e(8888)(1)(1)[(1)\u003e\u003c\u003e(7777)\u003c\u003e\u003e\u003e\u003e\u003e\u003c\u003e\u003e\u003e\u003c\u003c(40)\u003c\u003e\u003e\u003e\u003e\u003e\u003c\u003e(0)\u003e\u003c\u003e\u003c\u003c\u003c\u003e\u003e\u003e\u003c\u003e(1)\u003e\u003c\u003e(2)\u003c\u003e\u003e\u003e\u003e\u003c\u003c[(0)\u003e\u003c\u003e\u003e\u003e\u003c\u003c\u003e\u003e\u003e\u003c\u003e\u003c\u003e\u003c\u003e\u003e\u003c\u003e(1)\u003e\u003c\u003e(8888)(0)\u003e\u003c\u003e(0)](1)\u003e\u003c\u003e\u003e\u003c\u003c[(0)\u003e\u003c\u003e\u003e\u003e\u003c\u003c\u003e\u003e\u003e\u003c\u003e\u003c\u003e\u003c\u003e\u003e\u003c\u003c(1)\u003e\u003c\u003e(7777)(0)\u003e\u003c\u003e(0)]\u003e\u003e\u003c\u003c(9998)(1)\u003c\u003c\u003c\u003c\u003e\u003e\u003e\u003c\u003c]\u003c\u003e\u003c\u003c\u003e\u003e\u003e\u003c\u003c\n```\n\n## Specification\n\nTru is a stack-based virtual machine.\n\nThere are two built-in stacks which tru programs can manipulate using the following set of instructions.\n\n### Instructions\n\n| Instruction  |  Description |\n|---|---|\n| `(`  |  Start describing an integer to push |\n| `)`  | Push the integer between the corresponding opening bracket to the current stack.  |\n| `\u003c\u003e\u003c\u003e\u003e\u003c\u003c`  | Print character: Pop from the current stack and print the value as a UTF-8 character  |\n| `\u003c\u003e\u003c\u003e\u003e\u003c\u003e`  |  Print integer: Pop from the current stack and print the value as a number |\n| `\u003c\u003e\u003c\u003e\u003e\u003e`  | Integer input: Get an integer input and push to the current stack as a number |\n| `\u003c\u003e\u003c\u003e\u003c`  | Character input: Get an integer input and push to the current stack as a UTF-8 character |\n| `\u003e\u003e\u003e\u003c\u003c`  | End: Specify the end of the program  |\n| `\u003e\u003e\u003e\u003c\u003e`  | Move: Pop from the current stack and push to the other stack |\n| `\u003c\u003e\u003c\u003c`  |  Discard: Pop from the current stack and discard |\n| `\u003e\u003e\u003c\u003c`  | Duplicate the top value of the current stack  |\n| `\u003e\u003e\u003c\u003e`  |  Swap the top two values of the current stack |\n| `\u003e\u003e\u003e\u003e`  |  Subtract |\n| `\u003c\u003c\u003c`  | Add  |\n| `\u003c\u003c\u003e`  |  Greater than |\n| `\u003c\u003e\u003e`  | Equals  |\n| `\u003e\u003c\u003c`  | Not  |\n| `\u003e\u003c\u003e`  | Select stack: Pop from the stack and set the current stack equal to the value. The stacks are indexed 0 and 1.  |\n| `[`  | Jump: Pop the current stack and jump to the matching ] if the value is zero  |\n| `]`  | Jump: Pop the current stack and jump to the matching [ if the value is non-zero   |\n| `#`  | Comment: ignore all characters that follow for the rest of the line |\n\nIn summary, instructions are represented by only using bracket characters:\n\n```\n(, ), [, ], \u003c, \u003e\n```\n\nInstructions are prefix-free and can directly follow one another. For instance,\n\n```\n(1)\n\u003e\u003e\u003c\u003c\n(2)\n\u003c\u003c\u003c\n\u003e\u003e\u003c\u003c\n\u003c\u003e\u003c\u003e\u003e\u003c\u003c\n```\n\nis equivalent to\n\n```\n(1)\u003e\u003e\u003c\u003c(2)\u003c\u003c\u003c\u003e\u003e\u003c\u003c\u003c\u003e\u003c\u003e\u003e\u003c\u003c\n```\n\n### Linebreaks and spaces\n\nLinebreaks and spaces are permitted and ignored. However, numbers and instructions cannot be broken with linebreaks or spaces.\n\n```\n# Okay\n(\n  10\n)\n\n# Not okay\n(\n1\n0\n)\n\n# Okay\n\u003e\u003e\u003c\u003c\n\n# Not okay\n\u003e\u003e\n\u003c\u003c\n```\n\nOne can write a relatively readable tru program using linebreaks, spaces and comments. It can always be compressed due to the prefix-free nature of the instructions.\n\n## Tru VM implementation\n\nPytru is an official tru virtual machine implemented in Python. You can use it to execute tru code.\n\n```\n# pytru requires Python 3\npython3 ./tru.py input_file_path\n```\n\n## License\n\nApache 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsungwoncho%2Ftru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsungwoncho%2Ftru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsungwoncho%2Ftru/lists"}