There's a version-compatibility issue between lark and lark-js.
lark-js 0.1.4 is the newest available release, but it only works reliably with lark 1.0.0. Newer lark versions serialize parser options like strict and ordered_sets, while the JS runtime embedded by lark-js doesn’t understand them and throws:
Unknown options: strict,ordered_sets
- and with even newer
lark, also cache_grammar
Why this happens
The standalone parser generator writes a serialized options object into generated parser.js.
With newer lark, that options object includes fields such as:
strict
ordered_sets
cache_grammar
But the JS-side LarkOptions implementation bundled by lark-js 0.1.4 does not accept those fields, so loading the generated parser fails before parsing even starts.
So the short version is:
- Python side got newer
- JS side stayed older
- generated parser became self-incompatible
There's a version-compatibility issue between
larkandlark-js.lark-js 0.1.4is the newest available release, but it only works reliably withlark 1.0.0. Newerlarkversions serialize parser options likestrictandordered_sets, while the JS runtime embedded bylark-jsdoesn’t understand them and throws:Unknown options: strict,ordered_setslark, alsocache_grammarWhy this happens
The standalone parser generator writes a serialized options object into generated parser.js.
With newer
lark, that options object includes fields such as:strictordered_setscache_grammarBut the JS-side
LarkOptionsimplementation bundled bylark-js 0.1.4does not accept those fields, so loading the generated parser fails before parsing even starts.So the short version is: