{"_id":"@codincod/codemirror-lang-algol68","_rev":"5-596e2e299fd54ce4b45a12220ab55f77","name":"@codincod/codemirror-lang-algol68","dist-tags":{"latest":"0.5.0"},"versions":{"0.1.0":{"name":"@codincod/codemirror-lang-algol68","version":"0.1.0","keywords":["a68","a68g","algol","algol68","codemirror","editor"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","_id":"@codincod/codemirror-lang-algol68@0.1.0","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"homepage":"https://codincod.com/","dist":{"shasum":"f552f75aaf17e83b76ab91799e805c7727da540b","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-algol68/-/codemirror-lang-algol68-0.1.0.tgz","fileCount":12,"integrity":"sha512-wI+FDw8J98ypUcMVmsmOUmK8ydqvTWiNMXzk8jKk5bIfOR8DTp7j9rRGXWo+cSyKqiElBDvDYJ6wvcb/mKCBRg==","signatures":[{"sig":"MEUCIBqKgJ7QXniT+kF/kUHZcfNaQriB5t82FmPpdSyIoC+PAiEAjsDU2gQ9dLwEHP2Wamsj578zW11KWigdUV9mUQylMnU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":206494},"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":"fa6b4dc3d0e2cb37b645af172a4b90ddeffca71c","scripts":{"fuzz":"npm run build && node ../lezer-survey/src/cli.ts fuzz","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/algol68.grammar -o src/parser.js && cm-buildhelper src/algol68.ts","harvest":"node ../lezer-survey/src/cli.ts harvest ../algol68-corpus --ext a68,alg --history --jobs 16 --max-repo-kb 120000 --words \"BEGIN,MODE,PROC,ESAC,OUSE,ELIF,PRIO,FLEX,HEAP,STRUCT,UNION,SEMA,PRAGMAT,COMMENT,SKIP,EMPTY,BITS,BYTES,FORMAT,LWB,UPB,REPR,ANDF,OREL,DOWNTO,newline,print,read char,whole,ISNT\" --oracle \"a68g --norun {}\" --reject \"syntax error|unterminated|exceeds end of line|unworthy character\"","measure":"npm run build && node ../lezer-survey/src/cli.ts measure --group top","prepare":"npm run build","build-debug":"lezer-generator src/algol68.grammar --names -o src/parser.js && cm-buildhelper src/algol68.ts"},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"repository":{"url":"https://codeberg.org/reeven/codemirror-lang-algol68","type":"git"},"_npmVersion":"11.6.2","description":"ALGOL 68 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/state":"^6.7.1","@codemirror/language":"^6.0.0","@codemirror/autocomplete":"^6.0.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.0","@lezer/generator":"^1.7.0","@codemirror/buildhelper":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/codemirror-lang-algol68_0.1.0_1786631985578_0.362194561541594","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@codincod/codemirror-lang-algol68","version":"0.2.0","keywords":["a68","a68g","algol","algol68","codemirror","editor"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","_id":"@codincod/codemirror-lang-algol68@0.2.0","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"homepage":"https://codincod.com/","dist":{"shasum":"366256ce9d95126677bc0a4cc8a0f0424f57006f","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-algol68/-/codemirror-lang-algol68-0.2.0.tgz","fileCount":12,"integrity":"sha512-P6NMzEhb+3q7/qbWL7UoTsFAvImOHgJBo1IR76JM0zENRbdGaTZtrx44PoSi08rNGbSm79V1yT6jlnfSN2lDXA==","signatures":[{"sig":"MEUCIQD6Pk+Seh8NMLL7mBJedOHS4v0Hu6F9UBgKr+H1PWV3KQIgF36lQ5brbxp2+cWDxFXDw0Dw1WmrKQ43WdaQ6MbvOGA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":223803},"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":"5f4fac6301bc99eca6ea4b512ce42ec1deffe862","scripts":{"fuzz":"npm run build && node ../lezer-survey/src/cli.ts fuzz","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/algol68.grammar -o src/parser.js && cm-buildhelper src/algol68.ts","harvest":"node ../lezer-survey/src/cli.ts harvest ../algol68-corpus --ext a68,alg --history --jobs 16 --max-repo-kb 120000 --words \"BEGIN,MODE,PROC,ESAC,OUSE,ELIF,PRIO,FLEX,HEAP,STRUCT,UNION,SEMA,PRAGMAT,COMMENT,SKIP,EMPTY,BITS,BYTES,FORMAT,LWB,UPB,REPR,ANDF,OREL,DOWNTO,newline,print,read char,whole,ISNT\" --oracle \"a68g --norun {}\" --reject \"syntax error|unterminated|exceeds end of line|unworthy character\"","measure":"npm run build && node ../lezer-survey/src/cli.ts measure --group top","prepare":"npm run build","build-debug":"lezer-generator src/algol68.grammar --names -o src/parser.js && cm-buildhelper src/algol68.ts"},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"repository":{"url":"https://codeberg.org/reeven/codemirror-lang-algol68","type":"git"},"_npmVersion":"11.6.2","description":"ALGOL 68 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/state":"^6.7.1","@codemirror/language":"^6.0.0","@codemirror/autocomplete":"^6.0.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.0","@lezer/generator":"^1.7.0","@codemirror/buildhelper":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/codemirror-lang-algol68_0.2.0_1786758486957_0.1255282287528221","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@codincod/codemirror-lang-algol68","version":"0.3.0","keywords":["a68","a68g","algol","algol68","codemirror","editor"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","_id":"@codincod/codemirror-lang-algol68@0.3.0","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"homepage":"https://codincod.com/","dist":{"shasum":"fddf9f0d070c8f55e3b1c6e5a95e1cad7ad8a30d","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-algol68/-/codemirror-lang-algol68-0.3.0.tgz","fileCount":12,"integrity":"sha512-y6n2sgvygNpKNMHG4Nd2yGHEeIPxw4bJf2jLhCsA5xiE9Rksa1VL1zgjm0PkCrJI+8fUNOwfcN1kb5sgcPZ+Wg==","signatures":[{"sig":"MEUCIQDw3CrF4Mu/yRjbd/JEIlsjA9KtK6u4Bw/H50f2kcpgTwIgHxiAA7iogHEg4Qn8B6zoNvkZHZapH7P/lwHt70DIWN8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":238536},"main":"dist/index.cjs","type":"module","_from":"file:codincod-codemirror-lang-algol68-0.3.0.tgz","types":"dist/index.d.ts","module":"dist/index.js","exports":{"import":"./dist/index.js","require":"./dist/index.cjs"},"scripts":{"fuzz":"npm run build && node ../lezer-survey/src/cli.ts fuzz","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/algol68.grammar -o src/parser.js && cm-buildhelper src/algol68.ts","harvest":"node ../lezer-survey/src/cli.ts harvest ../algol68-corpus --ext a68,alg --history --jobs 16 --max-repo-kb 120000 --words \"BEGIN,MODE,PROC,ESAC,OUSE,ELIF,PRIO,FLEX,HEAP,STRUCT,UNION,SEMA,PRAGMAT,COMMENT,SKIP,EMPTY,BITS,BYTES,FORMAT,LWB,UPB,REPR,ANDF,OREL,DOWNTO,newline,print,read char,whole,ISNT\" --oracle \"a68g --norun {}\" --reject \"syntax error|unterminated|exceeds end of line|unworthy character\"","measure":"npm run build && node ../lezer-survey/src/cli.ts measure --group top","build-debug":"lezer-generator src/algol68.grammar --names -o src/parser.js && cm-buildhelper src/algol68.ts"},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"_resolved":"/tmp/aee6434a9cdbe0fa9840faa8678d6828/codincod-codemirror-lang-algol68-0.3.0.tgz","_integrity":"sha512-y6n2sgvygNpKNMHG4Nd2yGHEeIPxw4bJf2jLhCsA5xiE9Rksa1VL1zgjm0PkCrJI+8fUNOwfcN1kb5sgcPZ+Wg==","repository":{"url":"https://codeberg.org/reeven/codemirror-lang-algol68","type":"git"},"_npmVersion":"11.6.2","description":"ALGOL 68 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/state":"^6.7.1","@codemirror/language":"^6.0.0","@codemirror/autocomplete":"^6.0.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.0","@lezer/generator":"^1.7.0","@codemirror/buildhelper":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/codemirror-lang-algol68_0.3.0_1786831711399_0.9763303958188505","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@codincod/codemirror-lang-algol68","version":"0.4.0","keywords":["a68","a68g","algol","algol68","codemirror","editor"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","_id":"@codincod/codemirror-lang-algol68@0.4.0","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"homepage":"https://codincod.com/","dist":{"shasum":"72f1797197e3d2dd9ab2b4b44432e17dc6c31dfc","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-algol68/-/codemirror-lang-algol68-0.4.0.tgz","fileCount":12,"integrity":"sha512-LZ1m3LgdkukLk4sMkQY8tktcX20fZOLcMlTxWqrJU/eOjpm7td1nzaa0OAp9c7SHFhwOAjp6E6XgLVZw0KApnQ==","signatures":[{"sig":"MEQCHwG9i0InLFlTFNIPa3QpHPJJbgD/0n0d9bppn7VmxnkCIQDP9WZYbRxweFN5ZMnpj5bMxuh1z2VOz+1e00qayQAxwg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":259491},"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":"0553c3cacd4cb7ad3491bb78c26592630f3aa3a7","scripts":{"fuzz":"npm run build && node ../lezer-survey/src/cli.ts fuzz","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/algol68.grammar -o src/parser.js && cm-buildhelper src/algol68.ts","harvest":"node ../lezer-survey/src/cli.ts harvest ../algol68-corpus --ext a68,alg --history --jobs 16 --max-repo-kb 120000 --words \"BEGIN,MODE,PROC,ESAC,OUSE,ELIF,PRIO,FLEX,HEAP,STRUCT,UNION,SEMA,PRAGMAT,COMMENT,SKIP,EMPTY,BITS,BYTES,FORMAT,LWB,UPB,REPR,ANDF,OREL,DOWNTO,newline,print,read char,whole,ISNT\" --oracle \"a68g --norun {}\" --reject \"syntax error|unterminated|exceeds end of line|unworthy character\"","measure":"npm run build && node ../lezer-survey/src/cli.ts measure --group top","prepare":"npm run build","build-debug":"lezer-generator src/algol68.grammar --names -o src/parser.js && cm-buildhelper src/algol68.ts"},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"repository":{"url":"https://codeberg.org/reeven/codemirror-lang-algol68","type":"git"},"_npmVersion":"11.6.2","description":"ALGOL 68 language support for the CodeMirror code editor","directories":{},"sideEffects":false,"_nodeVersion":"22.20.0","dependencies":{"@lezer/lr":"^1.0.0","@lezer/common":"^1.0.0","@lezer/highlight":"^1.0.0","@codemirror/state":"^6.7.1","@codemirror/language":"^6.0.0","@codemirror/autocomplete":"^6.0.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.0","@lezer/generator":"^1.7.0","@codemirror/buildhelper":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/codemirror-lang-algol68_0.4.0_1787820632074_0.004109789836227451","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@codincod/codemirror-lang-algol68","version":"0.5.0","description":"ALGOL 68 language support for the CodeMirror code editor","keywords":["a68","a68g","algol","algol68","codemirror","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/algol68.grammar -o src/parser.js && cm-buildhelper src/algol68.ts","build-debug":"lezer-generator src/algol68.grammar --names -o src/parser.js && cm-buildhelper src/algol68.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","harvest":"node ../lezer-survey/src/cli.ts harvest ../algol68-corpus --ext a68,alg --history --jobs 16 --max-repo-kb 120000 --words \"BEGIN,MODE,PROC,ESAC,OUSE,ELIF,PRIO,FLEX,HEAP,STRUCT,UNION,SEMA,PRAGMAT,COMMENT,SKIP,EMPTY,BITS,BYTES,FORMAT,LWB,UPB,REPR,ANDF,OREL,DOWNTO,newline,print,read char,whole,ISNT\" --oracle \"a68g --norun {}\" --reject \"syntax error|unterminated|exceeds end of line|unworthy character\"","clean":"node ../lezer-survey/src/cli.ts clean ../algol68-corpus --oracle \"$PWD/tools/a68g-oracle.sh {}\" --reject \"a68g: shape error\" --jobs 8"},"dependencies":{"@codemirror/autocomplete":"^6.0.0","@codemirror/language":"^6.0.0","@codemirror/state":"^6.7.1","@lezer/common":"^1.0.0","@lezer/highlight":"^1.0.0","@lezer/lr":"^1.0.0"},"devDependencies":{"@codemirror/buildhelper":"^1.0.2","@lezer/generator":"^1.7.0","typescript":"^5.6.0"},"homepage":"https://codincod.com/","repository":{"type":"git","url":"https://codeberg.org/reeven/codemirror-lang-algol68"},"gitHead":"b3ff4dd4a83443a832e704c897ff4c06c015fd2f","_id":"@codincod/codemirror-lang-algol68@0.5.0","_nodeVersion":"22.20.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-Y6qdJBATjG9gXJSyTOnfOIRLTnabl/Hb36xNNFQDnDxvrRof4VfzuSRu2MXaZ4/o7mTKhTmoyOx34OsrXtUR5A==","shasum":"b22b1a1388fa912b4b03480c98935972c70fb91e","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-algol68/-/codemirror-lang-algol68-0.5.0.tgz","fileCount":12,"unpackedSize":260492,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCLi8bU+ZAIn3L9NG6nnXmGxFSCaVybI4+sO8uftgObnAIhALi3W1tdUNM6DtBx9voGNkdXZVv0djQG3xCrEGDuhWKk"}]},"_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-algol68_0.5.0_1787823802725_0.691468336605306"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-13T14:39:45.492Z","modified":"2026-08-27T09:43:23.085Z","0.1.0":"2026-08-13T14:39:45.734Z","0.2.0":"2026-08-15T01:48:07.114Z","0.3.0":"2026-08-15T22:08:31.547Z","0.4.0":"2026-08-27T08:50:32.218Z","0.5.0":"2026-08-27T09:43:22.861Z"},"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","homepage":"https://codincod.com/","keywords":["a68","a68g","algol","algol68","codemirror","editor"],"repository":{"type":"git","url":"https://codeberg.org/reeven/codemirror-lang-algol68"},"description":"ALGOL 68 language support for the CodeMirror code editor","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"readme":"# @codincod/codemirror-lang-algol68\n\nThis package implements ALGOL 68 language 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 had a grammar for ALGOL 68 before this one. Not CodeMirror, which has\nnever shipped one and has no stream mode to fall back on either; not\ntree-sitter; not Linguist, which does not know the language exists. What was\nthere was a Visual Studio Code extension whose TextMate grammar colours\nseventeen words and reads `#` to the next `#`.\n\nWritten for [CodinCod](https://codincod.com/), a competitive coding platform,\nwhere it colours the editor people solve puzzles in.\n\nThis code is released under an\n[MIT license](https://codeberg.org/reeven/codemirror-lang-algol68/src/branch/master/LICENSE).\n\n## Usage\n\n```javascript\nimport {EditorView, basicSetup} from \"codemirror\"\nimport {algol68} from \"@codincod/codemirror-lang-algol68\"\n\nconst view = new EditorView({\n  parent: document.body,\n  doc: `BEGIN\n   INT max number = 2200;\n   [1 : max number]BOOL solution;\n   FOR n TO max number DO solution[n] := FALSE OD;\n   FOR d TO max number DO\n      IF NOT solution[d] THEN print((\" \", whole(d, 0))) FI\n   OD;\n   print(newline)\nEND\n`,\n  extensions: [basicSetup, algol68()]\n})\n```\n\n## Coverage\n\n| Corpus | Files | Clean |\n| --- | --- | --- |\n| Every ALGOL 68 program on Rosetta Code, as Genie accepts it | 929 | 99.57% |\n| Every ALGOL 68 file on GitHub, as Genie accepts it | 3670 | 95.18% |\n| The corpus as it stands, capped and sifted again | 3913 | 97.65% |\n\n`npm run clean` is the last sieve. `tools/a68g-oracle.sh` puts every file to\n`a68g --check`, which parses and stops before the interpreter starts, and moves\nout what Genie calls a syntax error: 286 of 4199, and the figure from 96.07%.\nA mode error is not a syntax error and those files stay, since what a mode\nmeans depends on what was declared above it and a highlighter has one file.\n\nGenie reads the language of the Revised Report. Algol 68RS is a second dialect,\nthe one the Royal Signals compiler and ELLA are written in, and nobody packages\na compiler that knows it, so a file naming `PROGRAM`, `DECS`, `KEEP`, `USE`,\n`ALIEN` or `FINISH` is kept whatever Genie makes of it. Genie turns down 596 of\nthese files and 305 of them are that dialect; sifting on Genie alone would have\nthrown away the half of this grammar that was written for it.\n\nThe second corpus is what `npm run harvest` builds: 1099 repositories, every\nversion of every `.a68` and `.alg` file in them, 26000 of them once duplicates\nare gone. Most of that is not this language. `.a68` is also Motorola 68000\nassembly, `.alg` is also Portugol, a Brazilian teaching language, and one\nlaboratory used `.a68` for DNA alignments. What is left after Genie and a test\nfor the language's own bold words is 3670 files, which is close to all the\nALGOL 68 there is: a second search with thirty-four more words found 154 more\nrepositories and six more programs.\n\nThe language of the Revised Report, as\n[Algol 68 Genie](https://en.wikipedia.org/wiki/ALGOL_68#Implementations) 3.5\naccepts it: its bold words, its comments and pragmats, its format texts, its\n`CODE ... EDOC` blocks, and the extensions Genie adds, which are `DOWNTO`,\n`UNTIL`, `ANDF` and `ORF` with their several spellings, and `{ }` for\n`BEGIN END`.\n\nAlgol 68RS as well, which is the other half of the corpus and most of the\nALGOL 68 written for a living: ELLA, the ALGOL 68 to C compiler and what was\nbuilt on them. A program there is written in named parts, `PROGRAM` and `DECS`\nwith `USE`, `KEEP` and `FINISH`; a routine may be left to C with `ALIEN`; a row\nputs its mode in front of its bounds, `VECTOR [0] CHAR`; and the braces are\nspent on comments rather than on `BEGIN` and `END`. A file says which language\nit is in with its first word, and the parser carries that answer down, so the\nsame brace is a comment in one file and a clause in the next.\n\nUpper stropping is what a program is read in, since it is what Genie takes by\ndefault and what almost every program written since is in. A bold word written\nbetween quotes, `'BEGIN'`, is read as the same word, so a file in quote\nstropping is read too. Point stropping, `.BEGIN`, is not, beyond the pragmat a\nfile switches regimes in.\n\n## What a tokenizer has to settle\n\nMost of ALGOL 68 can be written down as a grammar. Six things cannot.\n\n**A bold word means what the program declared it to mean.** `MODE VEC` makes\n`VEC` a mode indicant and `OP MAX` makes `MAX` an operator, and both stand in\nthe same places: `VEC v` declares a variable and `MAX v` applies an operator to\none. A parser with no symbol table cannot tell them apart, so four things decide\nit, in order. A word the parser could read only one way is read that way. A word\nwith a colon after it is the result mode of a routine text, since nothing an\noperator applies itself to begins with one, and a word with nothing after it but\nan end is a mode standing on its own. A word the standard prelude declares an\noperator by is an operator, which is what keeps `ABS x` and `UPB a` from reading\nas a mode and a name. What is left is a mode if a phrase could begin there and a\nname follows with nothing after it but a value, and an operator otherwise.\n\nEvery one of those looks at what comes next, and what comes next is often a\ncomment: `PROC (LINEOPTION #options#) VOID` names a mode and closes the list,\nand the four lines of prose in between are nothing to do with it. So the\nlookahead reads over comments the way it reads over blanks, `# #` and\n`CO ... CO` alike.\n\n**A comma separates two different things.** `INT a, b` declares two variables\nand `(INT a, INT b)` declares one apiece, and the comma is the same character in\nboth. What follows it decides, one token further than an LR parser can look, so\nthe tokenizer looks: a name with nothing after it but a value or an end\ncontinues a declaration, and anything else begins a phrase.\n\n**A comment ends at a bold word, not at a string.** `CO ... COMMENT ... CO` is\none comment, because the `CO` inside `COMMENT` is not a word of its own. The\ntokenizer reads whole bold words while it looks for the terminator, which is\nwhat Genie does, and the same code reads `PR ... PR`, `PRAGMAT ... PRAGMAT` and\n`CODE ... EDOC`.\n\n**A format text is a language of its own.** Between two `$` the letters are\ntransput items rather than names, and the strings hold whatever they like. It is\nread as one token and coloured as one thing.\n\n**`~` is two things.** It is the prelude's negation, and it is another way of\nwriting `SKIP`. Whether anything follows it to negate decides which.\n\n**A brace is a clause or a comment, by what language the file is in.** Genie\nreads `{ }` for `BEGIN END`; Algol 68RS reads it for a comment, and nests them.\nNothing in the brace itself says which, so the parser carries the answer from\nthe file's first word: a file that opens `PROGRAM` or `DECS` is a part of an\nAlgol 68RS program and everything after it is read that way.\n\n## What the tree does not say\n\n**A formula is flat.** `a + b * c` has no shape until the priorities are known,\nand a program declares its own with `PRIO`, so no grammar can give one. The tree\nis a list of operands and operators, which is what Genie's own parser builds\nbefore a later pass sorts the priorities out.\n\n**A mode indicant standing where an operator could stand is a mode.** At the\nhead of a phrase, `FOO x` reads as a declaration. If `FOO` was declared an\noperator by the program, the tree names the parts wrongly, though it still\nparses. The heuristic above is what makes that the rare case rather than the\ncommon one.\n\n**A cast written with a mode the program declared is an operator applied to a\nclause.** `VEC (x)` and `MYOP (x)` cannot be told apart, and the second is the\nreading that keeps the first parsing.\n\n## Building and measuring\n\n```\nnpm install\nnpm run build     # generate the parser and build the package\nnpm test          # the parse tests in test/\nnpm run measure   # the clean-file share over a corpus of your own\nnpm run harvest   # build that corpus out of what people have written\n```\n\n`npm run harvest` needs [lezer-survey](https://codeberg.org/reeven/lezer-survey)\nbeside this package and `a68g` on the path. It finds the repositories that hold\nALGOL 68, takes every version of every `.a68` and `.alg` file out of them, and\nhands each one to Genie, which is the only authority on whether a file is ALGOL\n68 at all.\n","readmeFilename":"README.md"}