

A virtual machine in Excel - ColinWright
http://hackaday.com/2014/12/25/writing-a-virtual-machine-in-excel/

======
userbinator
There's a well-known technique for solving certain types of equations by
making use of circular references, and people have simulated digital logic too
(e.g.
[http://mypage.uniserve.ca/~jeffsch/writing/SimPage.html](http://mypage.uniserve.ca/~jeffsch/writing/SimPage.html)
and
[http://makeyourownchip.tripod.com/flipflop_simulator.html](http://makeyourownchip.tripod.com/flipflop_simulator.html)
), but this is something even more ambitious. I wonder if this virtual machine
could be driven by using a circular reference as an "oscillator" (
[http://en.wikipedia.org/wiki/Ring_oscillator](http://en.wikipedia.org/wiki/Ring_oscillator)
) to increment a counter, and use that to fetch and execute instructions...
the amount of actual functionality needed to implement a rudimentary CPU is
surprisingly small.

The actual system a spreadsheet would best simulate is known as a "systolic
array":
[http://en.wikipedia.org/wiki/Systolic_array](http://en.wikipedia.org/wiki/Systolic_array)

I don't know if it's something to do with culture but for some reason I see
far more of this "lateral thinking" and clever creative solutions coming out
of Europe and in particular East Europe and Russia than North America - look
at the demoscene, for example.

~~~
edem
I also live in Hungary and there is a saying "a Hungarian can enter the
turnstile after you and leave before you" which is quite true. Everyday life
here involves a lot of hacking/tinkering mostly because of the repercussions
of bad decisions of our (not only past) leaders.

~~~
sz4kerto
I think the correct quote is "If a Hungarian passes through a revolving door
right after you he will come out before you". Many fellow Hungarians keep
bringing this up because they think that it's a positive thing expressing how
clever Hungarians are while in reality this is not exactly intended to flatter
anyone. :)

~~~
edem
Thanks for the correction. I don't think that it is either positive or
negative but it is true in general. In some cases it is useful but sometimes
it annoys others.

------
sz4kerto
It is quite fascinating that the localized Excel function names do not have
some kind of internal reference/ID so a spreadsheet's language could simply be
set by the user.

~~~
Someone
I think the problem with that is that Excel has a few 'almost like eval'
functions. For example, SumIf takes a string like "> sin(2)". You would have
to translate those strings at runtime, and may have to guess at the source
language (that string might be input by the user)

Even if that isn't the case, the engine cannot know whether any macro will
change formulas. There, you hit the really troublesome area. VBA has a full
eval ([http://msdn.microsoft.com/en-
us/library/office/ff193019%28v=...](http://msdn.microsoft.com/en-
us/library/office/ff193019%28v=office.15%29.aspx)). Even ignoring that, things
can get hairy because Excel localizes numbers (is that comma a decimal point
or a thousands separator?) and list separators (does one use commas or
semicolons as argument separators?)

I expect there are some edge cases here that makes this problem unsolvable in
practice. Some people will have code that checks whether the string
representation of a cell's value contains a comma to check whether it is >=
1000 (or <= -1000.00, but relatively, that is a 'minor' bug)

