I found some excellent web pages for anyone (like me) interested in parsing formulae in Excel cells, preferably with Backus-Naur form.
Apart from playing with Rob Van Gelder's tokeniser ("Wheeeee!"), I've not yet worked my way through the material.
Formula Tokeniser
Excel Grammar
Excel Formula parsing
Where am I going with this? An enhanced version of STAIN.
Backus–Naur Form (BNF) of Excel formulae
-
- PlutoniumLounger
- Posts: 15645
- Joined: 24 Jan 2010, 23:23
- Location: brings.slot.perky
Backus–Naur Form (BNF) of Excel formulae
He who plants a seed, plants life.
-
- Administrator
- Posts: 78594
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Backus–Naur Form (BNF) of Excel formulae
Have you tried applying Edsger Dijkstra's shunting-yard algorithm to Excel formulas?
(See Shunting-yard algorithm on Wikipedia)
(See Shunting-yard algorithm on Wikipedia)
Best wishes,
Hans
Hans
-
- PlutoniumLounger
- Posts: 15645
- Joined: 24 Jan 2010, 23:23
- Location: brings.slot.perky
Re: Backus–Naur Form (BNF) of Excel formulae
Yup. Years ago when I was engaged in the compiler/interpreter writing business. We got to the point where we could be handed a language description in BN form (e.g. A language to support a new application for the Offset printer crowd) at 9am, and had a working compiler, compiled to run on an ICL1903A, ready to ship out the door at 5pm.HansV wrote:Have you tried applying Edsger Dijkstra's shunting-yard algorithm to Excel formulas?
It was a chain of state-tables, transition matrices etc. The first version ran on what was basically a punched-card implementation of APL - which we had written. Given the speed of those days machines, and the unpredictable job queue, it was in all a minor miracle.
I took a closer look at one of the links above. Rob Van Gelder's tokeniser. If I've read it correctly it's a super-fast way to play around converting cell references to range names and vice-versa.
He who plants a seed, plants life.
-
- Microsoft MVP
- Posts: 656
- Joined: 24 Jan 2010, 17:51
- Status: Microsoft MVP
- Location: Weert, The Netherlands
Re: Backus–Naur Form (BNF) of Excel formulae
My reftreeanalyser (free demo version) tries to parse cell formulas too:
http://www.jkp-ads.com/reftreeanalyser.asp
http://www.jkp-ads.com/reftreeanalyser.asp
-
- PlutoniumLounger
- Posts: 15645
- Joined: 24 Jan 2010, 23:23
- Location: brings.slot.perky
Re: Backus–Naur Form (BNF) of Excel formulae
Hi Jan Karel.Jan Karel Pieterse wrote:My reftreeanalyser (free demo version)
I have broken your analyzer.
I got the same result (image below) with two separate workbooks.
Please let me know here, or via PM or email, how I can best help you to resolve the issue.
I am (on this machine) WinXP-SP3 Office 2000.
Code: Select all
05/18/2010 10:38:50 AM RefTreeAnalyserDemo Error 13: Type mismatch in modMenu.CreateMenu
05/18/2010 10:44:30 AM RefTreeAnalyserDemo Error 13: Type mismatch in modMenu.CreateMenu
05/18/2010 10:46:28 AM RefTreeAnalyserDemo Error 13: Type mismatch in modMenu.CreateMenu
05/18/2010 10:46:30 AM RefTreeAnalyserDemo Error 13: Type mismatch in modMenu.CreateMenu
05/18/2010 10:46:31 AM RefTreeAnalyserDemo Error 13: Type mismatch in modMenu.CreateMenu
You do not have the required permissions to view the files attached to this post.
He who plants a seed, plants life.
-
- Microsoft MVP
- Posts: 656
- Joined: 24 Jan 2010, 17:51
- Status: Microsoft MVP
- Location: Weert, The Netherlands
Re: Backus–Naur Form (BNF) of Excel formulae
Hi Chris
I have had users report this error before. Never could find out what causes it.
Could you go into the registry and find this key:
HKEY_CURRENT_USER\Software\VB and VBA Program Settings\XLRefTreeAnalyser\Settings
Please tell me what it lists for the toolbar values.
I have had users report this error before. Never could find out what causes it.
Could you go into the registry and find this key:
HKEY_CURRENT_USER\Software\VB and VBA Program Settings\XLRefTreeAnalyser\Settings
Please tell me what it lists for the toolbar values.
-
- PlutoniumLounger
- Posts: 15645
- Joined: 24 Jan 2010, 23:23
- Location: brings.slot.perky
Re: Backus–Naur Form (BNF) of Excel formulae
Jan Karel: It doesn't!Jan Karel Pieterse wrote:Please tell me what it lists for the toolbar values.
As far as I can see, it doesn't get as far as the registry settings.
Screen Snapshots
"Under" and "Stain" are my two utilities.
Stain is an Execl application; Under is a Word application.
P.S. PM follows ....
He who plants a seed, plants life.
-
- Microsoft MVP
- Posts: 656
- Joined: 24 Jan 2010, 17:51
- Status: Microsoft MVP
- Location: Weert, The Netherlands
Re: Backus–Naur Form (BNF) of Excel formulae
Hi Chris,
I fixed the issue, I've updated the downloads on my website.
I fixed the issue, I've updated the downloads on my website.
-
- PlutoniumLounger
- Posts: 15645
- Joined: 24 Jan 2010, 23:23
- Location: brings.slot.perky
Re: Backus–Naur Form (BNF) of Excel formulae
Very good! Might we learn, in a general way, the nature of the bug? I mean in the sense of "I forgot to .." or similar that might have an impact on others of us distributing applications for a variety of office versions. I'm not asking for any proprietary code or secrets here. Just that you mentioned that this had been a (nagging?) problem with other installations.Jan Karel Pieterse wrote:I fixed the issue,
You do not have the required permissions to view the files attached to this post.
He who plants a seed, plants life.
-
- Microsoft MVP
- Posts: 656
- Joined: 24 Jan 2010, 17:51
- Status: Microsoft MVP
- Location: Weert, The Netherlands
Re: Backus–Naur Form (BNF) of Excel formulae
The tool comes with an addin that handles the shortcut keys. In the original version, the COM addin loaded the Excel addin, now I install the excel addin and the com addin does not open the excel addin anymore.
-
- PlutoniumLounger
- Posts: 15645
- Joined: 24 Jan 2010, 23:23
- Location: brings.slot.perky
Re: Backus–Naur Form (BNF) of Excel formulae
Thanks Jan Karel, for the explanation.Jan Karel Pieterse wrote:... and the com addin does not open the excel addin anymore.
Since I'm not creating COM addins, it's not something I need worry about.
Yet.
He who plants a seed, plants life.