{"id":13502958,"url":"https://github.com/maciejhirsz/logos","last_synced_at":"2025-05-06T01:16:44.671Z","repository":{"id":39311229,"uuid":"156874300","full_name":"maciejhirsz/logos","owner":"maciejhirsz","description":"Create ridiculously fast Lexers","archived":false,"fork":false,"pushed_at":"2025-04-14T15:03:15.000Z","size":2224,"stargazers_count":3138,"open_issues_count":108,"forks_count":133,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-05-06T01:16:37.301Z","etag":null,"topics":["lexer","lexer-generator","parser","parsing","rust"],"latest_commit_sha":null,"homepage":"https://logos.maciej.codes","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maciejhirsz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","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,"zenodo":null},"funding":{"github":["maciejhirsz"]}},"created_at":"2018-11-09T14:37:11.000Z","updated_at":"2025-05-05T19:54:37.000Z","dependencies_parsed_at":"2023-02-17T02:45:58.054Z","dependency_job_id":"91e35782-84e3-4e0c-aa05-638deec45f82","html_url":"https://github.com/maciejhirsz/logos","commit_stats":{"total_commits":159,"total_committers":28,"mean_commits":5.678571428571429,"dds":0.6037735849056604,"last_synced_commit":"5d44f5aac4ac93c024d9218cb75a13081d7b4a8d"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciejhirsz%2Flogos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciejhirsz%2Flogos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciejhirsz%2Flogos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciejhirsz%2Flogos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maciejhirsz","download_url":"https://codeload.github.com/maciejhirsz/logos/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252601896,"owners_count":21774666,"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":["lexer","lexer-generator","parser","parsing","rust"],"created_at":"2024-07-31T22:02:31.768Z","updated_at":"2025-05-06T01:16:44.650Z","avatar_url":"https://github.com/maciejhirsz.png","language":"Rust","funding_links":["https://github.com/sponsors/maciejhirsz"],"categories":["Rust"],"sub_categories":[],"readme":"\u003cimg src=\"https://raw.githubusercontent.com/maciejhirsz/logos/master/logos.svg?sanitize=true\" alt=\"Logos logo\" width=\"250\" align=\"right\"\u003e\n\n# Logos\n\n[![Book](https://github.com/maciejhirsz/logos/actions/workflows/pages.yml/badge.svg?branch=master)](https://logos.maciej.codes/)\n[![Crates.io version shield](https://img.shields.io/crates/v/logos.svg)](https://crates.io/crates/logos)\n[![Docs](https://docs.rs/logos/badge.svg)](https://docs.rs/logos)\n[![Crates.io license shield](https://img.shields.io/crates/l/logos.svg)](https://crates.io/crates/logos)\n[![Code coverage](https://codecov.io/gh/maciejhirsz/logos/branch/master/graph/badge.svg)](https://codecov.io/gh/maciejhirsz/logos)\n\n_Create ridiculously fast Lexers._\n\n**Logos** has two goals:\n\n+ To make it easy to create a Lexer, so you can focus on more complex problems.\n+ To make the generated Lexer faster than anything you'd write by hand.\n\nTo achieve those, **Logos**:\n\n+ Combines all token definitions into a single [deterministic state machine](https://en.wikipedia.org/wiki/Deterministic_finite_automaton).\n+ Optimizes branches into [lookup tables](https://en.wikipedia.org/wiki/Lookup_table) or [jump tables](https://en.wikipedia.org/wiki/Branch_table).\n+ Prevents [backtracking](https://en.wikipedia.org/wiki/ReDoS) inside token definitions.\n+ [Unwinds loops](https://en.wikipedia.org/wiki/Loop_unrolling), and batches reads to minimize bounds checking.\n+ Does all of that heavy lifting at compile time.\n\n## Example\n\n```rust\nuse logos::Logos;\n\n#[derive(Logos, Debug, PartialEq)]\n#[logos(skip r\"[ \\t\\n\\f]+\")] // Ignore this regex pattern between tokens\nenum Token {\n    // Tokens can be literal strings, of any length.\n    #[token(\"fast\")]\n    Fast,\n\n    #[token(\".\")]\n    Period,\n\n    // Or regular expressions.\n    #[regex(\"[a-zA-Z]+\")]\n    Text,\n}\n\nfn main() {\n    let mut lex = Token::lexer(\"Create ridiculously fast Lexers.\");\n\n    assert_eq!(lex.next(), Some(Ok(Token::Text)));\n    assert_eq!(lex.span(), 0..6);\n    assert_eq!(lex.slice(), \"Create\");\n\n    assert_eq!(lex.next(), Some(Ok(Token::Text)));\n    assert_eq!(lex.span(), 7..19);\n    assert_eq!(lex.slice(), \"ridiculously\");\n\n    assert_eq!(lex.next(), Some(Ok(Token::Fast)));\n    assert_eq!(lex.span(), 20..24);\n    assert_eq!(lex.slice(), \"fast\");\n\n    assert_eq!(lex.next(), Some(Ok(Token::Text)));\n    assert_eq!(lex.slice(), \"Lexers\");\n    assert_eq!(lex.span(), 25..31);\n\n    assert_eq!(lex.next(), Some(Ok(Token::Period)));\n    assert_eq!(lex.span(), 31..32);\n    assert_eq!(lex.slice(), \".\");\n\n    assert_eq!(lex.next(), None);\n}\n```\n\nFor more examples and documentation, please refer to the\n[Logos handbook](https://maciejhirsz.github.io/logos/) or the\n[crate documentation](https://docs.rs/logos/latest/logos/).\n\n## How fast?\n\nRidiculously fast!\n\n```norust\ntest identifiers                       ... bench:         647 ns/iter (+/- 27) = 1204 MB/s\ntest keywords_operators_and_punctators ... bench:       2,054 ns/iter (+/- 78) = 1037 MB/s\ntest strings                           ... bench:         553 ns/iter (+/- 34) = 1575 MB/s\n```\n\n## Acknowledgements\n\n+ [Pedrors](https://pedrors.pt/) for the **Logos** logo.\n\n## Thank you\n\n**Logos** is very much a labor of love. If you find it useful, consider\n[getting me some coffee](https://github.com/sponsors/maciejhirsz). ☕\n\nIf you'd like to contribute to Logos, then consider reading the\n[Contributing guide](https://maciejhirsz.github.io/logos/contributing).\n\n## Contributing\n\n**Logos** welcome any kind of contribution: bug reports, suggestions,\nor new features!\n\nPlease use the\n[issues](https://github.com/maciejhirsz/logos/issues) or\n[pull requests](https://github.com/maciejhirsz/logos/pulls) tabs,\nwhen appropriate.\n\nTo release a new version, follow the [RELEASE-PROCESS](RELEASE-PROCESS.md)\n\n## License\n\nThis code is distributed under the terms of both the MIT license\nand the Apache License (Version 2.0), choose whatever works for you.\n\nSee [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaciejhirsz%2Flogos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaciejhirsz%2Flogos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaciejhirsz%2Flogos/lists"}