---
title: "kite: Scheme interpreter in Swift | VulCode"
description: "kite is a Scheme interpreter in Swift with call/cc continuations, tail recursion in constant space and hygienic syntax-rules macros."
url: "https://vulcode.com/en/portfolio/other/kite"
lang: "en"
---

[Other](https://vulcode.com/en/portfolio/other)

# kite

Scheme interpreter in Swift

A Scheme interpreter written in Swift, with an interactive REPL console and a runner for .scm files. It supports continuations, macros and exact arithmetic on arbitrarily large numbers.

## About the project

kite is a Scheme interpreter in Swift with call/cc continuations, tail recursion in constant space and hygienic syntax-rules macros. A continuation is the remembered rest of a computation that a program can return to, and hygienic macros do not mix their names with the names in the user's code. The interpreter computes with integers of any size and exact fractions, so results lose no precision. Programs are typed in live in the REPL, an interactive console.

## The challenge

Scheme demands two things you cannot build on the stack of the language the interpreter is written in: first-class continuations you can return to after they have already produced a result, and tail recursion with no depth limit. A naive recursive evaluator in Swift delivers neither.

## What we did

- A Scheme interpreter in Swift: an S-expression reader, a REPL and a .scm file runner

- A CEK machine in which the continuation is plain data

- Re-entrant call/cc and tail recursion in constant space

- Hygienic syntax-rules macros with literals and ellipses

- A numeric tower: a hand-written BigInt, exact fractions and floating point

- XCTest suites for every layer and for the example programs

## Related projects

- [**cinnamon-tweaks** Two small Python programs with GTK windows for the Cinnamon desktop: one for custom keyboard shortcuts, one for panel settings. For people who change these settings often and do not want to dig for them in Settings.](https://vulcode.com/en/portfolio/other/cinnamon-tweaks)

- [**pixel-platformer** A 2D pixel-art platformer played in the browser. It has levels, enemies and collectibles, and the character's movement rests on carefully tuned jump physics and collisions.](https://vulcode.com/en/portfolio/other/pixel-platformer)

- [**74 MVP frontends: websites, shops, panels and apps** A set of 74 MVP frontends for fictional brands: websites, shops, panels and the interfaces of web, desktop and mobile apps. Each has its own name, logo, palette and style.](https://vulcode.com/en/portfolio/other/mvp-frontends)

## Describe your project.

A free quote comes back within an hour during working hours.

### Rather skip the form?

Ask in the chat or write to us directly.

Open the chat

- **Email**: [hello@vulcode.com](mailto:hello@vulcode.com)
- **Phone**: [+48 576 043 920](tel:+48576043920)
- **Discord**: [discord.gg/vulcode](https://discord.gg/vulcode)

## Tell us what you want to build.

A free quote comes back within an hour during working hours. You talk to the person who writes the code.

[Free quote](https://vulcode.com/en/quote) [Free consultation](https://vulcode.com/en/consultation)

- [hello@vulcode.com](mailto:hello@vulcode.com)

- [+48 576 043 920](tel:+48576043920)

- [discord.gg/vulcode](https://discord.gg/vulcode)
