Coder Social home page Coder Social logo

kylejlin / tyson Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 1.07 MB

A tool that generates a TypeScript file from your Jison grammar's semantic actions so you can typecheck those semantic actions

Home Page: https://www.npmjs.com/package/tyson

License: MIT License

JavaScript 21.18% TypeScript 78.82%

tyson's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.