psalaets / excel-formula-ast Goto Github PK
View Code? Open in Web Editor NEWAbstract syntax tree for excel formulas
License: Other
Abstract syntax tree for excel formulas
License: Other
If you pass a malformed formula to the library, it will be stuck in a loop.
For example:
const tokens=tokenize('SUM(')
const rootNode = buildTree(tokens)
I am not sure if this belongs to the tokenizer or the excel-formula-ast. If you are in german excel, you need to use ";" as separator for function arguments. "," is used for numbers.
=WENN(WAHR;1,1;1,2)
I'd love to see typescript support for this library.
In german excel, you have 'WAHR' and 'FALSCH' instead of 'TRUE' and 'FALSE'. The library will output a logicalNode only if the name is 'TRUE' or 'FALSE'. 'WAHR' and 'FALSCH' will be handled as 'cell'-Node. I am not sure if this is a lower-level (tokenizer) or ast problem.
It is easy to work around, but I think this could be handled better, e.g. a list of names for logical true, and a list of strings for logical false. I don't have any idea what this looks like in spanish, for example.
the nodes do not have a corresponding token attached, therefore it is difficult to see where an error is in the original formula. I'd like to have linting for excel formulas (codemirror), but for it to work it needs line/column marks to where something is wrong (e.g., unknown cell range or unknown formula)
Hey guys,
You are doing an awesome work to generate AST representation of excel formulas. It is a hardwork and I would like to thank you guys for it.
I just wanted to ask what is current status of the project? Is it still in active development phase, or it has reached to alpha/beta/stable phase? How much excel formulae it has supported until now? I guess https://github.com/psalaets/excel-formula-tokenizer is also closely related to this project and will be almost on the same stage.
Best regards
> tokenize('=1+3*2')
[
{ value: '1+3', type: 'operand', subtype: 'number' },
{ value: '*', type: 'operator-infix', subtype: 'math' },
{ value: '2', type: 'operand', subtype: 'number' }
]
> tokenize('= 1+3*2')
[
{ value: '1', type: 'operand', subtype: 'number' },
{ value: '+', type: 'operator-infix', subtype: 'math' },
{ value: '3', type: 'operand', subtype: 'number' },
{ value: '*', type: 'operator-infix', subtype: 'math' },
{ value: '2', type: 'operand', subtype: 'number' }
]
> buildTree(tokenize('=1+3*2'))
{
type: 'binary-expression',
operator: '*',
left: { type: 'number', value: NaN },
right: { type: 'number', value: 2 }
}
Hi Alex,
I've been evaluating a number of excel formula parsers (including writing my own) for a project I'm working on, when I discovered your parser.
The design of the AST builder is elegant and I'm wondering if you're open to contributions to the excel-formula-ast and excel-formula-tokenizer? Also, is github's issues the best way to reach you?
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.