{"id":16313750,"url":"https://github.com/trackoor/OPG_Parser","last_synced_at":"2025-10-25T16:31:49.113Z","repository":{"id":50051805,"uuid":"372718366","full_name":"trackoor/OPG_Parser","owner":"trackoor","description":"🔪 OPG (Operator Precedence Grammar) Parser, in Coq.","archived":false,"fork":false,"pushed_at":"2021-06-25T06:29:49.000Z","size":286,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T09:05:23.857Z","etag":null,"topics":["coq","functional-programming","parser"],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/trackoor.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}},"created_at":"2021-06-01T06:03:43.000Z","updated_at":"2023-06-17T16:13:26.000Z","dependencies_parsed_at":"2022-08-28T23:02:53.329Z","dependency_job_id":null,"html_url":"https://github.com/trackoor/OPG_Parser","commit_stats":null,"previous_names":["trackoor/opg_parser"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trackoor%2FOPG_Parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trackoor%2FOPG_Parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trackoor%2FOPG_Parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trackoor%2FOPG_Parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trackoor","download_url":"https://codeload.github.com/trackoor/OPG_Parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238183452,"owners_count":19430119,"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":["coq","functional-programming","parser"],"created_at":"2024-10-10T21:52:11.891Z","updated_at":"2025-10-25T16:31:48.735Z","avatar_url":"https://github.com/trackoor.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OPG_Parser\n\n**🔪 Operator Precedence Grammar Parser, in Coq.**\n\nCourse Project for *Compiler Principle (SJTU-CS308-2021)*\n## Features\n\n- Grammar Parser (in Haskell)\n- Grammar Checker (in Coq)\n- Operator Precedence Analysis Table Generator (in Coq)\n- File IO and Pretty Printer (in Haskell)\n- Shell (in Haskell)\n\n## Demo\n\nThe file \"in1.txt\" contains an operator precedence grammar, shown as follows:\n\n```\nE -\u003e E + T | T\nT -\u003e T * F | F\nF -\u003e ( E ) | i\n```\n\nThe program can parse the grammar and output its analysis table:\n\n[![2N1Y90.png](https://z3.ax1x.com/2021/06/05/2N1Y90.png)](https://imgtu.com/i/2N1Y90)\n\nThe file \"in1.txt_output.md\" contains the analysis table:\n\n|      | +    | *    | (    | )    | i    | $    |\n| ---- | ---- | ---- | ---- | ---- | ---- | ---- |\n| +    | \u003e    | \u003c    | \u003c    | \u003e    | \u003c    | \u003e    |\n| *    | \u003e    | \u003e    | \u003c    | \u003e    | \u003c    | \u003e    |\n| (    | \u003c    | \u003c    | \u003c    | =    | \u003c    |      |\n| )    | \u003e    | \u003e    |      | \u003e    |      | \u003e    |\n| i    | \u003e    | \u003e    |      | \u003e    |      | \u003e    |\n| $    | \u003c    | \u003c    | \u003c    |      | \u003c    | =    |\n\n## How to build \n\nTo build the program, you need to install **Colourista** via stack\n```bash\n  stack install colourista\n```\nThen you can use GHCi/GHC to run/compile the program\n```bash\n  stack runhaskell Main.hs\n```\n\nor\n\n```bash\n  stack ghc -- -O2 Main.hs\n```\n\nor\n\n```bash\n  make\n```\n\n## Tests\n\nTest 1: \n\n```\nE -\u003e E + T | T\nT -\u003e T * F | F\nF -\u003e ( E ) | i\n```\n\nTest 2:\n\n```\nE -\u003e E + E | E * E | ( E ) | id\n```\n\nTest 3:\n\n```\nE -\u003e E + T | T\nT -\u003e T * F | F\nF -\u003e ( E E ) | i\n```\n\nHere is the result:\n\n[![2N1t3V.png](https://z3.ax1x.com/2021/06/05/2N1t3V.png)](https://imgtu.com/i/2N1t3V)\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n\n## Acknowledgements\n\n- [Colourista](https://github.com/kowainik/colourista): Convenient interface for printing colourful messages\n- [Coq Proof Assistant](https://coq.inria.fr/): A formal proof management system\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrackoor%2FOPG_Parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrackoor%2FOPG_Parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrackoor%2FOPG_Parser/lists"}