Skip to content

cmcaine/nearley-ts-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple demo of how to use nearley with typescript.

git clone --depth=1 https://github.com/cmcaine/nearley-ts-demo.git
npm install
npm test

For your own project

Quickstart for your own project:

npm install Hardmath123/nearley typescript @types/nearley

tsc needs the es6 or higher lib and to use the @types dir:

// tsconfig.json
{
  "compilerOptions": {
    // Required for Map
    "lib": ["es6"],
    
    // Required for @types/nearley
    "typeRoots": ["node_modules/@types"],
  },
}

Your grammars need the @preprocessor typescript directive and you should import them like so:

import * as nearley from 'nearley'
import * as bracketexpr_grammar from './bracketexpr'

About

Nearley/Typescript demo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages