{"_id":"@codincod/codemirror-lang-chef","_rev":"3-359c8ebb49a1b11e8fe668d6a8720c4c","name":"@codincod/codemirror-lang-chef","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@codincod/codemirror-lang-chef","version":"0.1.0","keywords":["chef","code","codemirror","editor","esolang"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","_id":"@codincod/codemirror-lang-chef@0.1.0","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"homepage":"https://codincod.com/","dist":{"shasum":"cd0e8c22c1cc9ec766ea4afeccabe54245ddab13","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-chef/-/codemirror-lang-chef-0.1.0.tgz","fileCount":13,"integrity":"sha512-N/6VgBBEE13aYQs9DQs0bTTRQePNFYyIBdVvsyPXgBAhdlo61k71ku5HyRZPhgIMdXwLN+b/CcAkLyfqZ1/n4w==","signatures":[{"sig":"MEQCIDWAYLhEcCjqjPOVpIfnlw9+PCWUVI05V9h6IpLFyHm6AiAHHp1FCCj9iEcoWHm0AIvdFiQM8GguajZSDJSHvJ1oAw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":47713},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","exports":{"import":"./dist/index.js","require":"./dist/index.cjs"},"gitHead":"21c0b6c533487cf87a4705e054af30361c3228e2","scripts":{"gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group top","test":"npm run build && node --test \"test/*.test.ts\"","build":"rm -rf dist && lezer-generator src/chef.grammar -o src/parser.js && cm-buildhelper src/chef.ts","corpus":"npm run build && node ../lezer-survey/src/cli.ts measure --group top","prepare":"npm run build","build-debug":"lezer-generator src/chef.grammar --names -o src/parser.js && cm-buildhelper src/chef.ts"},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"repository":{"url":"https://codeberg.org/reeven/codemirror-lang-chef","type":"git"},"_npmVersion":"11.6.2","description":"Chef language support for the CodeMirror code editor","directories":{},"sideEffects":false,"_nodeVersion":"25.0.0","dependencies":{"@lezer/lr":"^1.0.0","@lezer/common":"^1.0.0","@lezer/highlight":"^1.0.0","@codemirror/language":"^6.0.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.0","@lezer/generator":"^1.7.0","@codemirror/state":"^6.7.1","@codemirror/buildhelper":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/codemirror-lang-chef_0.1.0_1786042875820_0.5437513475765499","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@codincod/codemirror-lang-chef","version":"0.2.0","keywords":["chef","code","codemirror","editor","esolang"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","_id":"@codincod/codemirror-lang-chef@0.2.0","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"homepage":"https://codincod.com/","dist":{"shasum":"c95fdc721e3c7c4cac178ba7c2dadbf690a081d7","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-chef/-/codemirror-lang-chef-0.2.0.tgz","fileCount":13,"integrity":"sha512-AVpoNtIs4obMnGwco0SxWAYzdKsxrreGcxFBuE8UNCO6olIWwU5aabiGQ0tp3B3gCUnZTYyDKVsRRdh0nPtn4A==","signatures":[{"sig":"MEQCIGTPI3LnaNViVnPAJBydWd4UTcqPqZUlb3N0DakRu2FvAiAa0Nxq6VjTpD+gaue784WOC0pBmnL8omRb0ujAzmVzOw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51988},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","exports":{"import":"./dist/index.js","require":"./dist/index.cjs"},"gitHead":"c2bd198a7470dcd0839558090497f607d85d4067","scripts":{"gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group top","test":"npm run build && node --test \"test/*.test.ts\"","build":"rm -rf dist && lezer-generator src/chef.grammar -o src/parser.js && cm-buildhelper src/chef.ts","corpus":"npm run build && node ../lezer-survey/src/cli.ts measure --group top","prepare":"npm run build","build-debug":"lezer-generator src/chef.grammar --names -o src/parser.js && cm-buildhelper src/chef.ts"},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"repository":{"url":"https://codeberg.org/reeven/codemirror-lang-chef","type":"git"},"_npmVersion":"11.6.2","description":"Chef language support for the CodeMirror code editor","directories":{},"sideEffects":false,"_nodeVersion":"25.0.0","dependencies":{"@lezer/lr":"^1.0.0","@lezer/common":"^1.0.0","@lezer/highlight":"^1.0.0","@codemirror/language":"^6.0.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.0","@lezer/generator":"^1.7.0","@codemirror/state":"^6.7.1","@codemirror/buildhelper":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/codemirror-lang-chef_0.2.0_1786044345046_0.8409742320658447","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@codincod/codemirror-lang-chef","version":"0.3.0","description":"Chef language support for the CodeMirror code editor","keywords":["chef","code","codemirror","editor","esolang"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","type":"module","main":"dist/index.cjs","exports":{"import":"./dist/index.js","require":"./dist/index.cjs"},"module":"dist/index.js","types":"dist/index.d.ts","sideEffects":false,"scripts":{"build":"rm -rf dist && lezer-generator src/chef.grammar -o src/parser.js && cm-buildhelper src/chef.ts","build-debug":"lezer-generator src/chef.grammar --names -o src/parser.js && cm-buildhelper src/chef.ts","prepare":"npm run build","test":"npm run build && node --test \"test/*.test.ts\"","measure":"npm run build && node ../lezer-survey/src/cli.ts measure --group top","fuzz":"npm run build && node ../lezer-survey/src/cli.ts fuzz","gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group top"},"dependencies":{"@codemirror/language":"^6.0.0","@lezer/highlight":"^1.0.0","@lezer/lr":"^1.0.0"},"devDependencies":{"@codemirror/buildhelper":"^1.0.2","@codemirror/state":"^6.7.1","@lezer/generator":"^1.7.0","typescript":"^5.6.0"},"homepage":"https://codincod.com/","repository":{"type":"git","url":"https://codeberg.org/reeven/codemirror-lang-chef"},"gitHead":"0e4a52ed18b64a457a92d26843f16caa74f4bfe7","_id":"@codincod/codemirror-lang-chef@0.3.0","_nodeVersion":"25.0.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-X1V5maqM8IpH9dMt0aNC5PV6k4qMGunNoCCXKFPwZG01dbSt5BAfmGD5VshTkmb+qX+78GEiwxoOjSAcFNFdiQ==","shasum":"19ac17ec12f5a48acf48eeaacb3cfe47fc28276d","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-chef/-/codemirror-lang-chef-0.3.0.tgz","fileCount":13,"unpackedSize":68667,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCa206INLkkSpokHAKwONKFtHyFejtNpzCR4J0av499LAIhANfNqoUJR7Udykf28r+i5uXsx9fLYH3mZBywHjzc+Xfu"}]},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"directories":{},"maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/codemirror-lang-chef_0.3.0_1786758508084_0.8889567415948714"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-06T19:01:15.614Z","modified":"2026-08-15T01:48:28.421Z","0.1.0":"2026-08-06T19:01:16.012Z","0.2.0":"2026-08-06T19:25:45.179Z","0.3.0":"2026-08-15T01:48:28.219Z"},"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","homepage":"https://codincod.com/","keywords":["chef","code","codemirror","editor","esolang"],"repository":{"type":"git","url":"https://codeberg.org/reeven/codemirror-lang-chef"},"description":"Chef language support for the CodeMirror code editor","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"readme":"# @codincod/codemirror-lang-chef\n\nThis package implements [Chef](https://esolangs.org/wiki/Chef) language support\nfor the [CodeMirror](https://codemirror.net/) code editor: a\n[Lezer](https://lezer.codemirror.net/) grammar, highlighting and folding.\n\nWritten in part for [CodinCod](https://codincod.com/), a competitive coding\nplatform, where it colours the editor people solve puzzles in.\n\nThis code is released under an\n[MIT license](https://codeberg.org/reeven/codemirror-lang-chef/src/branch/master/LICENSE).\n\n## Usage\n\n```javascript\nimport {EditorView, basicSetup} from \"codemirror\"\nimport {chef} from \"@codincod/codemirror-lang-chef\"\n\nconst view = new EditorView({\n  parent: document.body,\n  doc: `Hello World Souffle.\n\nThis recipe prints hello world.\n\nIngredients.\n72 g haricot beans\n101 eggs\n108 g lard\n\nMethod.\nPut lard into mixing bowl.\nPut haricot beans into mixing bowl.\nLiquefy contents of the mixing bowl.\nPour contents of the mixing bowl into the baking dish.\n\nServes 1.\n`,\n  extensions: [basicSetup, chef()]\n})\n```\n\n## What it reads\n\nChef is a joke with a compiler behind it: a program is a recipe, and it has to\nread as one. A title, a paragraph about the dish, a list of ingredients, and a\nmethod in ordinary imperative English. The ingredients are the variables and\nthe mixing bowls are the stack.\n\nThe shape is what makes it parseable. `Ingredients.` and `Method.` are lines\nthat say exactly that, so everything above the first of them is the title and\nthe prose under it.\n\nOn CodinCod's language-guessing pool, 11 snippets of Chef from Rosetta Code:\n\n| | Tagged | Colours | Busiest colour |\n| --- | --: | --: | --: |\n| this | 100.00% | 9 | 24.01% |\n| plain text, which is what it had | 0.00% | 0 | – |\n\nEvery character gets a colour. A bare word inside a sentence of the method is\nhow an ingredient is referred to again, so it is a name in both places and\ntakes a name's ink in both; a directive like `Cooking time: 45 minutes.` is\naddressed to the cook and to nobody else, so all of it but the opening word is\ngrey.\n\nUnlike the grid languages, this grammar can say no: a file that is not a\nrecipe has no `Ingredients.` in it and comes out as an error, which is what\nthe clean figure below is measuring.\n\nEleven files is too few to conclude anything from, so the recipes people have\nactually written were parsed too, ten of them from\n[joostrijneveld's interpreter](https://github.com/joostrijneveld/Chef-Interpreter).\nDoing that was worth it. Six of the ten failed on the first run, on two things\nneither the spec nor the pool shows:\n\n* Half of them write `Methods.` where the spec writes `Method.`, and every\n  interpreter takes both.\n* A sentence that talks about two of them says `mixing bowls`.\n\nWith those fixed, 20 of the 21 files across both sources parse clean, which\nputs the true rate above 79% with 95% confidence and no higher claim than\nthat. The one failure is the pool snippet that opens `This is pseudocode.` and\nthen writes `Methods.` three times inside a method body to demonstrate what a\nChef comment looks like. It is not a program and no interpreter would run it.\n\n## What took the work\n\nThree things the parser cannot work out for itself, all of them in\n`src/tokens.ts`.\n\n* **A comment is a comment because of where it sits.** Chef has no comment\n  marker at all. What is between the title and the word `Ingredients` is a\n  paragraph about the dish, and that is the whole of it. Colouring it grey is\n  most of what this grammar is for, and there is no character anywhere that\n  says so.\n* **A title looks exactly like the next sentence of the method above it.** An\n  auxiliary recipe is a whole recipe, title and all, written under the first\n  one, so a line that opens a recipe and a line that continues a method are the\n  same shape. What tells them apart is what comes after: a title is followed,\n  further down, by `Ingredients.`, and a sentence in the middle of a method\n  reaches the end of its recipe first. The tokenizer reads ahead to whichever\n  of `Ingredients.`, `Method.` and `Serves` turns up first and calls the line a\n  title only when the answer is the first of them.\n* **An ingredient's name is whatever is left of its line.** `0 g Vitamin A`\n  opens with a quantity and a measure, `2 cups flour` with a different measure,\n  and `input` with the name itself. No rule can say where a name starts,\n  because a name is any words at all. So the tokenizer declines three times and\n  consumes once: on a digit, so the quantity is read as a number; on a measure,\n  so the measure is read as one; and on a section header, so a list ends where\n  `Method.` begins.\n\n## What it does not claim\n\nThe loop. Chef opens one with any verb the author likes and closes it with any\nother, and the only fixed word in either is `until`:\n\n```\nLoop the input.\n…\nEndloop input until looped.\n```\n\n`Sift the flour.` and `Shake until sifted.` are the same pair with different\nwords in it. A grammar that guessed which sentences match would be wrong on a\nrecipe that writes two loops in a row, so a sentence keeps its verb and the\nverb keeps a colour of its own, and the pairing is left to the reader, who can\nsee the words. It is the one thing here that looks like structure and is not.\n\n## Development\n\n```bash\nnpm install\nnpm test            # the parse specs and the colours\n```\n","readmeFilename":"README.md"}