1.2.3 • Published 3 years ago
zatlin v1.2.3
Overview
Zatlin is a domain-specific language to generate words of a constructed langauge. This package serves a TypeScript implementation of Zatlin.
Installation
Install via npm.
npm i zatlinUsage
Call Zatlin.load with a source string to create a Zatlin object, and then call generate to generate a string.
const {Zatlin} = require("zatlin");
let zatlin = Zatlin.load(`% "a" | "b" | "c";`);
let output = zatlin.generate();
console.log(output);If an identifier name is passed to generate method, the processor generates a string from the specified identifier.
const {Zatlin} = require("zatlin");
let zatlin = Zatlin.load(`
foo = "a" | "b" ; bar = "x" | "y";
% "p" | "q" ;
`);
let output = zatlin.generate("bar");
console.log(output); // outputs “x” or “y”Documentations
Syntax
Error messages
Note on versioning
First note that the version of this package and that of Zatlin implemented in it are different.
Zatlin 1.0 is the first version of Zatlin, and implemented in the desktop version of ZpDIC. There is also a self-contained Java implementation here.
Zatlin 1.1 and 1.2 are enhanced versions whose syntax is more powerful, and implemented in this package.