Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
L

logos

> 编程语言
Open source

Create ridiculously fast Lexers

3.5K stars0 likes0 views
WebsiteGitHub

About

Create ridiculously fast Lexers

Logos

Create ridiculously fast Lexers.

Logos has two goals:

  • To make it easy to create a Lexer, so you can focus on more complex problems.
  • To make the generated Lexer faster than anything you'd write by hand.

To achieve those, Logos:

  • Combines all token definitions into a single deterministic state machine.
  • Optimizes branches into lookup tables or jump tables.
  • Prevents backtracking inside token definitions.
  • Unwinds loops, and batches reads to minimize bounds checking.
  • Does all of that heavy lifting at compile time.

Example

…

For more examples and documentation, please refer to the Logos handbook or the crate documentation.

How fast?

Ridiculously fast!

test identifiers                       ... bench:         647 ns/iter (+/- 27) = 1204 MB/s
test keywords_operators_and_punctators ... bench:       2,054 ns/iter (+/- 78) = 1037 MB/s
test strings                           ... bench:         553 ns/iter (+/- 34) = 1575 MB/s

Acknowledgements

  • Pedrors for the Logos logo.

Thank you

Logos is very much a labor of love. If you find it useful, consider getting me some coffee. ☕

If you'd like to contribute to Logos, then consider reading the Contributing guide.

Contributing

Logos welcome any kind of contribution: bug reports, suggestions, or new features!

Please use the issues or pull requests tabs, when appropriate.

To release a new version, follow the RELEASE-PROCESS

License

This code is distributed under the terms of both the MIT license and the Apache License (Version 2.0), choose whatever works for you.

See LICENSE-APACHE and LICENSE-MIT for details.

GitHub Issues· 90 open

View all on GitHub
  • #583

    LLM Policy

    questionUpdated Sep 11, 2026
  • #580

    regex pattern for a token breaks on the letter `u` and no other letters when using subpatterns

    bugUpdated Sep 1, 2026
  • #575

    Overflow in `Source::read` bounds check causes UB

    Updated Jul 5, 2026
  • #574

    `LexerInternal::bump_unchecked` exposes unvalidated offset mutation

    Updated Jul 5, 2026
  • #573

    Misbehaving `Source` impls can enable Out-of-Bounds reads

    Updated Jul 5, 2026
  • #572

    Misbehaving `Logos` trait leading to double-free via `ManuallyDrop::take`

    Updated Jul 5, 2026
  • #571

    `Lexer::bump` is not exception safe, leading to out-of-bounds read

    Updated Jul 5, 2026
  • #565

    I don't understand the new restriction on greedy matches

    questionUpdated Jun 23, 2026
  • #569

    True comparable cost (or performance) of usage scenarios

    enhancementgood first issueUpdated Jun 16, 2026
  • #568

    Mutable `Source` for in-place in no_std no-alloc/copy context

    Updated Jun 15, 2026

Highlights

  • •To make it easy to create a Lexer, so you can focus on more complex problems.
  • •To make the generated Lexer faster than anything you'd write by hand.
  • •Combines all token definitions into a single deterministic state machine.
  • •Optimizes branches into lookup tables or jump tables.
  • •Prevents backtracking inside token definitions.
  • •Unwinds loops, and batches reads to minimize bounds checking.
  • •Does all of that heavy lifting at compile time.
  • •Pedrors for the Logos logo.

> Tags

Rustlexerlexer-generatorparserparsing

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言