{"_id":"@codincod/codemirror-lang-easylang","name":"@codincod/codemirror-lang-easylang","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@codincod/codemirror-lang-easylang","version":"0.1.0","description":"Easylang language support for the CodeMirror code editor","keywords":["codemirror","code","easylang","editor"],"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/easylang.grammar -o src/parser.js && cm-buildhelper src/easylang.ts","build-debug":"lezer-generator src/easylang.grammar --names -o src/parser.js && cm-buildhelper src/easylang.ts","corpus":"npm run build && node ../lezer-survey/src/cli.ts measure --group parent","gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group parent","prepare":"npm run build","test":"npm run build && node --test \"test/*.test.ts\""},"dependencies":{"@codemirror/autocomplete":"^6.0.0","@codemirror/language":"^6.0.0","@lezer/common":"^1.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-easylang"},"gitHead":"d9068e2e8faaeafae7d5c020484feec5c10bec6a","_id":"@codincod/codemirror-lang-easylang@0.1.0","_nodeVersion":"25.0.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-cC2ZE2xVpYobvyZteOle9xljUt6S15pquiCK8L9xZotRHCn38JlJgCHHfxD0Lrb+gWbKrk1OhDDRYqcEaCHl4Q==","shasum":"afcf3072482a136da0e40ee2c47f77eb015dfce3","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-easylang/-/codemirror-lang-easylang-0.1.0.tgz","fileCount":14,"unpackedSize":104722,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBJT2pe+c405mTV6WDzZcj1NL+dQ4+GHOc3djGzZWTTKAiEAl5utghjUgkk84FLIX+wuf4Z3XYZmKvUM3J5dhbLxcfk="}]},"_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-easylang_0.1.0_1786054051409_0.254622813644225"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-06T22:07:31.237Z","0.1.0":"2026-08-06T22:07:31.676Z","modified":"2026-08-06T22:07:31.929Z"},"maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"description":"Easylang language support for the CodeMirror code editor","homepage":"https://codincod.com/","keywords":["codemirror","code","easylang","editor"],"repository":{"type":"git","url":"https://codeberg.org/reeven/codemirror-lang-easylang"},"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","readme":"# @codincod/codemirror-lang-easylang [![NPM version](https://img.shields.io/npm/v/@codincod/codemirror-lang-easylang.svg)](https://www.npmjs.org/package/@codincod/codemirror-lang-easylang)\n\n[ [**CHANGELOG**](https://codeberg.org/reeven/codemirror-lang-easylang/src/branch/master/CHANGELOG.md) ]\n\nThis package implements [Easylang](https://easylang.online/) support for the\n[CodeMirror](https://codemirror.net/) code editor, using a\n[Lezer](https://lezer.codemirror.net/) grammar written for this package.\n\nNothing existed to fork. CodeMirror never shipped Easylang in either version,\nand no Lezer grammar for it had been written, so this one starts at the\ntokenizer.\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-easylang/src/branch/master/LICENSE).\n\n## Usage\n\n```javascript\nimport {EditorView, basicSetup} from \"codemirror\"\nimport {easylang} from \"@codincod/codemirror-lang-easylang\"\n\nconst view = new EditorView({\n  parent: document.body,\n  doc: `print \"Hello World!\"`,\n  extensions: [basicSetup, easylang()]\n})\n```\n\n## Coverage\n\nThe whole language: blocks closed by a dot or by `end`, the one-statement block\nthat a colon opens, every shape of `for` header, procedures and functions with\ntheir return type spelled onto the keyword, reference parameters, forward\ndeclarations, `subr`, `on`, `global`, `prefix`, and the built-in library.\n\nMeasured against 875 Easylang programs, 99.77% parse with no error node. The\ncorpus is the Rosetta Code tasks written in Easylang together with the examples\nthat come with the language. The two failures are typos in the source: a\ntrailing comma in one program and a stray non-ASCII character at the end of\nanother.\n\n## What a parser has to guess about Easylang\n\nA call carries no parentheses and no commas. `gcd 120 35` calls `gcd` with two\narguments and `main` calls `main` with none, and nothing in the text says how\nmany arguments a name takes. No grammar can be right about that, because the\nanswer lives in a declaration that may not have been written yet.\n\nSo juxtaposition is the loosest thing on a line here. `print a & b` is one\nargument, the whole concatenation, which is what a reader expects. `return a +\n1` is a sum rather than a call on `+1`, which is also what a reader expects, and\nthose two want opposite rules. The parser gets both by writing every operator\ntwice: once with an operand on the right and once with a call on the right.\n\n**A space decides what `-` is.** `f -1` passes a negative number and `a - b`\nsubtracts, and the corpus keeps that convention without exception in several\nthousand places. The parser reads the space rather than guessing from context,\nbecause context cannot tell it.\n\n**A space decides what `[` is.** Against a name it subscripts, `a[i]`. Standing\napart it opens an array, `sound [ 440 0.2 ]`. The same question settles `$`,\nwhich is a type mark where it trails a name and the last index of an array where\nit stands alone, so `s$` and `a[$]` are different things.\n\n**`input_data` ends the program.** Everything after it is the input the program\nreads, so the parser stops parsing and hands the rest of the file over as one\ntoken.\n\n## What it gives an editor\n\nSyntax highlighting, folding for every block and for array literals,\nindentation that knows a body is indented until its dot arrives, and completion\nfor the keywords and the built-in library.\n\n`easylangLanguage` is exported for use with `LanguageSupport`, and `parser` for\nuse on its own.\n\n## Testing it on your own code\n\n```\nnpm run corpus -- path/to/your/easylang\n```\n\nIt prints the files that failed, the first line of each that did, and the\nproportion that came out clean. The corpus itself is not included; Rosetta Code\nis CC BY-SA and cannot be redistributed under this licence.\n","readmeFilename":"README.md","_rev":"1-d49700d598d9acf0295000767f1693fe"}