DEV Community

Cover image for LineSolv: A Natural-Language Calculator for Every Platform
RK Riad Khan
RK Riad Khan

Posted on

LineSolv: A Natural-Language Calculator for Every Platform

LineSolv: A Natural-Language Calculator for Every Platform

TL;DR — Numi is beautiful but macOS-only. LineSolv brings the same idea to Linux, Windows, and macOS — built with Go + Wails for a ~25 MB binary that starts in under a second. Open source, MIT licensed, no accounts, no telemetry.


The Problem

I've been a Numi user for years. The notepad-style calculator where you just type what you mean — 20% of 150, 5 kg in pounds, sin(pi/4) — and get instant results is genuinely one of those tools that changes how you work with numbers.

But Numi is macOS-only.

If you're on Linux or Windows, you're stuck with either the built-in calculator (which requires clicking buttons) or a full-blown spreadsheet app just to do quick math. There's a real gap in the market for a beautiful, keyboard-driven calculator that works everywhere.

So I built one.

Why Go + Wails, Not Electron?

I considered Electron first — it's the obvious choice for "build a desktop app with web technologies." But the numbers didn't add up:

Electron Go + Wails
Binary size 100–200 MB 20–50 MB
Memory (idle) 80–150 MB 20–40 MB
Startup time 2–5 seconds < 1 second
Native feel Heavy Lightweight

Wails v2 lets you write the backend in Go and the frontend in whatever JS/TS framework you want (I used vanilla TypeScript + Tailwind). The Go backend compiles to a single native binary. The frontend runs in the system's native WebView — no bundled Chromium.

The result: a ~25 MB app that starts instantly and uses almost no memory.

What It Does

LineSolv is a notepad-style calculator. You type natural language or math expressions on the left, and results appear instantly on the right.

Natural Language That Actually Works

You don't need to learn syntax. Just type what you'd say out loud:

twenty five percent of 200          → 50
5 kg in pounds                      → 11.0231 lb
what is pi plus five                → 8.14159
2h30m in minutes                    → 150 min
Enter fullscreen mode Exit fullscreen mode

The parser handles natural language (twenty five, half as much as 100), unit conversions across 100+ units in 14 categories, percentage math, and even purchase calculations (3 items at $10 each with a 15% discount).

Variables and Context

Lines reference each other automatically. Type x = 42 on one line, and x * 2 on the next line gives you 84. Use of that or then to chain results:

100
+ 10%            → 110 (10% of previous result)
of that           → 121 (10% again)
Enter fullscreen mode Exit fullscreen mode

Step-by-Step Evaluation

Hit Ctrl+S to open the Steps panel and see exactly how your expression was parsed and computed — every operation, every intermediate value. Great for learning or debugging complex calculations.

Function Graphing

Type plot x^2 or graph sin(x) and a live chart renders in the Graph panel. Supports custom ranges (plot x^2 from -10 to 10), multiple series, and Chart.js-powered interactive tooltips.

Multiple Notes, Persistent Storage

Create as many calculation notebooks as you need. Everything persists to a local SQLite database. Drag to reorder, search across all notes, export to PDF, JSON, Markdown, or plain text.

7 Themes

Dark, Light, Neon, Red, Obsidian, Plasma, and Blood — switch instantly in Settings. Every theme is carefully crafted for readability and contrast.

Everything Else

  • 26 built-in math functionssin, cos, sqrt, log, round, abs, factorial, and more
  • Live currency conversion — USD, EUR, GBP, JPY, and more via exchange-rate API (with offline cache)
  • Customizable shortcuts — rebind any keyboard shortcut
  • Print with formatting — A4 layout with note header, watermark, and page numbers
  • Undo/Redo — 200-entry history stack
  • PDF export — formatted documents with dates and page numbers

The Technical Journey

The Parser

The core is a recursive-descent parser in Go (~2,100 lines) with a 15-step natural language preprocessing pipeline. It handles operator precedence (PEMDAS), implicit multiplication (2pi), chained operations, and over 100 unit definitions.

The naturalize() function converts English words and phrases into tokenized math expressions before the parser sees them. It handles:

  • Word numbers (twenty five25)
  • Percentage phrases (10% of 200)
  • Unit conversions (5 kg in pounds)
  • Purchase math (3 items at $10 each with 15% discount)

The Frontend

Vanilla TypeScript, no framework. Just classes, DOM APIs, and Tailwind CSS. The app has 11 components, 2 stores, and a 200-entry undo/redo stack — all in ~3,000 lines.

Key architectural decisions:

  • No virtual DOM — direct DOM manipulation with diffing for the line-number gutter
  • Debounced evaluation — 150ms debounce with stale-result detection
  • Lazy panel rendering — panels build their DOM only when first opened

The Build

Wails v2 handles the cross-compilation. One wails build command produces:

  • Linux: standalone binary + .deb package
  • macOS: .dmg (Intel + Apple Silicon)
  • Windows: NSIS installer

CI runs on GitHub Actions with automatic releases on tag push.

Get Involved

# Clone and run
git clone https://github.com/rkriad585/LineSolv.git
cd LineSolv
wails dev

# Or just download a release
# https://github.com/rkriad585/LineSolv/releases
Enter fullscreen mode Exit fullscreen mode

LineSolv — is a lot works, but there's a lot more to build. If you've ever wished Numi worked on Linux, or you just want a fast, private calculator that respects your time, give it a try.

Contributions welcome. Open an issue, send a PR, or just star the repo if you want to follow along.


GitHub: github.com/rkriad585/LineSolv
License: MIT
Built with: Go, Wails v2, TypeScript, Tailwind CSS, Vite

Top comments (0)