[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to main content

plspec – A Specification Language for Prolog Data

  • Conference paper
  • First Online:
Declarative Programming and Knowledge Management (WFLP 2017, WLP 2017, INAP 2017)

Abstract

In general, even though Prolog is a dynamically typed language, predicates may not be called with arbitrarily typed arguments. Assumptions regarding type or mode are often made implicitly, without being directly represented in the source code. This complicates identifying the types or data structures anticipated by predicates. In consequence, Covington et al. proposed that Prolog developers should implement their own runtime type checking system.

In this paper, we present a re-usable Prolog library named plspec. It offers a simple and easily extensible DSL used to specify type and structure of input and output arguments. Additionally, an elegant insertion of multiple kinds of runtime checks was made possible by using Prolog language features such as co-routining and term expansion. Furthermore, we will discuss performance impacts and possible future usages.

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

Access this chapter

Subscribe and save

Springer+ Basic
£29.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
GBP 19.95
Price includes VAT (United Kingdom)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
GBP 35.99
Price includes VAT (United Kingdom)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
GBP 44.99
Price includes VAT (United Kingdom)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

References

  1. Amaral, C., Florido, M., Santos Costa, V.: PrologCheck – property-based testing in prolog. In: Codish, M., Sumii, E. (eds.) FLOPS 2014. LNCS, vol. 8475, pp. 1–17. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-07151-0_1

    Chapter  Google Scholar 

  2. Bracha, G.: Pluggable type systems. In: OOPSLA Workshop on Revival of Dynamic Languages (2004)

    Google Scholar 

  3. Covington, M.A., Bagnara, R., O’Keefe, R.A., Wielemaker, J., Price, S.: Coding guidelines for prolog. Theory Practice Logic Program. 12(6), 889–927 (2012)

    Article  MathSciNet  Google Scholar 

  4. Dowd, T., Somogyi, Z., Henderson, F., Conway, T., Jeffery, D.: Run time type information in mercury. In: Nadathur, G. (ed.) PPDP 1999. LNCS, vol. 1702, pp. 224–243. Springer, Heidelberg (1999). https://doi.org/10.1007/10704567_14

    Chapter  Google Scholar 

  5. Hickey, R.: clojure.spec - Rationale and Overview (2016). https://clojure.org/about/spec

  6. Hughes, J.: QuickCheck testing for fun and profit. In: Hanus, M. (ed.) PADL 2007. LNCS, vol. 4354, pp. 1–32. Springer, Heidelberg (2006). https://doi.org/10.1007/978-3-540-69611-7_1

    Chapter  Google Scholar 

  7. Jeffery, D.: Expressive type systems for logic programming languages. Dissertation, Department of Computer Science and Software Engineering, The University of Melbourne (2002)

    Google Scholar 

  8. Jimenez, M., Lindahl, T., Sagonas, K.: A language for specifying type contracts in erlang and its interaction with success typings. In: Proceedings of the 2007 SIGPLAN Workshop on ERLANG, ERLANG 2007, pp. 11–17. ACM (2007)

    Google Scholar 

  9. Kulaš, M.: Annotations for prolog – a concept and runtime handling. In: Bossi, A. (ed.) LOPSTR 1999. LNCS, vol. 1817, pp. 234–254. Springer, Heidelberg (2000). https://doi.org/10.1007/10720327_14

    Chapter  MATH  Google Scholar 

  10. Leuschel, M., Craig, S.J., Bruynooghe, M., Vanhoof, W.: Specialising interpreters using offline partial deduction. In: Bruynooghe, M., Lau, K.-K. (eds.) Program Development in Computational Logic. LNCS, vol. 3049, pp. 340–375. Springer, Heidelberg (2004). https://doi.org/10.1007/978-3-540-25951-0_11

    Chapter  Google Scholar 

  11. Lindahl, T., Sagonas, K.: Detecting software defects in telecom applications through lightweight static analysis: a war story. In: Chin, W.-N. (ed.) APLAS 2004. LNCS, vol. 3302, pp. 91–106. Springer, Heidelberg (2004). https://doi.org/10.1007/978-3-540-30477-7_7

    Chapter  Google Scholar 

  12. Mandrioli, D., Meyer, B.: Design by contract. In: Advances in Object-Oriented Software Engineering, p. 1 (1991)

    Google Scholar 

  13. Mera, E., Lopez-García, P., Hermenegildo, M.: Integrating software testing and run-time checking in an assertion verification framework. In: Hill, P.M., Warren, D.S. (eds.) ICLP 2009. LNCS, vol. 5649, pp. 281–295. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-02846-5_25

    Chapter  Google Scholar 

  14. Mycroft, A., O’Keefe, R.A.: A polymorphic type system for prolog. Artif. Intell. 23(3), 295–307 (1984)

    Article  MathSciNet  Google Scholar 

  15. Neugebauer, G.: pl-Literate Programming for Prolog with (1996). https://www.ctan.org/pkg/pl, version 3.0

  16. Overton, D.: Precise and expressive mode systems for typed logic programming languages. Dissertation, Department of Computer Science and Software Engineering, The University of Melbourne (2003)

    Google Scholar 

  17. Puebla, G., Bueno, F., Hermenegildo, M.: Combined static and dynamic assertion-based debugging of constraint logic programs. In: Bossi, A. (ed.) LOPSTR 1999. LNCS, vol. 1817, pp. 273–292. Springer, Heidelberg (2000). https://doi.org/10.1007/10720327_16

    Chapter  MATH  Google Scholar 

  18. Schrijvers, T., Santos Costa, V., Wielemaker, J., Demoen, B.: Towards typed prolog. In: Garcia de la Banda, M., Pontelli, E. (eds.) ICLP 2008. LNCS, vol. 5366, pp. 693–697. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-89982-2_59

    Chapter  Google Scholar 

  19. Somogyi, Z., Henderson, F.J., Conway, T.C.: Mercury, an efficient purely declarative logic programming language. In: Proceedings ASCS, pp. 499–512 (1995)

    Google Scholar 

  20. Wielemaker, J., Anjewierden, A.: PlDoc: Wiki style Literate Programming for Prolog. CoRR, abs/0711.0618 (2007)

    Google Scholar 

  21. Wielemaker, J., Schrijvers, T., Triska, M., Lager, T.: SWI-prolog. Theory Practice Logic Program. 12(1–2), 67–96 (2012)

    Article  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Philipp Körner .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Körner, P., Krings, S. (2018). plspec – A Specification Language for Prolog Data. In: Seipel, D., Hanus, M., Abreu, S. (eds) Declarative Programming and Knowledge Management. WFLP WLP INAP 2017 2017 2017. Lecture Notes in Computer Science(), vol 10997. Springer, Cham. https://doi.org/10.1007/978-3-030-00801-7_13

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-00801-7_13

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-00800-0

  • Online ISBN: 978-3-030-00801-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics