Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/herberthe/unist-formula-ast
Excel formula ast to implement unist specification
https://github.com/herberthe/unist-formula-ast
Last synced: about 2 months ago
JSON representation
Excel formula ast to implement unist specification
- Host: GitHub
- URL: https://github.com/herberthe/unist-formula-ast
- Owner: HerbertHe
- License: mit
- Created: 2024-05-16T16:55:09.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-06-07T09:42:00.000Z (7 months ago)
- Last Synced: 2024-06-08T03:33:38.050Z (7 months ago)
- Language: TypeScript
- Homepage:
- Size: 88.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# unist-formula-ast
[![version](https://img.shields.io/npm/v/unist-formula-ast.svg)](https://www.npmjs.com/package/unist-formula-ast)
[![download](https://img.shields.io/npm/dm/unist-formula-ast.svg)](https://www.npmjs.com/package/unist-formula-ast)Excel formula ast to implement unist specification.
****
unist-formula-ast is a specification for representing Excel Formula in a [syntax tree][unist].
If you want to know how to use *unist-formula-ast* directly, read [Getting Started](./getting-started.md)!
## Introduction
This document defines a format for [abstract syntax tree][unist]. Development of unist-formula-ast started in May 2024. This specification is written in a ~~[Web IDL][web-idl]-like~~ TypeScript grammar.
### Where this specification fits
## Types
If you are using TypeScript, you can use the unist types by installing them with npm:
```sh
npm install unist-formula-ast
```## Nodes(abstract)
### `BasicNode`
```typescript
interface IBasicNode {
type: BasicNodeType | BasicCalculationNodeType
value?: string | number
position: IBasicNodePosition
children?: IBasicNode[]
}
```## Nodes
### `BasicCalculationNode`
```typescript
type BasicCalculationNodeType =
| "Addition"
| "Subtraction"
| "Multiplication"
| "Division"interface IBasicCalculationNode extends IBasicNode {
type: BasicCalculationNodeType
children: IBasicNode[]
}
```### `NumberNode`
```typescript
interface INumberNode extends IBasicNode {
type: "Number"
value: number
}
```### `VariableNode`
```typescript
interface IVariableNode extends IBasicNode {
type: "Variable"
value: string
}
```### `FuntionCallNode`
```typescript
interface IFuntionCallNode extends IBasicNode {
type: "Function"
value: string
children: FuntionCallArgumentType[]
}
```Want to know more definitions for *unist-formula-ast*, see [src/types.ts](./src/types.ts)
## References
- [Peggy](https://github.com/peggyjs/peggy): The parser of unist-formula-ast is generated by this project.
- [unist](https://github.com/syntax-tree/unist): The specification of unist-formula-ast is based on this project.## LICENSE
MIT © Herbert He
[unist]: https://github.com/syntax-tree/unist#syntax-tree
[web-idl]: https://heycam.github.io/webidl/