{"id":13748721,"url":"https://github.com/tsoding/Noq","last_synced_at":"2025-05-09T11:31:15.078Z","repository":{"id":39704719,"uuid":"472875879","full_name":"tsoding/Noq","owner":"tsoding","description":"Simple expression transformer that is not Coq.","archived":false,"fork":false,"pushed_at":"2023-11-02T09:06:08.000Z","size":187,"stargazers_count":258,"open_issues_count":15,"forks_count":24,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-29T12:22:16.904Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/tsoding.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":"2022-03-22T17:51:20.000Z","updated_at":"2025-04-05T06:58:51.000Z","dependencies_parsed_at":"2023-10-02T07:45:30.390Z","dependency_job_id":"b8da3bc9-c37f-4a86-b6ce-864b1d72c32e","html_url":"https://github.com/tsoding/Noq","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsoding%2FNoq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsoding%2FNoq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsoding%2FNoq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsoding%2FNoq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsoding","download_url":"https://codeload.github.com/tsoding/Noq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253240350,"owners_count":21876593,"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":[],"created_at":"2024-08-03T07:00:48.172Z","updated_at":"2025-05-09T11:31:14.797Z","avatar_url":"https://github.com/tsoding.png","language":"Rust","funding_links":[],"categories":["Projects"],"sub_categories":["Provers and Solvers"],"readme":"# Noq\n\n**EXTREMELY IMPORTANT! THIS LANGUAGE IS A WORK IN PROGRESS! ANYTHING CAN CHANGE AT ANY MOMENT WITHOUT ANY NOTICE! USE THIS LANGUAGE AT YOUR OWN RISK!**\n\nNot [Coq](https://coq.inria.fr/). Simple expression transformer that is NOT Coq.\n\n## Quick Start\n\n```console\n$ cargo run ./examples/peano.noq\n```\n\n## Main Idea\n\nThe Main Idea is being able to define transformation rules of symbolic algebraic expressions and sequentially applying them.\n\n## Expression\n\nCurrent expression syntax can be defined roughly like this:\n\n```\n\u003cexpression\u003e ::= \u003coperator-0\u003e\n\u003coperator-0\u003e ::= \u003coperator-1\u003e ((`+` | `-`) \u003coperator-0\u003e)*\n\u003coperator-1\u003e ::= \u003coperator-2\u003e ((`*` | `/`) \u003coperator-1\u003e)*\n\u003coperator-2\u003e ::= \u003cprimary\u003e (`^` \u003coperator-2\u003e)*\n\u003cprimary\u003e ::= (`(` \u003cexpression\u003e `)`) | \u003capplication-chain\u003e | \u003csymbol\u003e | \u003cvariable\u003e\n\u003capplication-chain\u003e ::= (\u003csymbol\u003e | \u003cvariable\u003e) (\u003cfun-args\u003e)+\n\u003csymbol\u003e ::= [a-z0-9][_a-zA-Z0-9]*\n\u003cvariable\u003e ::= [_A-Z][_a-zA-Z0-9]*\n\u003cfun-args\u003e ::= `(` (\u003cexpression\u003e),* `)`\n```\n\n## Rules and Shapes\n\nThe two main entities of the language are Rules and Shapes. A rule defines pattern (head) and it's corresponding substitution (body). The rule definition has the following syntax:\n\n```\n\u003cname:symbol\u003e :: \u003chead:expression\u003e = \u003cbody:expression\u003e\n```\n\nHere is an example of a rule that swaps elements of a pair:\n\n```\nswap :: swap(pair(A, B)) = pair(B, A)\n```\n\nShaping is a process of sequential applying of rules to an expression transforming it into a different expression. Shaping has the following syntax:\n\n```\n\u003cexpression\u003e {\n  ... sequence of rule applications ...\n}\n```\n\nFor example here is how you shape expression `swap(pair(f(a), g(b)))` with the `swap` rule defined above:\n\n```\nswap(pair(f(a), g(b))) {\n  swap | all\n}\n```\n\nThe result of this shaping is `pair(g(b), f(a))`.\n\n### Anonymous rules\n\nYou don't have to define a rule to use it in shaping:\n\n```\nswap(pair(f(a), g(b))) {\n  swap(pair(A, B)) = pair(B, A) | all\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsoding%2FNoq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsoding%2FNoq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsoding%2FNoq/lists"}