tyson
TypeScript icon, indicating that this package has built-in type declarations

1.7.0 • Public • Published

Tyson

Build Status Coverage Status npm version Downloads

A tool that generates a TypeScript file from your Jison grammar's semantic actions so the TypeScript compiler will check those semantic actions for errors.

Motivation

TypeScript does not examine .jison files, so any errors in your semantic action code will not be caught by the compiler. Tyson generates a TypeScript file containing your semantic action code, so TypeScript can check your semantic actions for errors.

Usage

Tyson provides both a CLI and a Node API.

CLI

npx tyson -- ./grammar.jison ./src/typedict.ts --out ./src/generated/semanticActions.generated.ts

For more information, please refer to the CLI docs.

Node API

npm install --save tyson
import { generateTypeScriptFile } from "tyson";

generateTypeScriptFile({
    pathToBnfGrammarFile: /* ... */,
    pathToTypeDictFile: /* ... */,
    pathToOutputFile: /* ... */,
});

For more information, please refer to the Node API docs.

Docs

All documentation is located in the docs directory.

We recommend that you start by reading the General docs. After that, if you want additional information about the CLI or Node API, you can refer to the CLI docs or Node API docs, respectively.

License

MIT

Copyright (c) 2020 Kyle Lin

Contributing

Please refer to docs/CONTRIBUTING.md.

Package Sidebar

Install

npm i tyson

Weekly Downloads

6

Version

1.7.0

License

MIT

Unpacked Size

30.3 kB

Total Files

11

Last publish

Collaborators

  • kylejlin