A seamless integration layer between Logos and Chumsky parser combinator, providing zero-copy TokenStream adapter and Parseable trait for building robust parsers
English | įŽäŊ䏿
Overview
LogoSky is a Rust library that bridges Logos and Chumsky, combining the speed of Logos' lexical analysis with the expressiveness of Chumsky's parser combinators. It provides a seamless integration layer that allows you to use Logos for tokenization and Chumsky for parsing in a unified, type-safe manner.
Features
- đ High-performance tokenization with Logos
- đ¯ Expressive parser combinators with Chumsky
- đ Seamless integration via
TokenStreamadapter - đ Rich span tracking with
SpanandSpannedtypes - đ¨ Flexible parseable trait for building composable parsers
- đ§ No-std support with optional allocator
- đ§Š Multiple source types support (
str,[u8],Bytes,BStr,HipStr) - ⥠Zero-cost abstractions for efficient parsing
Installation
Add this to your Cargo.toml:
[]
= "0.1"
Feature Flags
std(default) - Enable standard library supportalloc- Enable allocator support for no-std environmentsbytes- Support forbytes::Bytesas token sourcebstr- Support forbstr::BStras token sourcehipstr- Support forhipstr::HipStras token sourceeither- EnableEither<L, R>parseable supportamong- EnableAmong<L, M, R>parseable supportsmallvec- Enable small vector optimization utilities
Core Components
-
TokenStream<'a, T>An zero-copy adapter that bridges Logos lexer output to Chumsky parser input. Implements Chumsky's
Input,ValueInput,SliceInput, andExactSizeInputtraits. -
Token<'a>TraitThe core trait for defining tokens. Requires:
Char: Character type (usuallycharoru8)Kind: Token kind discriminatorLogos: Associated Logos token enum
-
Parseable<'a, I, T, Error>TraitA trait for types that can be parsed from a token stream. Implement this to create composable parsers.
-
SpanandSpanned<T>Span: Lightweight span tracking (start/end positions)Spanned<T>: Wraps a value with its source span
-
Utility Traits
IsAsciiChar: ASCII character checking utilitiesAsSpan/IntoSpan: Span access traitsIntoComponents: Destructure parsed elements
Who uses logosky?
smear: Blazing fast, fully spec-compliant, reusable parser combinators for standard GraphQL and GraphQL-like DSLs.
License
logosky is dual-licensed under:
- MIT License (LICENSE-MIT)
- Apache License, Version 2.0 (LICENSE-APACHE)
You may choose either license for your purposes.
Copyright (c) 2025 Al Liu.