Improving the graph grammar parser of Rekers and Sch¨ urr Luka F¨ urst 1 , Marjan Mernik 2 , Viljan Mahniˇ c 1 1 University of Ljubljana, Faculty of Computer and Information Science, Trˇ zaˇ ska cesta 25, SI-1000 Ljubljana, Slovenia E-mail: {luka.fuerst, viljan.mahnic}@fri.uni-lj.si 2 University of Maribor, Faculty of Electrical Engineering and Computer Science, Smetanova ulica 17, SI-2000 Maribor, Slovenia E-mail: marjan.mernik@uni-mb.si Abstract Graph grammars and graph grammar parsers are to visual languages what string grammars and parsers are to textual languages. A graph grammar spec- ifies a set of valid graphs and can thus be used to formalise the syntax of a visual language. A graph grammar parser is a tool for recognising valid pro- grams in such a formally defined visual language. A parser for context-sensitive graph grammars, which have proved to be suitable for formalising real-world visual languages, was developed by Rekers and Sch¨ urr. We propose three im- provements of this parser. One of them enlarges the class of parsable graph grammars, while the other two increase the parser’s computational efficiency. Experimental results show that for some (meaningful) graph grammars, our im- provements can enhance the parser’s performance by orders of magnitude. The proposed improvements will hopefully increase both the parser’s applicability and the interest in visual language parsing in general. 1 Introduction Graph grammars consist of rules (called productions ) for matching and replacing subgraphs in an arbitrary host graph and can thus be regarded as a generalisation of ‘ordinary’ (i.e., string) grammars. Analogously to string grammars, each graph grammar defines its language as a set of all graphs that can be generated by its productions. Graph grammars have thus been used for specifying the syntax of visual languages [1, 2, 3], but they have also been applied to software systems modelling [4], pattern recognition [5, 6], mathematical formula recognition [7], generation of metamodel instances [8], and to many other domains [9, 10]. While context-free string grammars are employed far more frequently than context-sensitive ones in the domain of textual languages, visual languages can often be more naturally described by context-sensitive graph grammars than by context-free ones [1]. The formalisation of a textual or visual language by means of a grammar is not an end in itself. A grammar is the basis for the automated recognition of valid sentences of the language (i.e., valid strings in the case of a textual language and 1