Reputation: 81
I am looking for a grammar of Excel formulas in BNF or another notation. We need to parse the input formula with JavaScript to check its validity and the actual formula evaluation will then take place on the server side.
Upvotes: 6
Views: 4035
Reputation: 5245
Section 2.2.2 (page 32) of the [MS-XLSX]: Excel (.xlsx) Extensions to the Office Open XML SpreadsheetML File Format has a useful grammar describing Excel formulas. Other versions of the specification are also available.
Upvotes: 2
Reputation: 22905
MS-XLS has a free-form grammar (tries to be an EBNF but is far from formal)
More hints are available in MS-OE376 and section L.2.16 of ECMA-376.
But to answer your question, there is no official BNF
Upvotes: 5
Reputation: 89
Here's a site where the author parses Excel formulas in javascript. There are other versions of his parser available.
http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html
Upvotes: -1