Skip to content

Commit 3f3af2b

Browse files
Yifeng Evan Wangclaude
andcommitted
feat(course): 30 compiler-graded chapters + glossary + cleanup
- 30 chapters (e02-e12, i01-i10, a01-a09) authored in 简体中文 + 日本語, each example backed by a verified Typed English snippet. 184 snippets total — all type-check against the library AND resolve to their exact English sentence (pnpm verify:snippets). Covers be, tenses, modals, comparison, infinitives, gerunds, clauses, passive, conditionals, reported speech, participles. - Glossary now covers every course word (pnpm verify:vocab); verify-vocab counts inflected forms; added verify-chapter.mjs (scoped, parallel-safe grader). - Cleared stale Japanese Eval benchmark rounds so none ship; Eval tab degrades to an empty state. Build: 74 prerendered zh/ja pages, 0 typed-japanese refs. - Library README + project metadata. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 7b33262 commit 3f3af2b

81 files changed

Lines changed: 21100 additions & 13316 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,63 @@
1-
# Typed English
1+
# Typed English 📖
2+
3+
**Type-level English grammar.** Every constructor evaluates to the real surface
4+
string *at the type level*, so an English sentence written as a TypeScript type
5+
*resolves* to exactly the English it spells out — and the compiler checks it.
6+
7+
```ts
8+
import type { ConjugateVerb, Go, Sentence, DeterminerPart, NounPart, VerbPart, PunctuationPart } from "typed-english";
9+
10+
type Went = ConjugateVerb<Go, "Past">; // ⇒ "went"
11+
12+
type S = Sentence<[
13+
DeterminerPart<"the">,
14+
NounPart<"dog">,
15+
VerbPart<{ base: "run"; past: "ran" }, "Past">,
16+
PunctuationPart<".">,
17+
]>; // ⇒ "The dog ran."
18+
```
19+
20+
If you conjugate a verb wrong, the spelling won't match and TypeScript tells you.
21+
Grammar stops being something you memorize and becomes something the type checker
22+
verifies. This is the sibling of
23+
[Typed Japanese](https://github.com/typedgrammar/typed-japanese) and
24+
[Typed Korean](https://github.com/typedgrammar/typed-korean), for English.
25+
26+
## The library (`src/`)
27+
28+
| File | What it models |
29+
| --- | --- |
30+
| `verb-types.d.ts` | `ConjugateVerb<V, Form>` — base / 3rd-person / past / past participle / gerund / infinitive, with regular orthography (`-s`, `-es`, `-ies`, `-ed`, `-ing`) computed at the type level and overrides for irregulars. |
31+
| `noun-types.d.ts` | Pluralization, the Saxon genitive, and the pronoun classes. |
32+
| `adjective-types.d.ts` | Degrees of comparison (`-er` / `-est`, plus `more` / `most`). |
33+
| `adverb-types.d.ts` | `Adverbialize` (quick → quickly) and closed adverb classes. |
34+
| `function-word-types.d.ts` | Articles, determiners, prepositions, conjunctions, auxiliaries, modals. |
35+
| `phrase-types.d.ts` | The `Part` system + `Sentence<[...]>` — joins parts with spaces (gluing punctuation and the `'s` clitic), then capitalizes. |
36+
37+
## The playground (`playground/`)
38+
39+
An interactive site — bilingual (**简体中文 / 日本語**) — with four parts:
40+
41+
- **📚 Grammar Course** — chapters from elementary to advanced; every example
42+
sentence is a verified Typed English snippet you can open in the analyzer.
43+
- **🏛 Foundations** — short articles on the *architecture* of English, framed
44+
as a type system.
45+
- **🔤 Glossary** — every word the course uses, with part of speech and meaning.
46+
- **🧪 Playground** — write an English sentence as a TypeScript type and watch
47+
the compiler resolve and visualize its structure (real Monaco + TS in-browser).
48+
49+
```bash
50+
cd playground
51+
pnpm install
52+
pnpm dev # Vite dev server
53+
pnpm build # type-check + production build + SSR prerender to dist/
54+
pnpm verify:snippets # every course snippet type-checks AND resolves to its sentence
55+
pnpm verify:vocab # every course word is indexed in the glossary
56+
```
57+
58+
Deployed to GitHub Pages from `playground/dist` (see
59+
`.github/workflows/deploy-playground.yml`).
60+
61+
## License
62+
63+
MIT

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
"typecheck": "tsc --noEmit",
1010
"build": "tsc",
1111
"lint": "eslint . --ext .ts,.tsx",
12-
"test": "pnpm typecheck && pnpm lint && pnpm run-examples",
13-
"run-examples": "node --loader ts-node/esm src/examples/basic.ts",
14-
"examples": "node --loader ts-node/esm src/examples/basic.ts"
12+
"test": "pnpm typecheck && pnpm lint"
1513
},
1614
"keywords": [
1715
"typescript",

playground/dist-server/entry-server.js

Lines changed: 11152 additions & 5659 deletions
Large diffs are not rendered by default.

playground/eval/history/bench-001.json

Lines changed: 0 additions & 119 deletions
This file was deleted.

0 commit comments

Comments
 (0)