Skip to content
HN On Hacker News ↗

GitHub - begoon/rapira: Rapira programming language / Язык программирования Рапира

▲ 87 points 66 comments by begoon 3mo ago HN discussion ↗

Pangram verdict · v3.3

We believe that this document is fully AI-generated

92 %

AI likelihood · overall

AI
0% human-written 100% AI-generated
SEGMENTS · HUMAN 0 of 3
SEGMENTS · AI 3 of 3
WORD COUNT 505
PEAK AI % 99% · §1
Analyzed
May 28
backend: pangram/v3.3
Segments scanned
3 windows
avg 168 words each
Distribution
0 / 100%
human / AI fraction
Verdict
AI
Pangram v3.3

Article text · 505 words · 3 segments analyzed

Human AI-generated
§1 AI · 99%

A TypeScript / Bun interpreter for РАПИРА — the Soviet educational programming language designed in the early 1980s under G. A. Zvenigorodsky as part of the Школьница (Shkolnitsa) school computing system for the Агат (Agat) microcomputer.

▶ Try it in your browser: https://begoon.github.io/rapira

▶ Run it from your terminal: npx rapira factorial.rap

ФУНК ФАКТ (Н); ИМЕНА: Р; 1 -> Р; ДЛЯ И ОТ 1 ДО Н :: Р * И -> Р ВСЕ РЕЗ: Р КНЦ;

ДЛЯ Н ОТ 0 ДО 6 :: ? "ФАКТ(", Н, ") = ", ФАКТ(Н) ВСЕ;

What's in the box

Interpreter core (src/) — lexer, parser, tree-walking evaluator. Faithful to the 1985 Agat dialect: Russian-only keywords, case-insensitive identifiers, (* … *) block comments, ; statement separator, three compound types (tuples < >, sets <* *>, records <¤ ¤>), three-arrow procedure parameter scheme (name / name => / <=> name), trailing РЕЗ: for function results. CLI (cli/) — rapira FILE.rap runs a program, rapira drops into a multi-line REPL, --svg PATH captures turtle graphics as SVG. Web playground (web/) — vanilla HTML + CodeMirror 6 + Web Worker, light/dark theme, example selector loading from tests/snippets/. Build with bun build, output sits in docs/ ready for GitHub Pages. Live at https://begoon.github.io/rapira. Snippet test pipeline (tests/snippets/) — .rap files diffed against sibling .expected.txt / .expected.svg on every run of bun test.

§2 AI · 89%

Чертёжник turtle — Soviet "Draftsman" executor exposed as ordinary Rapira procedures (ВПЕРЕД, НАЗАД, НАПРАВО, НАЛЕВО, ПЕРО_ВНИЗ, ПЕРО_ВВЕРХ, ДОМОЙ, В_ТОЧКУ, КУРС). Layered on top of the same GfxEvent stream as the documented graphics primitives (ЛИН, ПРЯМ, ОБЛ, etc.) so the CLI's SVG renderer and the playground's canvas renderer draw identical output.

Install The CLI ships as a self-contained Node bundle. With Node ≥ 18 you can run it without cloning: npx rapira FILE.rap # run a program npx rapira FILE.rap --svg out.svg # capture turtle graphics npx rapira # multi-line REPL (Ctrl-D to quit) Or install globally: npm install -g rapira rapira FILE.rap Develop For local development you'll want Bun (it runs the tests and the dev server natively): bun install bun test # 129 tests across 9 files bun run cli/index.ts examples/factorial.rap # ФАКТ(0..7) bun run dev # playground on http://localhost:10000 bun run cli:build # bundle the CLI to dist/rapira.js If you have just installed, you can use the recipe names — just test, just dev, just run examples/turtle_star.rap --svg star.svg, etc. Examples

File What it shows

examples/hello.rap canonical ВЫВОД: "Здравствуй, мир!"

examples/factorial.rap ФУНК with trailing РЕЗ:, ДЛЯ … ОТ … ДО, integer math

examples/turtle_square.rap Чертёжник draws a square via ПОВТОР … РАЗА :: ВПЕРЕД(50); НАПРАВО(90)

examples/turtle_star.rap five-pointed star from a single repeat loop

examples/io_files.rap

§3 AI · 82%

ОТКРЫТЬ … КАК, ВЫВОД В ФАЙЛ, ВВОД ИЗ ФАЙЛА ТЕКСТОВ, ЗАКРЫТЬ

examples/io_seek.rap ПОЗИЦИЯ Ф = N for random-access file reading

Documentation

SPEC.md — the implementation contract: lexical structure, statements, operators, built-ins, what's done vs. honestly deferred. RAPIRA.md — the canonical 1985 spec (Фг.00031-01 35 01) reformatted to Markdown from the agatcomp.ru KOI-8 source. CLAUDE.md — onboarding notes for working on this codebase.

License MIT © Alexander Demin