SwimmingDSL

Swim sets,
written as code.

A language for swim training, parsed by Rascal. Edit a lane, then race it.

Take your marks.

Desktop and web, today

The SwimmingDSL web app: a session in the editor on the left, and Rascal's analysis on the right with 1,150 m, one session and 14:25 total time.
Web, with a Node server
The SwimmingDSL desktop app dashboard: 41 sessions, 77.2 km in total, charts of distance, intensity and stroke mix per session, and weekly progress.
Desktop, with Kotlin and Compose

Exploring Send sessions to Garmin watches; log them to Strava.

  • Rascal
  • Kotlin
  • Compose
  • Java
  • Node.js
  • Gemini

Read a set

8×100 free fast @1:30

Whiteboard

xInterval swim mSwimExercise Style Intensity pace Pace rest sRest

Parsed
8 x swim 100 m freestyle
    hard pace 75 rest 15 s
AST
interval(8,
  swim(100, freestyle(),
       hard(), 75),
  15)
Measured
Distance
800 m
Swimming
10:00
Rest
1:45
Send-off
1:30

Build a session

easy moderate hard kick or drillDrag the red line

At the wall

0 / 0 m   0:00

Playback speed
Distance
0 m
Swimming
0:00
Rest
0:00
Session
0:00

Agents

Three Gemini agents in the desktop app. Nothing they write is used until Rascal parses it.

Plain English in, SwimmingDSL out. Parse errors go back to the model, up to three attempts.

  1. Request

    Easy 400 to warm up, then eight hard 100s on 1:15 with 15 seconds rest, 200 easy to finish.

  2. Attempt 1
    session tuesday {
      swim 400 m easy
      8 x swim 100 m freestyle hard pace 75 rest 15 s
      swim 200 m freestyle easy
    }

    Parse error at line 3, column 2

  3. Attempt 2
    session tuesday {
      swim 400 m freestyle easy
      8 x swim 100 m freestyle hard pace 75 rest 15 s
      swim 200 m freestyle easy
    }

    Parsed: 1,400 m

Run it

Java 17+. The agents need a Gemini API key.

git clone https://github.com/Carlixgonzam/swimmingdsl
cd swimmingdsl/kotlin-app
export GEMINI_API_KEY="your_key"
./gradlew run

Web server setup: WEB_SERVER_SETUP.md