0.1.12 • Published 9 months ago

napg v0.1.12

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

NAPG - Not Another Parser Generator!

NAPG is a library for making recursive-descent parsers in TypeScript, with TypeScript. Its design goals are as follows:

  1. All output should be as typesafe as reasonably possible.
  2. No information should be lost in the output syntax tree.
  3. A user of this library can output whatever data structure they want.
  4. Parsers can have complete control over errors.
  5. Parsers should have support for memoization to eliminate the performance penalty of backtracking.
  6. Parsers should be able to function incrementally--- i.e. a change to a file shouldn't require that the entire file is re-parsed.

Due to the constraints above, NAPG is more suited toward writing compilers and tooling for programming languages, as opposed to, say, writing something to parse 10GB of JSON, or other massive amounts of data. Feature-completeness, developer experience, and expressivity are valued above performance for this project.

Okay, but how do I use it?

Here is a complete example use case for a four-function calculator.

For a more complex example, here is the parser for the Regex-like language that NAPG uses for tokens.

0.1.10

9 months ago

0.1.11

9 months ago

0.1.12

9 months ago

0.1.2

9 months ago

0.1.1

9 months ago

0.1.8

9 months ago

0.1.7

9 months ago

0.1.9

9 months ago

0.1.4

9 months ago

0.1.3

9 months ago

0.1.6

9 months ago

0.1.5

9 months ago

0.1.0

10 months ago