{"id":18259966,"url":"https://github.com/theflyingcodr/goforth","last_synced_at":"2025-04-08T23:44:30.830Z","repository":{"id":105026278,"uuid":"337571514","full_name":"theflyingcodr/goforth","owner":"theflyingcodr","description":"A golang implementation of a stack based reverse polish notation language, much like Forth or Bitcoin Script.","archived":false,"fork":false,"pushed_at":"2021-02-10T10:42:31.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-03-04T05:08:56.128Z","etag":null,"topics":["bitcoin-script","forth","golang","golang-library","stack"],"latest_commit_sha":null,"homepage":"","language":"Go","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/theflyingcodr.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-02-10T00:09:22.000Z","updated_at":"2024-06-19T07:45:59.821Z","dependencies_parsed_at":null,"dependency_job_id":"cc6c4a14-35a9-4c0a-9584-7805bc02d650","html_url":"https://github.com/theflyingcodr/goforth","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theflyingcodr%2Fgoforth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theflyingcodr%2Fgoforth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theflyingcodr%2Fgoforth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theflyingcodr%2Fgoforth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theflyingcodr","download_url":"https://codeload.github.com/theflyingcodr/goforth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247947825,"owners_count":21023058,"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":["bitcoin-script","forth","golang","golang-library","stack"],"created_at":"2024-11-05T10:41:15.831Z","updated_at":"2025-04-08T23:44:30.812Z","avatar_url":"https://github.com/theflyingcodr.png","language":"Go","readme":"# GoForth\n\nAfter reading about the [Forth](https://en.wikipedia.org/wiki/Forth_(programming_language)) programming language and its relationship to bitcoin script I decided to have a bash and writing an example in go, because, why not!\n\nThis is a stack based (LIFO) [reverse polish](https://en.wikipedia.org/wiki/Reverse_Polish_notation) language.\n\nIt has a limited set of simple operators as this is just a toy and learning experience at the moment, these are listed below:\n\n| Operator \t| Description                                                                                \t|\n|----------\t|--------------------------------------------------------------------------------------------\t|\n| ADD      \t| Adds two numbers and pushes the result to the stack                                        \t|\n| SUB      \t| Takes a number from another and pushes the result to the stack                             \t|\n| EQ       \t| Evaluates if the preceeding two values are equal, it will push 1 if TRUE or 0 if FALSE     \t|\n| NE       \t| Evaluates if the preceeding two values are not equal, it will push 1 if TRUE or 0 if FALSE \t|\n| HASH256  \t| Generates a SHA256 from the preceeding value and pushes to the stack                       \t|\n\nMore can be easily added by adding to the ops.go file - feel free to create an issue and PR if you want some more for some reason.\n\n## Useage\n\nIt's a very simple public interface, just one function that takes your expression string and returns the last remaining item on the stack after evaluating every word in the expression.\n\nTo add two numbers for example, you would supply this string `2 3 ADD` which would evaluate to 5.\n\nIn terms of this library you would do:\n\n```go\nresult := goforth.Run(\"1 10 ADD 11 EQ HASH256\")\n```\n\n## Contributing\n\nIf for whatever reason you have a use for this and want to add more operators create an issue and PR and add them to the `ops.go` file.\n\nSame goes if you spot an error, which is highly likely as I just threw this together very quickly.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheflyingcodr%2Fgoforth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheflyingcodr%2Fgoforth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheflyingcodr%2Fgoforth/lists"}