{"id":18113878,"url":"https://github.com/jezza/progger","last_synced_at":"2025-04-06T09:14:31.471Z","repository":{"id":69523305,"uuid":"293291271","full_name":"Jezza/progger","owner":"Jezza","description":"A fairly simple set of parser and lexer tools. Built on top of logos and bumpalo.","archived":false,"fork":false,"pushed_at":"2020-11-01T14:13:44.000Z","size":10,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-12T14:31:07.682Z","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/Jezza.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":"2020-09-06T14:15:58.000Z","updated_at":"2023-01-17T19:45:05.000Z","dependencies_parsed_at":"2023-02-23T16:30:51.318Z","dependency_job_id":null,"html_url":"https://github.com/Jezza/progger","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/Jezza%2Fprogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jezza%2Fprogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jezza%2Fprogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jezza%2Fprogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jezza","download_url":"https://codeload.github.com/Jezza/progger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247457809,"owners_count":20941906,"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-11-01T02:10:11.224Z","updated_at":"2025-04-06T09:14:31.442Z","avatar_url":"https://github.com/Jezza.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Progger\n\nNothing too crazy.\n\nJust a bunch of small utilities that I kept on bringing from one language project to another.\n\n## Parser\n\nIt contains a simple Parser base.\n\nIt handles things like peeking and span wrapping.\n\n```rust\nprogger::new_parser! {\n    Context = Context;\n    TokenKind = TokenKind;\n    Span = progger::span::Span;\n}\n```\n\n##  Span\n\nIt also contains a simple Span impl.\nThe Span that logos exports doesn't meet my requirements, and under the hood, it's just a range from the standard library.\n\nThat can be found under `progger::span::Span`.\n\nContains methods like `merge`, etc.\n\n## Arena and Interner\n\nThis project also contains things like an allocation arena and an Interner.  \nThey can be found under `mem`.\n\nThe arena allows for better cache locality when allocating a ton of AST nodes.\nThe interner allows for faster string book keeping and management.\n\n\n## Full Usage\n\n\nA more full-blown example using all the features would be something like:\n\n```rust\nuse logos::Logos;\n\nmod ast {\n    use progger::mem::ArenaId;\n\n    type ExprId = ArenaId\u003cExprId\u003e;\n\n    enum Expr {\n        Negate(ExprId),\n        Add(ExprId, ExprId),\n    }\n}\n\nstruct Context {\n    file_name: String,\n    pub(crate) interner: Interner,\n    pub(crate) expr: Arena\u003c'static, Expression\u003e,\n}\n\nimpl Context {\n    fn new(file_name: impl Into\u003cString\u003e) -\u003e Self {\n        Context {\n            file_name: file_name.into(),\n            interner: Interner::new(),\n            expr: Arena::new(),\n        }\n    }\n}\n\n\n#[derive(Logos)]\nenum TokenKind {\n    #[error]\n    Error,\n\n    #[token(\"value\")]\n    Value,\n}\n\nmod parser {\n    progger::new_parser! {\n        Context = Context;\n        TokenKind = TokenKind;\n        Span = progger::span::Span;\n    }\n}\n\nfn main() {\n    let file_name = \"Input.lance\";\n    let content = \"value\";\n\n    let ctx = Context::new(file_name);\n\n    let mut parser = parser::new(ctx, content);\n\n    if parser.is(TokenKind::Value) {\n        panic!(\"Yay!\");\n    }\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjezza%2Fprogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjezza%2Fprogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjezza%2Fprogger/lists"}