Monday, December 6, 2010



I wish in real life finding happiness was as easy as finding the second derivative of a polynomial.

Thursday, December 2, 2010

very strange dream: time is 2D

I've had a very strange dream yesterday night. That time goes on orthogonally to our own time. That is, you can think about a problem, forever, but in the next second you find the solution. No contradiction here, you felt that "forever" has passed in a second.

It was a pretty amusing dream. It reminded me when I woke up with "Oracles" in the theoretical computer science sense (where you can ask an oracle a query and get the answer the next second). Actually the explanation for this is that the time the oracle takes is in a second time dimension, that is orthogonal to ours. It can take forever in its dimension, but we only feel our own orthogonal time dimension.

This also makes sense that given for instance L^P, means that the original time dimension is logarithmic (allowed to have only logarithmic number of steps in the size of the input) while the "orthogonal" time for the oracle "P" is polynomial in the size of the input. So having an oracle is just extending 1 dimensional time to 2 dimensional time.

Having several oracles can also generalize this idea to n-dimensional time. For instance L^P^EXP, you'd have 3D time. The order of which oracle has access to which is implied by the exponentiation, but that is only an artificial restriction because if it was a real 3D time then L would have access to EXP as well. Talk about Inception ....

Man, I love my dreams :D

Friday, July 16, 2010

Thursday, July 15, 2010

Recursive-ascent parsers

Instead of representing your LR parsing tables as tables and user a driver to trace them over an input stream, you can simply implement each state as a function and use the machine stack as the push-down stack.

It turns out that this way is called "recursive-ascent" parsers. It is faster as the parsing is done without "interpretation" of the parsing table. It might also be clearer for the user that the plain parsing tables as the parsing actions/driving are encoded in the function.

Indeed it is more tedious to write such code from scratch, unlike recursive-descent parsers. That's why it is usually better to use a parser generator for that task.