{"id":49925780,"url":"https://github.com/frendsick/torth","last_synced_at":"2026-05-16T23:27:13.692Z","repository":{"id":38211825,"uuid":"417985375","full_name":"frendsick/torth","owner":"frendsick","description":"Stack-based programming language","archived":false,"fork":false,"pushed_at":"2025-03-04T08:12:50.000Z","size":5432,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-04T09:24:56.110Z","etag":null,"topics":["compiler","language","programming-language","reverse-polish-notation","self-hosted","stack-based"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/frendsick.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-17T00:54:48.000Z","updated_at":"2025-03-04T08:12:53.000Z","dependencies_parsed_at":"2024-03-23T22:23:27.086Z","dependency_job_id":"6ff4bafc-2db4-4a95-a39a-05cda4bd7ee6","html_url":"https://github.com/frendsick/torth","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/frendsick/torth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frendsick%2Ftorth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frendsick%2Ftorth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frendsick%2Ftorth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frendsick%2Ftorth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frendsick","download_url":"https://codeload.github.com/frendsick/torth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frendsick%2Ftorth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33121986,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T18:38:32.183Z","status":"ssl_error","status_checked_at":"2026-05-16T18:38:29.903Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["compiler","language","programming-language","reverse-polish-notation","self-hosted","stack-based"],"created_at":"2026-05-16T23:27:12.851Z","updated_at":"2026-05-16T23:27:13.682Z","avatar_url":"https://github.com/frendsick.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Torth\n\nStack-based programming language inspired by [Porth](https://gitlab.com/tsoding/porth).\n\n- [x] Compiled\n- [x] Statically typed\n- [x] Native (Linux x86_64)\n- [x] Stack-based (just like Porth)\n- [x] [Turing complete](examples/rule110.torth)\n- [x] Self-hosted\n\n## Documentation\n\n- [Getting started](./docs/getting_started.md)\n- [Intrinsics](./docs/intrinsics.md)\n- [Keywords](./docs/keywords.md)\n- [Types](./docs/types.md)\n- [Control flow statements](./docs/control_flow.md)\n- [Syntax highlighting](./docs/syntax_highlighting.md)\n\n## Usage\n\n```sh\n$ cat hello.torth\ninclude \"std\"\nfunction main :\n  \"Hello, World!\\n\" puts\nend\n$ ./torth -r hello.torth\nHello, World!\n$ ./torth --help\nUsage: ./torth [-h] [--out FILE] [-r] [-s] [-v] code_file\n\nTorth compiler\n\nPositional arguments:\n  code_file             Input file\n\nOptions:\n  -h                    Show this help message and exit\n  --out FILE            Output file\n  -r                    Run program after compilation\n  -s                    Save files generated during compilation\n  -v                    Output compilation steps\n```\n\n## Examples\n\nMore examples are found in the [examples](./examples/) folder.\n\n### [Hello World](./examples/hello_world.torth)\n\n```pascal\ninclude \"std\"\n\nfunction main :\n    \"Hello, World!\\n\" puts\nend\n```\n\n### [Fibonacci](./examples/fibonacci.torth)\n\n```pascal\ninclude \"std\"\n\nfunction Fib number:int -\u003e int :\n  if number 1 \u003c= do\n    number return\n  endif\n\n  // Fib(number-1) + Fib(number-2)\n  number 1 - Fib\n  number 2 - Fib +\nend\n\nfunction main :\n  20 Fib putu // Prints: 4181\nend\n```\n\n### [FizzBuzz](./examples/fizzbuzz.torth)\n\n```pascal\n// === FIZZBUZZ ===\n// Print integers 1 to N with some exceptions:\n// =\u003e Print “Fizz” if an integer is divisible by 3\n// =\u003e Print “Buzz” if an integer is divisible by 5\n// =\u003e Print “FizzBuzz” if an integer is divisible by both 3 and 5\n\n// The standard library implements common functions, for example:\n// puts =\u003e Output string\n// %    =\u003e Modulo-operator\ninclude \"std\"\n\n// Returns the sum of numbers not divisible by 3 or 5\nfunction FizzBuzz limit:int -\u003e int :\n    // Push the initial values to stack\n    0   // sum\n    1   // index\n\n    // Save two topmost values from the stack to variables\n    // =\u003e The TAKE keyword also removes the values from the stack\n    // =\u003e The PEEK keyword would instead save the values without removing them from the stack\n    take index sum in\n\n    // Loop while index \u003c= limit\n    WHILE index limit \u003c= DO\n\n        // Newlines inside IF condition are just for readability\n        // =\u003e The whole program could be in one line\n        IF\n            index 3 % 0 ==\n            index 5 % 0 ==\n            \u0026\u0026\n        DO\n            \"FizzBuzz\\n\" puts\n        ELIF index 3 % 0 == DO\n            \"Fizz\\n\" puts\n        ELIF index 5 % 0 == DO\n            \"Buzz\\n\" puts\n        ELSE\n            // Print the current index\n            index putu \"\\n\" puts\n\n            // Add index to sum\n            sum index + sum =\n        ENDIF\n\n        // Increment loop's index\n        index 1 + index =\n    DONE\n    sum // Return sum\nend\n\n// Program execution starts from the `main` function\nfunction main :\n    // Call FizzBuzz with one integer parameter\n    // FizzBuzz(limit=30)\n    30 FizzBuzz\n\n    // Save the return value to a variable called sum and print it with text\n    take sum in\n    \"Sum of all numbers not divisible by 3 or 5: \" puts\n    sum putu \"\\n\" puts\nend\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrendsick%2Ftorth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrendsick%2Ftorth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrendsick%2Ftorth/lists"}