Skip to main content
Log in

Using Linear Positional Grammars for the LR Parsing of 2-D Symbolic Languages

  • Published:
Grammars

Abstract

In this paper we present a grammar formalism for the generation and parsing of two-dimensional symbolic languages. Linear Positional Grammars (or LPGs for short) are an immediate generalization of the context-free string grammars. Through the use of general spatial relations they allow the definition of pictures whose symbols span on a two-dimensional space. Due to their analogy to context-free string grammars, LPGs can be used to construct an LR-based parser which uses the spatial relations to navigate the input. We study ambiguous grammars and present several ways to solve them. Moreover we provide an algorithm to translate a linear positional grammar into a context-free grammar with actions and suggest a general methodology to parse two-dimensional symbolic languages by making use of the well-known tool YACC (Yet Another Compiler-Compiler [25]). As an example, we construct a parser for a subset of the two-dimensional arithmetical expression language.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Similar content being viewed by others

References

  • Aho, A.V., R. Sethi and J. D. Ullman. Compilers, Principles, Techniques, and Tools, AddisonWesley, Reading, MA, 1985.

    Google Scholar 

  • Barrow, H.G. and J.R. Popplestone. Relational descriptions in picture processing, Machine Intelligence, 6: 377–396, 1971.

    Google Scholar 

  • Chang, N.S. and K.S. Fu. Parallel parsing of tree languages for syntactic pattern recognition, Pattern Recognition, 11(3): 213–222, 1979.

    Article  Google Scholar 

  • Chang, S.-K. A method for the structural analysis of two dimensional mathematical expressions, Information Sciences, 2: 253–272, 1970.

    Article  Google Scholar 

  • Chang, S.-K. Picture processing grammar and its applications, Information Sciences, 3: 121–148,1971.

    Article  Google Scholar 

  • Chang, S.-K., G. Costagliola, G. Pacini, G. Tortora, M. Tucci, B. Yu and J.S. Yu, A Visual-Language System for User Interfaces, IEEE Software, 12(2): 33–44, 1995.

    Article  Google Scholar 

  • Chang, S.-K., E. Jungert, and Y. Li, The design of pictorial databases based upon the theory of symbolic projections Proc. 1989 Conf. Very Large Spatial Database, Springer-Verlag, 1989.

  • Chang, S.-K., E. Jungert, and Y. Li, Representation and retrieval of symbolic pictures using generalized 2D strings, SPIE Proc. Visual Communications and Image Processing, Philadelphia, PA, November 5–10, 1989.

  • Chang, S.-K., Q.Y. Shi, and C.W. Yan, Iconic Indexing by 2-D strings, IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. PAMI-6, no. 4, 475–484, 1984.

    Google Scholar 

  • Chang, S.-K., M.J. Tauber, B. Yu, and J.S. Yu, A visual language compiler, IEEE Trans. Software Engrg., 15(5): 506–525, 1989.

    Article  Google Scholar 

  • Chok, S.S. and K. Marriot, Parsing visual languages, Proc. 18th Australian Computer Science Conf., Australian Computer Science Comm., 17(1), 90–98, 1995.

    Google Scholar 

  • Clowes, M.B. Pictorial relationships-A syntactic approach, Machine Intelligence, vol. 4, Amer. Elsevier, New York, 1969.

    Google Scholar 

  • Costagliola, G., A. De Lucia, S. Orefice, and G. Tortora, A parsing methodology for the implementation of visual systems, IEEE Transaction on Software Engineering, 23(12), 1997.

  • Costagliola, G., M. Tomita and S.K. Chang, A generalized parser for 2-D languages, Proc. of 1991 IEEE Workshop on Visual Languages, International Convention Center Kobe, Japan, October 9-11, 98-104.

  • Costagliola, G., S.K. Chang, M. Tomita, Parsing 2D languages by a pictorial generalized LR parser, in T. Catarci, M.F. Costabile, S. Levialdi, Editors, Advanced Visual Interfaces, World Scientific Series in Computer Science, Vol. 36, 319-333, 1992.

  • Crimi, C., A. Guercio, G. Pacini, G. Tortora, and M. Tucci, Automating visual language generation, IEEE Transactions on Software Engineering, 16(10): 1122–1135, 1990.

    Article  Google Scholar 

  • Earley, J. An efficient context-free parsing algorithm, Communications of the ACM, 13: 94–102,1970.

    Article  Google Scholar 

  • Feder, J. Plex languages, Information Sciences, 3: 225–241, 1971.

    Article  Google Scholar 

  • Ferrucci, F., G. Pacini, G. Satta, M. Sessa, G. Tortora, M. Tucci, G. Vitiello, Symbol-relationgrammars: A formalism for graphical languages, Information and Computation, 131: 1–46, 1996.

    Article  Google Scholar 

  • Flasinski, M. Characteristics of edNLC-graph grammar for syntactic pattern recognition, Computer Vision Graphics and Image Processing, 47: 1–21, 1989.

    Article  Google Scholar 

  • Fu, K.S. Syntactic Methods in Pattern Recognition, Academic Press, New York and London, 1974.

    Google Scholar 

  • Fu, K.S. Syntactic Pattern Recognition and Applications, Prentice Hall, Inc. Englewood Cliffs, N.J.,1982.

    Google Scholar 

  • Fu K.S. and B.K. Bhargava, Tree systems for syntactic pattern recognition, IEEE Transactions on Computing, C-22(12): 1089–1099, 1973.

    Google Scholar 

  • Golin, E.J. Parsing visual languages with picture layout grammars, Journal of Visual Languages and Computing, Academic Press, London, 2: 1–23, 1991.

    Google Scholar 

  • Johnson, S.C. YACC: Yet Another Compiler-Compiler, tech. rep., Bell Laboratories, 1974.

  • Li, C.Y., T. Kawashima, T. Yamamoto, and Y. Aoki. Attribute expansive graph grammar for pattern description and its problem-reduction based processing, Trans. IEICE, E-71(4): 431–440, Japan,1988.

    Google Scholar 

  • Lu, S.Y. and K.S. Fu. Error-correcting tree automata for syntactic pattern recognition, IEEE Transasctions on Computing, C-27: 1040–1053, 1978.

    Google Scholar 

  • Marriott K. and B. Meyer. Editors, The Theory of Visual Languages, Springer Verlag, to be published in 1998.

  • Milgram, D.L. and A. Rosenfeld. Array automata and array grammars, Information Processing, 71:69–74, North-Holland Publ., Amsterdam, 1972.

    Google Scholar 

  • Narasimhan, R. Syntax-directed interpretation of classes of pictures, Communications of ACM, 9:166–173, 1966.

    Article  Google Scholar 

  • Peng, K. J., T. Yamamoto, and Y. Aoki. A new parsing scheme for plex grammars, Pattern Recognition, 23(3/4): 393–402, 1990.

    Article  Google Scholar 

  • Pfaltz, J. L. Web grammars and picture description, Computer Graphics and Image Processing, 1:193–220, 1972.

    Google Scholar 

  • Pfaltz J. L. and A. Rosenfeld.Web grammars, Proceedings of the First International Joint Conference on Artificial Intelligence, 609–619, Washington, DC, May 1969.

  • Rekers, J. and A. Schurr. A graph based framework for the implementation of visual environments. In Proceedings of the 1996 IEEE Symposium on Visual Languages, Boulder, Colorado, 148-157,1996.

    Google Scholar 

  • Rosenfeld, A. Picture Languages: Formal Models for Picture Recognition, Academic Press, New York, San Francisco and London, 1979.

    Google Scholar 

  • Rosenfeld A. and D. L. Milgram.Web Automata and Web Grammars, Machine Intelligence, 7: 307–324, 1972.

    Google Scholar 

  • Rounds, W.C. Context free grammars on trees, Proceedings of 10th Symposium on Switching and Automata Theory, 143, 1969.

  • Shaw, A.C. A formal picture description scheme as a basic for picture processing systems, Information and Control, 14: 9–52, 1969.

    Article  Google Scholar 

  • Shi, Q.Y. and K.S. Fu, Efficient and error-correcting parsing of (attributed and stochastic) tree grammars, Information Sciences, 26 159–188, 1982.

    Article  Google Scholar 

  • Shi, Q.Y. and K.S. Fu, Parsing and translation of attributed expansive graph languages for scene analysis, IEEE Transactions on Pattern Analysis and Machine Intelligence, PAMI-5: 472–485,1983.

    Article  Google Scholar 

  • Siromoney, G., R. Siromoney, and K. Krithivasan, Abstract families of matrices and picture languages, Computer Graphics and Image Processing, vol. 1, pp. 284-307, 1972.

    Google Scholar 

  • Siromoney, G., R. Siromoney, and K. Krithivasan, Array grammars and kolam, Computer Graphics and Image Processing, 3: 63–82, 1974.

    Google Scholar 

  • Tomita, M. Efficient Parsing for Natural Languages, Kluwer Academic Publishers, Boston, MA,1985.

    Google Scholar 

  • Tomita, M. Parsing 2-dimensional languages, Proceedings of the International Workshop on Parsing Technologies, 414–424, Pittsburgh, PA. Carnegie Mellon, 1989.

    Google Scholar 

  • Tucci, M., G. Vitiello and G. Costagliola, Parsing non-linear languages, IEEE Transactions on Software Engineering, 20(9): 1994.

  • Wang, P.S.P. Recognition of two-dimensional patterns, Proc. Assoc. Comput. Mach. Nat. Conf., 484–489, 1977.

  • Wittenburg, K. Earley-style parsing for relational grammars, Proceedings of the 1992 IEEE Workshop on Visual Languages, IEEE Comp. Soc. Press, 192–199, 1992.

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

About this article

Cite this article

Costagliola, G., Chang, SK. Using Linear Positional Grammars for the LR Parsing of 2-D Symbolic Languages. Grammars 2, 1–34 (1999). https://doi.org/10.1023/A:1006926614934

Download citation

  • Issue Date:

  • DOI: https://doi.org/10.1023/A:1006926614934

Navigation