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

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

说明与用途

Fralculator 是一个离线优先的 Electron 计算器,显示逐步 PEMDAS 计算过程,支持自然语言和语音输入,并打包为 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