{"id":13837486,"url":"https://github.com/harpocrates/language-rust","last_synced_at":"2025-10-27T01:04:12.475Z","repository":{"id":56845371,"uuid":"71281899","full_name":"harpocrates/language-rust","owner":"harpocrates","description":"Parser and pretty-printer for the Rust language","archived":false,"fork":false,"pushed_at":"2023-09-18T07:08:43.000Z","size":1025,"stargazers_count":86,"open_issues_count":17,"forks_count":18,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-18T17:17:58.431Z","etag":null,"topics":["ast","parser","pretty-printer","rust","syntax"],"latest_commit_sha":null,"homepage":"https://hackage.haskell.org/package/language-rust","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harpocrates.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","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":"2016-10-18T19:03:57.000Z","updated_at":"2024-08-15T12:19:07.000Z","dependencies_parsed_at":"2024-05-30T04:34:26.336Z","dependency_job_id":"3902b739-0569-4b22-9304-8ccecc664b8e","html_url":"https://github.com/harpocrates/language-rust","commit_stats":{"total_commits":190,"total_committers":4,"mean_commits":47.5,"dds":"0.021052631578947323","last_synced_commit":"9d509c450d009cc99f1180b3f2f30247dfb1cfce"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/harpocrates/language-rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harpocrates%2Flanguage-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harpocrates%2Flanguage-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harpocrates%2Flanguage-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harpocrates%2Flanguage-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harpocrates","download_url":"https://codeload.github.com/harpocrates/language-rust/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harpocrates%2Flanguage-rust/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260633730,"owners_count":23039386,"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":["ast","parser","pretty-printer","rust","syntax"],"created_at":"2024-08-04T15:01:11.369Z","updated_at":"2025-10-11T23:34:41.390Z","avatar_url":"https://github.com/harpocrates.png","language":"Haskell","readme":"# Parser and pretty printer for Rust [![Build Status][4]][5] [![Windows build status][7]][8] [![Hackage Version][11]][12]\n\n`language-rust` aspires to efficiently and accurately parse and pretty print the [Rust language][0].\nThe underlying AST structures are also intended to be as similar as possible to the [`libsyntax` AST\nthat `rustc`][10] itself uses.\n\nA typical use looks like:\n\n```haskell\n\u003e\u003e\u003e :set -XTypeApplications +t\n\u003e\u003e\u003e import Language.Rust.Syntax\n\n\u003e\u003e\u003e -- Sample use of the parser\n\u003e\u003e\u003e import Language.Rust.Parser\n\u003e\u003e\u003e let inp = inputStreamFromString \"fn main () { println!(\\\"Hello world!\\\"); }\"\ninp :: InputStream\n\u003e\u003e\u003e let sourceFile = parse' @(SourceFile Span) inp\nsourceFile :: SourceFile Span\n\n\u003e\u003e\u003e -- Sample use of the pretty printer\n\u003e\u003e\u003e import Language.Rust.Pretty\n\u003e\u003e\u003e pretty' sourceFile\nfn main() {\n  println!(\"Hello world!\");\n}\nit :: Doc b\n```\n\n## Building\n\n### Cabal\n\nWith Cabal and GHC, run\n\n    cabal install happy --constraint 'happy \u003e= 1.19.8'\n    cabal install alex\n    cabal configure\n    cabal build\n\n### Stack\n\nWith the [Stack][1] tool installed, run\n\n    stack init\n    stack build\n\nThe second command is responsible for pulling in all of the dependencies (including executable\ntools like [Alex][2], [Happy][3], and GHC itself) and then compiling everything. If Stack complains\nabout the version of Happy installed, you can explicitly install a recent one with `stack install\nhappy-1.19.8`.\n\n## Evolution of Rust\n\nAs Rust evolves, so will `language-rust`. A best effort will be made to support unstable features\nfrom nightly as they come out, but only compatibility with stable is guaranteed. The last component\nof the version number indicates the nightly Rust compiler version against which tests were run. For\nexample, `0.1.0.26` is tested against `rustc 1.26.0-nightly`.\n\n## Bugs\n\nPlease report any bugs to the [github issue tracker][9].\n\n### Parser\n\nAny difference between what is accepted by the `rustc` parser and the `language-rust` parser\nindicates one of\n\n  * a bug in `language-rust` (this is almost always the case)\n  * a bug in `rustc`\n  * that there is a newer version of `rustc` which made a breaking change to this syntax\n\nIf the AST/parser of `rustc` changes, the `rustc-tests` test suite should start failing - it\ncompares the JSON AST debug output of `rustc` to our parsed AST.\n\n### Pretty printer\n\nFor the pretty printer, bugs are a bit tougher to list exhaustively. Suggestions for better layout\nalgorithms are most welcome! The [`fmt-rfcs`][6] repo is loosely used as the reference for \"correct\"\npretty printing.\n\n[0]: https://www.rust-lang.org/en-US/\n[1]: https://docs.haskellstack.org/en/stable/README/\n[2]: https://hackage.haskell.org/package/alex\n[3]: https://hackage.haskell.org/package/happy\n[4]: https://travis-ci.org/harpocrates/language-rust.svg?branch=master\n[5]: https://travis-ci.org/harpocrates/language-rust\n[6]: https://github.com/rust-lang-nursery/fmt-rfcs\n[7]: https://ci.appveyor.com/api/projects/status/um8dxklqmubvn091/branch/master?svg=true\n[8]: https://ci.appveyor.com/project/harpocrates/language-rust/branch/master\n[9]: https://github.com/harpocrates/language-rust/issues\n[10]: https://github.com/rust-lang/rust/blob/master/src/libsyntax/ast.rs\n[11]: https://img.shields.io/hackage/v/language-rust.svg\n[12]: https://hackage.haskell.org/package/language-rust\n","funding_links":[],"categories":["Haskell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharpocrates%2Flanguage-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharpocrates%2Flanguage-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharpocrates%2Flanguage-rust/lists"}