by Gladdyu · 7y ago · 0 comments
http://blog.reverberate.org/2013/08/parsing-c-is-literally-u...
So, for anyone else feeling similarly unsatisfied, here's another example that might be more satisfying in that respect:
y = f(g<T, U>(x));
In conjunction with the fact that templates are already Turing-complete, we can see that detecting whether this is a call to a templated g or two comparisons is a Turing-complete question.Also notice a similar parsing issue arises in C# as well, but I don't think generics there can be used to perform Turing-complete computation... though not sure.
But you can very easily get the AST. Obviously it may happen that you have to wait until the hell is frozen to get a result, but generally it doesn’t happen in code that you see day to day..