0.0.5 • Published 11 months ago

instaparse v0.0.5

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

instaparsejs

What if context-free grammars were as easy to use as regular expressions?

instaparse compiled to JavaScript (ESM).

Not production ready. API can change.

Usage

npm add instaparse
import { parser } from "instaparse";

const grammar = `S = AB*
AB = A B
A = 'a'+
B = 'b'+`;
const text = `aaaaabbbaaaabb`;

console.log(parser(grammar)(text));

TODO

  • add tests
  • add benchmark
  • publish instaparsejs package as well?
  • single node with value case
  • how to show error if parsing failed?
  • expose insta/add-line-and-column-info-to-metadata
  • expose options for insta/parser

    Optional keyword arguments:
    :input-format :ebnf
    or
    :input-format :abnf
    
    :output-format :enlive
    or
    :output-format :hiccup
    
    :start :keyword (where :keyword is name of starting production rule)
    
    :string-ci true (treat all string literals as case insensitive)
    
    :allow-namespaced-nts true (allow namespaced non-terminals in parser specification;
                                parser's output will use corresponding namespaced keywords)
    
    :auto-whitespace (:standard or :comma)
    or
    :auto-whitespace custom-whitespace-parser
  • expose combinators (maybe)

  • expose insta/transform (maybe)
0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

12 months ago

0.0.2

12 months ago

0.0.1

12 months ago