This repository contains programs written in Rapira (Рапира), a Soviet-era educational programming language from the 1980s. The programs were generated by an LLM (Claude) as an experiment in testing LLM capability to write code in a language it has not been explicitly trained on.
Rapira exists in the LLM's training data in some form — the Wikipedia article, a few archived specification documents, and scattered references. However, that information is rather inexact:
- The language specification provided to the LLM describes the original
1985 Agat/Shkolnitsa dialect, which uses
->for assignment,ИМЕНА:for local variable declarations,КНЦto end procedures,ВСЕto end loops, and;as a statement terminator. - The actual interpreter (Rapture) implements a different dialect:
:=for assignment,свои:/чужие:instead ofИМЕНА:,конецinstead ofКНЦ,кцinstead ofВСЕfor loops, and no semicolons. - Rapture also introduces its own scoping model where all variables are local
by default and external names must be explicitly imported with
чужие:(extern) — including transitive dependencies through the entire call chain. - Several features from the original spec are unimplemented in Rapture: file
I/O, graphics, modules, the
ПРИГЛfunction, and more.
The LLM had to discover these discrepancies at runtime and adapt.
Prints the first 20 rows of Pascal's triangle. A simple program that exercises loops, sequences, and arithmetic.
rapture.bat pascal_triangle.rap
A Markdown-to-HTML converter supporting ATX headings, paragraphs, thematic breaks, fenced code blocks (with language tags), blockquotes, ordered and unordered lists, emphasis, strong emphasis, code spans, links, images, backslash escapes, and HTML entity escaping. Tested against 28 CommonMark test cases (all passing).
See md_to_html/README.md for usage instructions.
Rapture requires a Java Runtime Environment (JRE), version 8 or later. You do not need the full JDK — the JRE is sufficient since Rapture is a pre-built application, not something you compile.
Download from java.com.
Verify the installation:
java -version
Download the latest Rapture release (v1.0.1) from GitHub:
Download the rapture-1.0.1.zip archive.
Extract the archive. The resulting directory contains:
rapture-1.0.1/
bin/
rapture (Unix shell script)
rapture.bat (Windows batch file)
lib/
rapture-1.0.1.jar
... (dependency JARs)
Place the .rap files from this repository so that rapture.bat (or
rapture) can find them, or add the Rapture bin/ directory to your PATH.
rapture.bat pascal_triangle.rap
Rapture's REPL (interactive mode, started with rapture.bat without arguments)
requires proper UTF-8 setup to handle Cyrillic characters. On Windows, there
are two things to configure:
The legacy cmd.exe console host has poor Unicode support. Use Windows
Terminal (wt.exe) instead — it ships with Windows 11 and is available from
the Microsoft Store for Windows 10. It renders Cyrillic correctly out of the
box.
The rapture.bat included in this repository already does this automatically
(chcp 65001), but if you are running java directly or using a custom
script, set the code page before launching:
chcp 65001
Again, the modified rapture.bat handles this, but if running Java directly:
set JAVA_OPTS=-Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stdin.encoding=UTF-8
java %JAVA_OPTS% -classpath "lib/*" com.mattmik.rapira.RaptureCommandKt
In Windows Terminal settings, choose a font that covers Cyrillic glyphs. Cascadia Code (the default in Windows Terminal) works well. If using the legacy console, switch to Consolas or Lucida Console via the window properties.
For the smoothest experience on Windows:
- Open Windows Terminal (
wt.exe) - Use the provided
rapture.bat(which setschcp 65001and the Java encoding flags) - Ensure the terminal font supports Cyrillic (Cascadia Code, Consolas, etc.)
With this setup, both the REPL and file execution will correctly display Russian keywords and Cyrillic identifiers.
-
Rapira language specification (1985, Agat/Shkolnitsa system): https://sourceforge.net/p/mk72r/wiki/rapira/ — the original spec this project used as a starting point. Describes the
->assignment dialect. -
Rapture interpreter by Matt Mikolay: https://github.com/mattmikolay/rapture — the Kotlin/ANTLR-based interpreter used to run these programs. Implements the
:=assignment dialect. -
Rapira on Russian Wikipedia: https://ru.wikipedia.org/wiki/Рапира_(язык_программирования) — background on the language history, including the transition from
->to:=. -
Rapira examples by Matt Mikolay: https://github.com/mattmikolay/rapira-examples — additional sample programs in English-syntax Rapira.