https://github.com/paulcadman/lean-ios
Build Lean apps for iOS
https://github.com/paulcadman/lean-ios
ios lean lean4
Last synced: 3 months ago
JSON representation
Build Lean apps for iOS
- Host: GitHub
- URL: https://github.com/paulcadman/lean-ios
- Owner: paulcadman
- License: apache-2.0
- Created: 2026-03-18T21:24:38.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-03-28T19:04:33.000Z (3 months ago)
- Last Synced: 2026-03-28T21:07:15.622Z (3 months ago)
- Topics: ios, lean, lean4
- Language: C
- Homepage:
- Size: 507 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## lean4-ios
This repository contains a modified Lean4 source tree with changes to let the
Lean runtime and stage0 standard library be built with the iOS toolchain and
linked into iOS apps.
For an overview of the project structure and build dependencies, see [Architecture](docs/architecture.md).
It also includes:
### Flappy bird
A flappy bird clone that uses SDL to render the game.
```
make -C example-flappy run-sim-app
```
This is the game running in the iOS simulator:
https://github.com/user-attachments/assets/05215072-60f6-4cef-9fff-9e5d9b611874
### A SDL iOS app
This app demonstrates a Lean program that uses SDL to make an SDL app with animated 2D graphics.
```
make -C example-sdl-app run-sim-app
```
This is the SDL app running in an iOS simulator:
https://github.com/user-attachments/assets/aa9b99ea-b496-4393-a35a-fe3d0679409e
## A minimal example iOS app
This app demonstrates how a Lean function can be called from an iOS app.
```
make -C example-app sim-app
```
This is what the example app looks like:

The build works as follows:
1. [example-app/lean/Example.lean](example-app/lean/Example.lean) is compiled to C.
2. The generated C is compiled for the iOS target.
3. [example-app/native/LeanIOSBridge.cpp](example-app/native/LeanIOSBridge.cpp)
initializes the Lean module and exposes a small C interface.
4. [example-app/native/App/main.swift](example-app/native/App/main.swift) calls
that bridge from a native iOS app.
5. The app is linked against the compiled Lean object, the iOS-built stage0
`libInit.a` and `libleanrt.a`.
## Useful Makefile targets:
- `make runtime` - builds the Lean4 runtime for iOS
- `make stdlib-init` - builds the Lean4 stage0 standard library for iOS
- `make -C example-app sim-app` - builds example-app for iOS simulator
- `make -C example-app run-sim-app` - starts a simulator, deploys / runs the iOS example app
- `make -C example-sdl-app sim-app` - build the example-sdl-app for iOS simulator
- `make -C example-sdl-app run-sim-app` - starts a simulator, deploys / runs the iOS example SDL app
- `make -C example-flappy sim-app` - build flappy bird for iOS simulator
- `make -C example-flappy run-sim-app` - starts a simulator, deploys / runs the flappy bird app