open-index/open-npm huggingface dataset:
npm package: @math-blocks/core
Description: A collection of utility functions and types used in most of the other packages.
Latest version: 0.0.12

# @math-blocks/core

A collection of utility functions and types used in most of the other packages.

## Exports

- `getId`: function that returns unique, ascending, integer identifiers
- `UnreachableCaseError`: used for exhaustiveness checks in `switch` statements.
npm package: @math-blocks/editor
Description: A set of framework independent tools that can be used to construct an input component for entering/editing math expressions.
Latest version: 0.0.13

# @math-blocks/editor

A set of framework independent tools that can be used to construct an input
component for entering/editing math expressions.

## Editor.Parser

A class used for parsing editor ASTs into semantic ASTs.

## Editor.reducer

A reducer containing a the logic necessary to make edits to a math expression
stored as an editor AST an update a cursor appropriately.

## Editor.State

A type describing the internal state of the reducer.
npm package: @math-blocks/parser
Description: `parserFactory` can be used to generate TDOP/Pratt parsers.  The reason for using this style of parsing is that it's much easier to change the precedence and add new operators that it would be other parser types.
Latest version: 0.0.13

# @math-blocks/parser

`parserFactory` can be used to generate TDOP/Pratt parsers.  The reason for using
this style of parsing is that it's much easier to change the precedence and add
new operators that it would be other parser types.

```typescript
function parserFactory<T extends {readonly type: string}, N, O>(
    getPrefixParselet: (token: T) => PrefixParselet<T, N, O>,
    getInfixParselet: (token: T) => InfixParselet<T, N, O> | null,
    getOpPrecedence: (arg0: O) => number,
    EOL: T,
): {parse: (arg0: Array<T>) => N}
```

The three generic properties are:
- `T`: token object type produced by a lexer
- `N`: node object type that the parser will produce
- `O`: operator type (usually an enum of union of strings)

`getPrefixParselet` and `getInfixParselet` are functions that return the parselet
that should be used for the given `token`.  Parselets are objects that contain
a `parse` method and possible additional data.  Infix parselets also keep track
of the current operator.

In the future, support for post-fix operators such as `!` and `'` will be added.

## Examples

- @math-blocks/editor-parser/src/editor-parser.ts
- @math-blocks/testing/src/text-parser.ts
npm package: @math-blocks/solver
Description: Is able to solve basic equations and simplify basic expressions using steps that are similar to what a human would do.  This can then be used by intelligent tutors to provide suggestions to users when they don't know what step to take next or provide a co
Latest version: 0.0.13

# @math-blocks/solver

Is able to solve basic equations and simplify basic expressions using steps that
are similar to what a human would do.  This can then be used by intelligent tutors
to provide suggestions to users when they don't know what step to take next or
provide a complete worked solution.

## API
```typescript
const solve = (node: types.Eq, ident: types.Ident) => Step | undefined;
```

Solves an equation for the given identifier.  If the identifier doesn't exist
in `node` or if `solve` doesn't know how to solve the given equation the function
will return `undefined`.

```typescript
const simplify = (node: types.Node) => Step | undefined;
```

Simplifies an expression.  It will return `undefined` if the expression is already
simplified.

```typescript
type Step = {
    message: string;
    before: types.Node;
    after: types.Node;
    substeps: Step[];
};
```

`Step` is a common type that's used throughout this package to communicate what
each step is doing.  `before` is the node that is being changed within a step and
may be a descendent of the `node` passed to `solve` or `simplify`.  `after` is 
the node that `before` has been replaced with.  Use `applyStep` to compute the
new node after applying the step to `node`.

```typescript
const applyStep = (node: types.Node, step: Step): types.Node;
```

Applies a single step to a given node.  If step couldn't be applied, the original
`node` is returned.

## Notes

Each function that performs steps to simplify an expression or solve an equation
should have the following properties:
- applying all substeps to the `before` should result in a node that is the same
  as `after`
- applying each substep to an expression or equation should result in an equivalent
  expression or equation
  - equivalent expressions have the same value no matter the value of the variables
  - equivalent equations should have all of the same solutions

## TODO
- create a helper to check that two expressions are equivalent
- create a helper to check that two equations are equivalent
- update `solve` to handle linear inequalities
- add tests to check that the general equation of a line can be rewritten in
  standard for by solving for `y`
npm package: @math-blocks/typesetter
Description: This package provides functions for generating renderer-agnostic scene graphs from `Editor.Node`s.  The scene graphs can be rendered using components from @math-blocks/react.  They include the cursor or selection highlight when present.
Latest version: 0.0.13

# @math-blocks/typesetter

This package provides functions for generating renderer-agnostic scene graphs
from `Editor.Node`s.  The scene graphs can be rendered using components from
@math-blocks/react.  They include the cursor or selection highlight when present.

## Functions

- `typeset`: returns a scene graph for single-line math.
- `typesetWithWork`: returns a scene graph for multi-line math.

## TODO
- Switch to a different font, maybe [STIX](https://www.stixfonts.org/)
- Limits, summations, integrals
- Units of measure
- Trigonmetric functions

## References

- [MATH - The mathematical typesetting table](https://docs.microsoft.com/en-us/typography/opentype/spec/math)
- [Appendix G illuminiated](https://www.tug.org/TUGboat/tb27-1/tb86jackowski.pdf)
- [OpenType Math Illuminated](https://www.tug.org/~vieth/papers/bachotex2009/ot-math-paper.pdf)
- [OpenType font features guide](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts/OpenType_fonts_guide)