Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bwrrp/whynot.js
Generic VM-based formal language matching framework
https://github.com/bwrrp/whynot.js
Last synced: about 1 month ago
JSON representation
Generic VM-based formal language matching framework
- Host: GitHub
- URL: https://github.com/bwrrp/whynot.js
- Owner: bwrrp
- License: mit
- Created: 2014-03-20T10:06:01.000Z (almost 11 years ago)
- Default Branch: main
- Last Pushed: 2022-06-23T08:14:15.000Z (over 2 years ago)
- Last Synced: 2024-11-23T05:08:03.196Z (about 1 month ago)
- Language: TypeScript
- Homepage:
- Size: 185 KB
- Stars: 5
- Watchers: 4
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# whynot.js
[![NPM version](https://badge.fury.io/js/whynot.svg)](https://badge.fury.io/js/whynot)
[![CI](https://github.com/bwrrp/whynot.js/workflows/CI/badge.svg)](https://github.com/bwrrp/whynot.js/actions?query=workflow%3ACI)Generic VM-based formal language matching framework, inspired by [http://swtch.com/~rsc/regexp/](http://swtch.com/~rsc/regexp/)
This library implements a VM able to execute programs aimed at matching
formal languages. It does so by considering all possible branches in
parallel. This could be used to efficiently implement many types of language
matching, including regular expressions and XML schemas. Furthermore, the
program could be set up to record its progress through both the input and the
language's grammar. This enables giving feedback on _why_ a given input does
not match the grammar rules in some way.For an example showing how this library can be used, see
[Examples.tests.ts](https://github.com/bwrrp/whynot.js/blob/main/test/Examples.tests.ts)
in the test suite.## Benchmarking
A simple benchmark is included in the `performance` directory. This script runs a simple program
including repetition and records on an input of 1000000 items. These can be run using
[fonto-benchmark-runner commands](https://www.npmjs.com/package/@fontoxml/fonto-benchmark-runner)
which will run the benchmarks in the console. You can see the benchmark results in
the console output.