Aaryan-Kapoor/english-rs

Developer Tools

A Rust joke that doubles as a real grammar checker: type-level English plus the englishc prose linter.

104
0
Rust
MIT
2 days old

Adopt this as a well-crafted weekend experiment or teaching artifact, not as a tool for writing production documentation. Its two halves—the english type-level crate and the englishc prose checker—are best judged separately.

The problem

Suppose you're editing prose and want errors like "He are ready" or "me and my brother goed" flagged with the precision of a compiler diagnostic instead of a spell-checker's vague underline. Or, in the other direction, you're writing Rust and want the compiler to enforce subject-verb agreement in strings your program emits. englishc takes ordinary text, reports grammar violations in rustc's diagnostic style with error codes and source spans, and offers --fix where the correction is unambiguous. The english crate swaps the text and lets a macro parse a sentence into typed tokens so that a sentence either type-checks or fails to compile. In both workflows the grammar rules previously left to the writer become an explicit, reported check.

What's different

The mechanism is the interesting part. english! splits input into sentences, classifies the subject (pronoun, demonstrative, determiner-plus-noun, or a variable) and the verb's spelling via const fn, and turns that classification into a const-generic type. Verbs then require different Takes* trait bounds from their subjects, so agreement is a trait bound rather than a lookup table. Pronouns are borrows of their antecedent, so the borrow checker rejects a pronoun that outlives the noun it stands for. Inflection outside the macro is computed from dictionary forms, so irregular past tenses and plurals are handled by code rather than memorized exceptions—They.past("go") renders "went", and Noun::new("mouse").plural() renders "mice".

The trade-off is scope. The macro recognizes a deliberately small set of subject shapes and splits sentences only at ., ! and ?, so longer, rhetorical or nested prose is likely outside what it can type-check. englishc's fixes cover only cases with an unambiguous right answer. This is a demonstration that the type system can model grammar, not a general-purpose parsing layer for English.

Who should try it

Good fit: Rust programmers curious about const generics, trait bounds and borrows used for something other than memory, and instructors looking for a vivid example of encoding rules in types. Someone writing a linter or diagnostic UI can also learn from the rustc-style error rendering. Poor fit: anyone who wants to check essays, READMEs or marketing copy at scale, because the macro's sentence grammar and englishc's ability to fix problems are both intentionally bounded. The dependency-free workspace also makes it easy to read and experiment with, which suits a learning use case.

Requirements and limitations

The project is a day old at the time of the recorded snapshot, and the README excerpts show a focused, dependency-free workspace but not a broad compatibility statement. Building the browser playground requires the wasm32-unknown-unknown target; running the tests and the CLI does not. The macro's input language is a subset of Rust tokens, so words need spacing conventions (shown as 'm, don 't) and the recognized subject forms are limited. Expect to check whether your sentences fall inside that subset before relying on compile-time validation. There is no evidence here of a large rule set or a published accuracy evaluation for englishc.

HotRepo's take

The repo appears on HotRepo's NEW-REPOSITORY board for Rust at #18 with 104 total stars, observed 2026-10-27—a single dated snapshot, not a daily growth measurement. Trend evidence is insufficient to judge persistence. Before investing, check the README's example headings and the playground's sample programs to see whether your kinds of sentences are inside the supported subset.

Project source and documentation

Hacker News

English, rewritten in Rust
▲ 1 · 0 comments · October 26, 2026

Written by AI from the project's README, updated October 27, 2026. The project's own docs are the source of truth.