Fencing the Lamb: A Chart Parser for ModelCC

  • Luis Quesada
  • Fernando Berzal
  • Francisco J. Cortijo
Part of the Communications in Computer and Information Science book series (CCIS, volume 411)


Traditional grammar-driven language specification techniques constrain language designers to specific kinds of grammars. In contrast, model-based language specification techniques decouple language design from language processing. They allow the occurrence of ambiguities and the declarative specification of constraints for solving them. As a result, these techniques require general parser generators, which should be able to parse context-free grammars, handle ambiguities, and enforce constraints to disambiguate them as desired by the language designer. In this paper, we describe Fence, a bottom-up chart parser with lexical and syntactic ambiguity support. Fence accepts lexical analysis graphs outputted by the Lamb (Lexical AMBiguity) lexer and efficiently resolves ambiguities by means of the declarative specification of constraints. Both Lamb and Fence are part of the ModelCC model-based parser generator.


Chart Parser Context-free Grammars Ambiguities Constraints 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Aho, A.V., Lam, M.S., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools, 2nd edn. Addison Wesley (2006)Google Scholar
  2. 2.
    Aho, A.V., Ullman, J.D.: The Theory of Parsing, Translation, and Compiling, Volume I: Parsing & Volume II: Compiling. Prentice Hall, Englewood Cliffs (1972)Google Scholar
  3. 3.
    Chomsky, N.: Three models for the description of language. IRE Transactions on Information Theory 2, 113–123 (1956)CrossRefzbMATHGoogle Scholar
  4. 4.
    Crescenzi, V., Mecca, G.: Automatic information extraction from large websites. Journal of the ACM 51, 731–779 (2004)CrossRefzbMATHMathSciNetGoogle Scholar
  5. 5.
    DeRemer, F.L.: Practical translators for LR(k) languages. Technical report, Cambridge, MA, USA (1969)Google Scholar
  6. 6.
    DeRemer, F.L.: Simple LR(k) grammars. Communications of the ACM 14(7), 453–460 (1971)CrossRefzbMATHMathSciNetGoogle Scholar
  7. 7.
    DeRemer, F.L., Pennello, T.: Efficient computation of LALR(1) look-ahead sets. ACM Transactions on Programming Languages and Systems 4(4), 615–649 (1982)CrossRefzbMATHGoogle Scholar
  8. 8.
    Earley, J.: An efficient context-free parsing algorithm. Communications of the ACM 26, 57–61 (1983)CrossRefGoogle Scholar
  9. 9.
    Fowler, M.: Domain-Specific Languages. Addison-Wesley (2010)Google Scholar
  10. 10.
    Hudak, P.: Building domain-specific embedded languages. ACM Computing Surveys 28(4es), art. 196 (1996)Google Scholar
  11. 11.
    Jurafsky, D., Martin, J.H.: Speech and Language Processing: An Introduction to Natural Language Processing, Computational Linguistics and Speech Recognition, 2nd edn. Prentice Hall (2009)Google Scholar
  12. 12.
    Kasami, T., Torii, K.: A syntax-analysis procedure for unambiguous context-free grammars. Journal of the ACM 16, 423–431 (1969)CrossRefzbMATHMathSciNetGoogle Scholar
  13. 13.
    Kats, L.C.L., Visser, E., Wachsmuth, G.: Pure and declarative syntax definition: paradise lost and regained. In: Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA 2010), pp. 918–932 (2010)Google Scholar
  14. 14.
    Klein, D.: Christopher d. manning. In: Proceedings of the 42nd Annual Meeting on Association for Computational Linguistics (ACL 2004), pp. 478–485 (2004)Google Scholar
  15. 15.
    Kleppe, A.: Towards the generation of a text-based IDE from a language metamodel. In: Akehurst, D.H., Vogel, R., Paige, R.F. (eds.) ECMDA-FA. LNCS, vol. 4530, pp. 114–129. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  16. 16.
    Knuth, D.E.: On the translation of languages from left to right. Information and Control 8, 607–639 (1965)CrossRefMathSciNetGoogle Scholar
  17. 17.
    Lang, B.: Deterministic techniques for efficient non-deterministic parsers. In: Loeckx, J. (ed.) ICALP 1974. LNCS, vol. 14, pp. 255–269. Springer, Heidelberg (1974)CrossRefGoogle Scholar
  18. 18.
    Mernik, M., Heering, J., Sloane, A.M.: When and how to develop domain-specific languages. ACM Computing Surveys 37, 316–344 (2005)CrossRefGoogle Scholar
  19. 19.
    Nawrocki, J.R.: Conflict detection and resolution in a lexical analyzer generator. Information Processing Letters 38, 323–328 (1991)CrossRefzbMATHGoogle Scholar
  20. 20.
    Oettinger, A.: Automatic syntactic analysis and the pushdown store. In: Proc. of the Symposia in Applied Math, vol. 12, pp. 104–129 (1961)Google Scholar
  21. 21.
    Quesada, L.: A model-driven parser generator with reference resolution support. In: Proceedings of the 27th IEEE/ACM International Conference on Automated Software Engineering, pp. 394–397 (2012)Google Scholar
  22. 22.
    Quesada, L., Berzal, F., Cortijo, F.J.: Lamb — a lexical analyzer with ambiguity support. In: Proceedings of the 6th International Conference on Software and Data Technologies, vol. 1, pp. 297–300 (2011)Google Scholar
  23. 23.
    Quesada, L., Berzal, F., Cortijo, F.J.: Fence — a context-free grammar parser with constraints for model-driven language specification. In: Proceedings of the 7th International Conference on Software Paradigm Trends, pp. 5–13 (2012)Google Scholar
  24. 24.
    Quesada, L., Berzal, F., Cubero, J.-C.: A language specification tool for model-based parsing. In: Yin, H., Wang, W., Rayward-Smith, V. (eds.) IDEAL 2011. LNCS, vol. 6936, pp. 50–57. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  25. 25.
    Quesada, L., Berzal, F., Cubero, J.-C.: A tool for model-based language specification. ArXiv e-prints (2011),
  26. 26.
    Schmidt, D.C.: Model-driven engineering. IEEE Computer 39, 25–31 (2006)CrossRefGoogle Scholar
  27. 27.
    Tan, P.-N., Steinbach, M., Kumar, V.: Introduction to Data Mining. Addison Wesley (2006)Google Scholar
  28. 28.
    Tomita, M., Carbonell, J.G.: The universal parser architecture for knowledge-based machine translation. In: Proceedings of the 10th International Joint Conference on Artificial Intelligence, vol. 2, pp. 718–721 (1987)Google Scholar
  29. 29.
    Turmo, J., Ageno, A., Cataà, N.: Adaptive information extraction. ACM Computing Surveys 38(2), art. 4 (2006)Google Scholar
  30. 30.
    Younger, D.H.: Recognition and parsing of context-free languages in time n 3. Information and Control 10, 189–208 (1967)CrossRefzbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Luis Quesada
    • 1
  • Fernando Berzal
    • 1
  • Francisco J. Cortijo
    • 1
  1. 1.Department of Computer Science and Artificial IntelligenceCITIC, University of GranadaGranadaSpain

Personalised recommendations