3

Accordingly, to the question Chomsky Hierarchy and P vs NP, Context-Sensitive Grammars are on Linear Space.

Assuming a Deterministic Parser is the one which can parse unambiguous grammars in something like linear time complexity, while a NonDeterministic Parser can parse any grammar in some worst time complexity like $O(n^5)$ or exponential.

  1. When something is on Linear Space, it takes Exponential time to be parsed by a Deterministic Parser? (probably space complexity has no relation to its time complexity, maybe something in $NSPACE(n)$ or $PSPACE(n^2)$ can affect time complexity?)
  2. Can any Context Sensitive Grammar be parsed in a Polynomial Complexity Time?
user
  • 245
  • 1
  • 3
  • 10

1 Answers1

4

To your first question, the answer is affirmative:

On one hand, a task that only takes polynomial time can only take polynomial space, and many among them only take linear space, so there definitely exist tasks which take linear space and polynomial time.

On the other hand, that doesn't mean every task that takes linear space takes only polynomial time. However, until now, nobody has been able to prove either way. Even for the hardest problems that take polynomial space, the PSPACE-complete problems, it is not known whether they can be done in polynomial time: we don't know whether PSPACE = P. If you can prove for a single PSPACE-complete problem that it can be done in polynomial time, or that it cannot, you will be famous in computing science forever. In practice, for such problems, we have no better than exponential algorithms.

To answer your second question: parsing context-sensitive grammars is PSPACE-complete, so it takes exponential time in practice; it takes only polynomial time for growing context-sensitive grammars.

reinierpost
  • 6,294
  • 1
  • 24
  • 40