Skip to content

clitetailor/cursornext

Repository files navigation

cursor|next

A minimalist parsing library for Node.js

Why cursor|next?

While such frameworks like nearley, ohm and peg are powerful already and provide out-of-the-box features for generating and testing parser. These frameworks rely heavily upon LL and LR algorithms and grammars.

cursornext takes another approach, it provides the lowest lever interface to interact with the document and let you decide how to parse your own syntax. The downside is that you have to put more efforts building your own parser. Because you are not rely on any built-in algorithm and grammar, it may lacks of tools for checking and generating syntax tree. The upside is that building a parser tool is now more modular and customizable. The interface is also simple that it is much more friendlier to work with Chrome or Node debugger.

Install

cursornext is available to install via npm:

npm install --save cursornext

and Yarn:

yarn add cursornext

Create your first cursor

To create a new cursor, you can use Cursor.from() method:

const { Cursor } = require('cursornext')

const cursor = Cursor.from('Hello, World!')

Now you can move and test the cursor using next() and startsWith().

cursor.next(7)
cursor.startsWith('World')
// => true

Documentation

For more documentation, please checkout the docs directory:

License

MIT License

About

A minimalist library for parsing 🌵

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •