Overview
Last updated
Was this helpful?
Last updated
Was this helpful?
If you’ve been around Pi Squared for a while, you will hear about us talking about the K framework. It lies at the heart of our firm believe and persistent pursue of correctness: correctness of programs and programming tools. In this guide, we break it down for you.
K is a language framework. It allows people to write formal definitions of programming languages and automatically derived language tools. This is illustrated as below.
The bubble in the center represents the formal definition of a programming language.
Any programming language can be given a formal definition, including the OpCodes of a virtual machine and the operations of an instruction set architecture. The formal language definition, sometimes also referred to as a formal semantics of the language, is a complete and rigorous mathematical definition of the behaviors of all programs of that language.
Therefore, in theory and in principle, once we have a formal semantics of a language, we have everything we need to know to implement tools of that language. Any tools. Not only basic tools such as a parser, an interpreter, and a compiler, but also advanced tools such as a deductive program verifier and a model checker. The formal semantics of a language has all the information one needs to develop all these tools of the language.
It is theoretically possible to automatically derived all the above-mentioned language tools for any programming language from its formal semantics, but K makes it a reality.
In the past two decades, K has been through several major revisions and re-implementations and has incorporated with numerous novel technological innovations and engineering optimizations.
At Pi Squared, we use K at two different levels:
As of today, K has been successfully applied to completely define the formal semantics of large programming languages, including , , , , , , and . K is scalable and practical. It works.