On the complexity of regular-grammars with integer attributes

作者:

Highlights:

摘要

Regular grammars with attributes overcome some limitations of classical regular grammars, sensibly enhancing their expressiveness. However, the addition of attributes increases the complexity of this formalism leading to intractability in the general case. In this paper, we consider regular grammars with attributes ranging over integers, providing an in-depth complexity analysis. We identify relevant fragments of tractable attribute grammars, where complexity and expressiveness are well balanced. In particular, we study the complexity of the classical problem of deciding whether a string belongs to the language generated by any attribute grammar from a given class C (call it PARSE[C]). We consider deterministic and ambiguous regular grammars, attributes specified by arithmetic expressions over {||,+,−,÷,%,⁎}, and a possible restriction on the attributes composition (that we call strict composition). Deterministic regular grammars with attributes computed by arithmetic expressions over {||,+,−,÷,%} are P-complete. If the way to compose expressions is strict, they can be parsed in L, and they remain tractable even if multiplication is allowed. Problem PARSE[C] becomes NP-complete for general regular grammars over {||,+,−,÷,%,⁎} with strict composition and for grammars over {||,+,−,÷,%} with unrestricted attribute composition. Finally, we show that even in the most general case the problem is in polynomial space.

论文关键词:Attribute grammars,Computational complexity,Models of computation

论文评审过程:Received 21 August 2009, Revised 17 May 2010, Available online 27 May 2010.

论文官网地址:https://doi.org/10.1016/j.jcss.2010.05.006