@jlguenego/language
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Language

Alphabet and Language utility in Javascript (and Typescript).

Library to be used as a base for parsers. Utilities about alphabets (set of characters), strings (also called word or sentence), languages (set of strings)

This library covers the concept exposed in the 1972 book from Aho & Ullman, The Theory of Parsing, Translation, and Compiling.

Install

npm i @jlguenego/language

This library exposes both:

  • ES2015 module that can be tree-shaked by Webpack for Angular etc.
  • CommonJS module for traditionnal node way.

It is ready to use for both browsers and node app.

Usage

const binaryAlphabet = new Alphabet(0, 1);
const romanAlphabet = new Alphabet(
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j,
  k,
  l,
  m,
  n,
  o,
  p,
  q,
  r,
  s,
  t,
  u,
  v,
  w,
  x,
  y,
  z
);

const word = new Word<typeof romanAlphabet>(['h', 'e', 'l', 'l', 'o']);
// etc.

API

See the typedoc documentation

Examples

See all examples in the test suite.

Participating

Do not hesitate to bring your contribution to this project. Fork and Pull Request are welcome.

Bibliography

License

ISC

Author

Jean-Louis GUENEGO jlguenego@gmail.com


Package Sidebar

Install

npm i @jlguenego/language

Weekly Downloads

0

Version

1.2.0

License

ISC

Unpacked Size

78.2 kB

Total Files

87

Last publish

Collaborators

  • jlguenego