2007-05-29 09:19

Stupid Sheet: Redoing cell displacements

For my spreadsheet project, I had to redo something I had forgotten about: cell displacement. I did that once when the formula language was python.

At the time, I parsed the python using the tokenize module and Ka-Ping Yee's regurgitate.

Python->Tokens->Displace cells->regurgitate->Python

Since I have lots of other things to do, I decided to do it the same way, and wrote the equivalent of regurgitate for Traxter, my formula language.

It turns out it was not really hard, but I had to redo parts of the parser so it kept more information about the source.

After that it was simple, you see, Traxter compiles to Python. That means all I had to do was another (very similar) backend, and there it is, a Traxter-to-Traxter compiler. Or decompiler. Or something. And relative cell references are working again (and now with the right syntax).


Comments powered by Disqus

Contents © 2000-2018 Roberto Alsina