{"id":15980162,"url":"https://github.com/appcypher/opto","last_synced_at":"2026-01-19T02:32:01.268Z","repository":{"id":97524879,"uuid":"217773591","full_name":"appcypher/opto","owner":"appcypher","description":"An optimizer and compiler generator for SSA WebAssembly","archived":false,"fork":false,"pushed_at":"2020-04-22T02:05:39.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T18:16:40.659Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appcypher.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-10-26T21:52:08.000Z","updated_at":"2020-04-22T02:05:42.000Z","dependencies_parsed_at":"2024-02-16T08:30:55.690Z","dependency_job_id":null,"html_url":"https://github.com/appcypher/opto","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"0c0dc6434eb749fc19599da57e980439d57c86f4"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/appcypher/opto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcypher%2Fopto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcypher%2Fopto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcypher%2Fopto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcypher%2Fopto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appcypher","download_url":"https://codeload.github.com/appcypher/opto/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcypher%2Fopto/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28558229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T00:46:33.223Z","status":"online","status_checked_at":"2026-01-19T02:00:08.049Z","response_time":67,"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":[],"created_at":"2024-10-08T00:01:58.165Z","updated_at":"2026-01-19T02:32:01.247Z","avatar_url":"https://github.com/appcypher.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"#\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://image.flaticon.com/icons/svg/1179/1179774.svg\" alt=\"Opto Logo\" width=\"140\" height=\"140\"\u003e\u003c/img\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\n\n\u003ch2 align=\"center\"\u003eOPTO\u003c/h2\u003e\n\n--------------\n\n### DESCRIPTION\n\nOpto is an optimizer and compiler generator for transforming SSA WebAssembly and compiling it to machine code. Opto comes with a term rewriting language.\n\nFor now the focus will be on interpreting the term rewriting language.\n\n--------------\n\n### PROJECT STRUCTURE\n\n```\n- interpreter\n- terms\n    - wat_to_wat\n    - wat_to_x86\n```\n\n-------------\n\n### A SINGLE TERM REWRITING LANGUAGE\n\nThe goal is to be less academic and more high-level. Term rewriting is all about pattern matching.\n\n##### Constant Propagation Example\n\n```\n// wat -\u003e wat\n\n@ignore_spaces() // Special pattern directive.\nval := \\d+ // Pattern.\n\nallow_constants = 1 // Double. The only supported primitive type.\nconstants = {} // Hashmap. The only supported DS.\n\nconstant_fold := // Mapping Pattern.\n    \"(#ty.const :val) (local.set #name)\" =\u003e {\n        constants[#name] = (:val, #ty)\n    }\n\nconstant_propagation :=\n    \"(local.get #name)\" =\u003e {\n        (#val, #ty) = constants[#name]\n        \"(#ty.const #val)\"\n    }\n\napply_constants (:expr) { // Functions. They take patterns as arguments.\n    proof (allow_constants = 0) { // A proof statement.\n        constant_fold()\n        constant_propagation()\n    }\n}\n\napply_constants()\n\n// Checking if a rewrite is a result of constant_propagation\nproof (:constant_propagation) {\n    @print(\"There is a constant here\", :constant_propagation)\n}\n```\n\n\n--------------\n\n### FUTURE CLI\n\n- Generate an x86 optimizer and compiler\n\n```bash\n./optogen --target-triple=x86-none-darwin --optfile=rules.opto -o compiler\n```\n\n- Optimize wasm file and generate x86 executable code\n\n```bash\n./compiler add.wasm\n./add\n```\n\n### DESIGN REFERENCES\n\n- Binaryen\n- Cranelift\n- LLVM\n\n--------------\n\n### LINKS\n\n- https://www.sciencedirect.com/science/article/pii/S1571066108001473\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappcypher%2Fopto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappcypher%2Fopto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappcypher%2Fopto/lists"}