November 8, 2011
by Asher Glick
A while back a wrote a c++ program that allowed me to type in a string and it would return an int with the correct mathematical value for the value of the equation inside the string. I ported that code over into javascript in order to get our math functions. The functions can be found in eparse.js inside the scrips folder in the spreadsheet. As of now you can type any arithmetic function into a cell and it will calculate it. Currently there is no support for variables nor the ability to access other cells. However you can add a number to a string, and strings to strings, and numbers to numbers. I think it’s quite nifty. What I will be working on next is fixing bugs currently in the code, adding the ability to access data from other cells, and the ability to call arbitrary functions from libraries. I think that the ability to access data from other cells will be the hardest because it will have to also make sure that there are no circles of cells that reference each other (which can be solved using graph theory). Furthermore there is a design feature that needs to come into question, should there be a second array of ‘values’ for the cells with equations, if not then whenever an equation access another cell with an equation, both will have to be calculated to obtain the final value.
As a side project I have also been messing with the UI to create a Menu and an Equations bar that syncs to the input box.
– Asher