Abstract
Parsing has been a traditional workbench for showing the virtues of declarative programming. Both logic and functional programming claim the ability of writing parsers in a natural and concise way. We address here the task from a functional-logic perspective. By modelling parsers as non-deterministic functions we achieve a very natural manner of building parsers, which combines the nicest properties of the functional and logic approaches. In particular, we are able to define parsers within our framework in a style very close to that of functional programming parsers, but using simpler concepts. Moreover, we have moved beyond usual declarative approaches to parsers, since the functional-logic parsers presented here can be considered as truly data values. As an example of this feature we define a function that detects ambiguous grammars.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Arenas-Sánchez, P., Hortalá-González, T., López-Fraguas, F.J., Ullán-Hernández, E.: Functional Logic programming with Real Numbers. In: Chakavrarty, M., Guo, Y., Ida, T. (eds.) Multiparadigm Logic Programming, Post-Conference Workshop of the JICLP 1996, TU Berlin Report 96-28, pp. 47–58 (1996)
Arenas-Sánchez, P., Rodríguez-Artalejo, M.: A Semantic Framework for Functional Logic Programming with Algebraic Polymorphic Types. In: Bidoit, M., Dauchet, M. (eds.) CAAP 1997, FASE 1997, and TAPSOFT 1997. LNCS, vol. 1214, pp. 453–464. Springer, Heidelberg (1997)
Caballero-Roldán, R., López Fraguas, F.J., Sánchez-Hernández, J.: User’s Manual For TOY. Technical Report D.I.A. 57/97, Univ. Complutense de Madrid (1997), The system is, available at http://mozart.sip.ucm.es/incoming/toy.html
Caballero-Roldán, R., López-Fraguas, F.J.: Functional-Logic Parsers in TOY. Technical Report S.I.P. 74/98. Univ. Complutense de Madrid (1998), Available at http://mozart.sip.ucm.es/papers/1998/trparser.ps.gz
Caballero, R., López-Fraguas, F.J.: Extensions: A Technique for Structuring Functional-Logic Programs. In: PSI 1999. LNCS, Springer, Heidelberg (1999) (to appear)
Fokker, J.: Functional Parsers. In: Jeuring, J., Meijer, E. (eds.) AFP 1995. LNCS, vol. 925. Springer, Heidelberg (1995)
González-Moreno, J.C., Hortalá-González, T., López-Fraguas, F.J., Rodríguez- Artalejo, M.: An Approach to Declarative Programming Based on a Rewriting Logic. Journal of Logic Programming 40(1), 47–87 (1999)
González-Moreno, J.C., Hortalá-González, T., Rodríguez-Artalejo, M.: A Higher Order Rewriting Logic for Functional Logic Programming. In: Procs. of ICLP 1997, pp. 153–167. The MIT Press, Cambridge (1997)
González-Moreno, J.C.: A Correctness Proof for Warren’s HO into FO Translation. In: Procs. of GULP 1993, pp. 569–585 (1993)
Hanus, M.: The Integration of Functions into Logic Programming: A Survey. J. of Logic Programming, 19–20; Special issue Ten Years of Logic Programming, 583–628 (1994)
Hanus, M. (ed.): Curry, an Integrated Functional Logic Language, Draft (1998)
Jones, S.P., Hughes, J.(eds.): Report on the Programming Language Haskell 1998: a Non-strict, Purely Functional Language. (February 1999)
Hutton, G.: Higher-Order Functions for Parsing. J. of Functional Programming 2(3), 323–343 (1992)
Hutton, G., Meijer, E.: Functional Pearls. Monadic Parsing in Haskell. Journal of Functional Programming 8(4), 437–444 (1998)
Leermakers, R.: The Functional Treatment of Parsing. Kluwer Academic Publishers, Dordrecht (1993)
Loogen, R., López-Fraguas, F.J., Rodríguez-Artalejo, M.: A Demand Driven Computation Strategy for Lazy Narrowing. In: Penjam, J., Bruynooghe, M. (eds.) PLILP 1993. LNCS, vol. 714, pp. 184–200. Springer, Heidelberg (1993)
López-Fraguas, F.J., Sánchez-Hérnandez, J.: TOY: A Multiparadigm Declarative System. In: Narendran, P., Rusinowitch, M. (eds.) RTA 1999. LNCS, vol. 1631, pp. 244–247. Springer, Heidelberg (1999)
Meijer, E., Jeuring, J.: Merging Monads and Folds for Functional Programming. In: Jeuring, J., Meijer, E. (eds.) AFP 1995. LNCS, vol. 925, pp. 228–266. Springer, Heidelberg (1995)
Sterling, L., Shapiro, E.: The Art of Prolog. MIT Press, Cambridge (1986)
Wadler, P.: Monads for functional programming. In: Jeuring, J., Meijer, E. (eds.) AFP 1995. LNCS, vol. 925. Springer, Heidelberg (1995)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 1999 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Caballero, R., López-Fraguas, F.J. (1999). A Functional-Logic Perspective of Parsing. In: Middeldorp, A., Sato, T. (eds) Functional and Logic Programming. FLOPS 1999. Lecture Notes in Computer Science, vol 1722. Springer, Berlin, Heidelberg. https://doi.org/10.1007/10705424_6
Download citation
DOI: https://doi.org/10.1007/10705424_6
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-66677-6
Online ISBN: 978-3-540-47950-5
eBook Packages: Springer Book Archive