An Esolang that can be interpreted or transpiled to JavaScript code.
If you can't understand the documentation, figure it out by reading the source code. 🧐
For a detailed language breakdown and explanation, refer to language-spec.md.
Typedocs can be viewed at GitHub Pages.
- Easy-to-use API
- Simple syntax (by Esolang standards)
- Interpretable or Transpilable to JavaScript
npm install lzscriptimport run from 'lzscript';
const code = `[[]][??!][]:![[]]>[[]][][][[]][?!][].>[??]([?][[]][]>)[??]<[?]([][[]]).>[?][[]][][]..>[??][[]].[??!]<.[???!]>[?]([[]][])[?!][[]].>[??]([?][[]][]>)[??]<[??][[]].>![[]][][][[]][].>[?][[]][][].>[][[]][][].[?????]<.`;
const result = run(code, "transpile");
console.log("Transpiled Code:", result.outputCode);
console.log("Execution Time:", result.executionTime, "ms");import run from 'lzscript';
const code = `[[]][??!][]:![[]]>[[]][][][[]][?!][].>[??]([?][[]][]>)[??]<[?]([][[]]).>[?][[]][][]..>[??][[]].[??!]<.[???!]>[?]([[]][])[?!][[]].>[??]([?][[]][]>)[??]<[??][[]].>![[]][][][[]][].>[?][[]][][].>[][[]][][].[?????]<.`;
const result = run(code, "interpreter");
console.log("Output:", result.output);
console.log("Internal Pointer Position:", result.internal.pointer);
console.log("Internal Bit Array:", result.internal.bits);run<T extends "transpile" | "interpreter">(code: string, mode: T, opts?: Partial<T extends "transpile" ? ITranspilerOptions : IInterpreterOptions>)
code: string: The Leziscript source code to be processed.mode: "transpile" | "interpreter":"transpile": Transpiles Leziscript to JavaScript code."interpreter": Directly interprets and runs the Leziscript code.
opts: Optional configuration for the transpiler or interpreter.
-
If
modeis"transpile":
{ outputCode: string; executionTime: number; } -
If
modeis"interpreter":
{ internal: { pointer: number; bits: Int32Array<buffer>; }; output: string; executionTime: number; }
The following Leziscript code prints "Hello World!":
[[]][&!][]:![[]]>[[]][][][[]][?!][].>[&]([?][[]][]>)[&]<[?]([][[]]).>[?][[]][][]..>[&][[]].[&!]<.[&?!]>[?]([[]][])[?!][[]].>[&]([?][[]][]>)[&]<[&][[]].>![[]][][][[]][].>[?][[]][][].>[][[]][][].[&&?]<.
Contributions are welcome! Feel free to open issues or submit pull requests.
This project is licensed under the MIT License. See the LICENSE file for details.