Question

I was studying Syntax Directed Definition from the "Compilers: Principles, Techniques and Tools by Aho, Ullman, Sethi and Lam" when I came across the following line in context of circular dependencies of attributes in parse tree:

It is computationally difficult to determine whether or not there exist any circularities in any of the parse trees that a given SDD could have to translate. (section: 5.1.2)

Also in http://cs.nyu.edu/courses/fall12/CSCI-GA.2130-001/lecture8.pdf it is mentioned that

Detecting cycles has exponential time complexity

But there is Tarjan's strongly connected components algorithm that can find cycles in O(E+V). So why are the above sources contradicting this?

Can anyone tell me what I am missing?

Was it helpful?

Solution

It's O(E+V) to find a cycle in some parse tree. But that's not the problem. The problem is to

determine whether or not there exist any circularities in any of the parse trees that a given SDD could have to translate. (Emphasis added).

That's a rather more difficult problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top