cps-transformer

Transform direct-style code into Continuation-Passing Style for compilers.

17|2|Updated Feb 16, 2026
One-click install
npx skills add https://github.com/rainoftime/pl-skills --skill cps-transformer
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: cps-transformer
Source: https://github.com/rainoftime/pl-skills/tree/main/cps-transformer
Command: npx skills add https://github.com/rainoftime/pl-skills --skill cps-transformer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires lambda-calculus-interpreter, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill transforms direct-style programs into Continuation-Passing Style (CPS), which is crucial for implementing advanced control flow mechanisms and optimizing compiler backends.

Core Features & Use Cases

  • Compiler Intermediate Representation: Generate CPS as an intermediate form for compilers.
  • Control Operator Implementation: Build support for call/cc, delimited continuations, and other control flow primitives.
  • Use Case: Convert a complex recursive function in a functional language to its CPS equivalent to enable tail-call optimization and prevent stack overflows.

Quick Start

Transform the provided Scheme code snippet into Continuation-Passing Style.

Frequently Asked Questions about cps-transformer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert direct-style code into Continuation-Passing Style?▼

To convert direct-style code into Continuation-Passing Style, you transform functions to accept an extra continuation argument and explicitly pass control flow. This Skill automates CPS transformation for provided programming language snippets.

Why use Continuation-Passing Style transformation for compiler intermediate representation?▼

Continuation-Passing Style transformation is used for compiler intermediate representation to make control flow explicit. This allows advanced backend optimizations and enables the implementation of complex control operators like call/cc.

Can I implement delimited continuations and call/cc using CPS transformation?▼

Yes, you can implement delimited continuations and call/cc using CPS transformation. Converting direct-style programs to Continuation-Passing Style provides the necessary control flow primitives for these advanced control operators.

Do I need to understand lambda calculus to use this CPS transformation tool?▼

Yes, you need to understand lambda calculus to use this CPS transformation tool. The conversion process requires foundational knowledge of lambda calculus, administrative normal form, and various continuation types.

How do I prevent stack overflows in recursive functions using CPS?▼

To prevent stack overflows in recursive functions using CPS, you transform complex recursive functions into their Continuation-Passing Style equivalent. This conversion enables tail-call optimization within functional language compilers.

What is the best way to generate CPS from Scheme code for a compiler backend?▼

The best way to generate CPS from Scheme code for a compiler backend is to apply an automated CPS transformation. This Skill processes Scheme snippets, converting direct-style code into the Continuation-Passing Style required for backend optimization.