Abstract

We demonstrate how the framework of higher-order logic programming , as exemplified in the λProlog language design, is a prime vehicle for rapid prototyping of implementations for programming languages with sophisticated type systems. We present the literate development of a type checker for a language with a number of complicated features, culminating in a standard ML-style core with algebraic datatypes and type generalization, extended with staging constructs that are generic over a separately defined language of terms. We add each new feature in sequence, with little to no changes to existing code. Scaling the higher-order logic programming approach to this setting required us to develop approaches to challenges like complex variable binding patterns in object languages and performing generic structural traversals of code, making use of novel constructions in the setting of λProlog, such as GADTs and generic programming. For our development, we make use of Makam, a new implementation of λProlog, which we introduce in tutorial style as part of our (quasi-)literate development.

Highlights

  • We demonstrate how the framework of higher-order logic programming, as exemplified in the λProlog language design, is a prime vehicle for rapid prototyping of implementations for programming languages with sophisticated type systems

  • HAGOP (Student). (. . . ) So yes, I think my step should be writing a toy implementation of the type system we have in mind, so that we can try out some examples and see what works and what does not

  • 4Since GADTs in λProlog have not been considered in the past, we only present what is already supported by the existing language design and by many λProlog implementations in the present work

Read more

Summary

IN WHICH OUR HEROES SET OUT ON A ROAD TO PROTOTYPE A TYPE SYSTEM

HAGOP (Student). (. . . ) So yes, I think my step should be writing a toy implementation of the type system we have in mind, so that we can try out some examples and see what works and what does not. . ) So yes, I think my step should be writing a toy implementation of the type system we have in mind, so that we can try out some examples and see what works and what does not. Yes, all of those should be good choices. It’s a formalism that is well-suited to what we want to do, since we will need all sorts of different binding constructs, and the type system we are thinking about is quite advanced. Yes. a few years back a friend of mine worked on this new implementation of λProlog just for this purpose ś rapid prototyping of languages. It should be able to handle our MetaML-like language nicely, and we should not need to spend more than a few hours on it!. (Our heroes install Makam from https://github.com/astampoulis/makam and figure out how to run the REPL.)

IN WHICH OUR READERS GET A PREMONITION OF THINGS TO COME
IN WHICH OUR HEROES GET THE EASY STUFF OUT OF THE WAY
IN WHICH OUR HEROES ADD PARENTHESES AND DISCOVER HOW TO DO MULTIPLE BINDING
IN WHICH THE LEGEND OF THE GADTS AND THE AD-HOC POLYMORPHISM IS RECOUNTED
IN WHICH OUR HEROES REFLECT ON STRUCTURAL RECURSION
Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.