Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Building Fralculator: an offline-first, step-by-step calculator in Electron

Описание и применение

Fralculator – офлайн‑приложение‑калькулятор, показывающее пошаговый расчёт выражений, поддерживает естественный язык и голосовой ввод, упаковано для Windows и Linux.

Задача

Most calculators evaluate expressions without explaining the steps. I wanted a calculator that shows the ordered PEMDAS trace and a plain‑English explanation for each step.

Результат

Fralculator delivers an offline‑first calculator that explains each evaluation step, supports natural‑language input via rule‑based autocorrect, includes voice input with Whisper‑tiny, and ships as signed installers for Windows and Linux.

Рабочий процесс

  • 1. Tokenize the input string into numbers, operators, parentheses, and unary minus.
  • 2. Parse the tokens into an AST using recursive‑descent with precedence climbing.
  • 3. Evaluate the AST while recording a step trace at precedence boundaries.
  • 4. Render the trace with KaTeX and display plain‑English explanations.
  • 5. Apply word‑shorthand autocorrect rules to typed and voice input.
  • 6. For voice, use Whisper‑tiny WASM in a worker to transcribe audio, then run the same autocorrect pipeline.
  • 7. Package the app with electron‑builder for Windows (NSIS, portable exe) and Linux (AppImage, deb, rpm).

Доказательства

Most calculators evaluate. I wanted one that explains the evaluation: given 3 × (4 + 5), show the ordered PEMDAS trace — 4 + 5 = 9, then 3 × 9 = 27 — rendered as real math notation, with a plain-English sentence underneath.

Источник

Offline by default. The only allowed network calls: an optional currency rate fetch and a one-time ~40 MB model download for voice.

Источник

The engine is deliberately classic. A tokenizer turns the string into tokens (numbers, operators, parens, unary minus), a recursive‑descent parser builds an AST with the usual precedence climbing, and the evaluator walks it.

Источник

Natural‑language input in a calculator is either a tiny rule engine or an LLM. Offline means rule engine.

Источник

  • Дата записи: 2026-10-01T03:23:00.183Z