{
  "id": 13015995,
  "title": "Turning \"price - product cost - shipping\" into a calculator: a plain-word formula parser with no eval",
  "url": "https://urgent.news/2026/10/09/turning-price-product-cost-shipping-into-a-calculator-a-plain-word",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-09T03:11:41.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/monsibd/turning-price-product-cost-shipping-into-a-calculator-a-plain-word-formula-parser-with-no-11pl"
  },
  "original_language": "en",
  "account": "Most people don't think in spreadsheet syntax when calculating profit per online order. They might say something like \"price minus product cost minus shipping\" instead of writing \"=B2-C2-D2\" in a spreadsheet. To create a calculator builder that accepts formulas in plain English, the parser uses a series of steps without using a built-in eval function.\n\nFirst, it cleans up the formula by normalizing the typography. Then, it converts multi-word names into a single variable, such as \"price - product cost - shipping\" becoming \"price_product_cost_shipping\". Next, it detects the inputs required for the formula and organizes them in the order they appear. After that, it converts abbreviations into human-readable labels based on a predefined dictionary.\n\nFinally, the parser evaluates the formula safely, without using eval, by using a recursive-descent evaluator that supports numbers, basic arithmetic operations, parentheses, and a limited set of functions. This ensures that the calculator can be chained together for more complex calculations and can be accessed through a JSON API or remote MCP server, allowing tools like AI assistants to run them accurately.",
  "summary": "Most people don't think in spreadsheet syntax. Ask an online seller how they work out profit per order and they'll say something like \"price minus product cost minus shipping.\" Not =B2-C2-D2 . I wanted a calculator builder where you can type exactly that, price - product cost - shipping , and get a working calculator with labelled inputs. Here's how the parser behind it works, in about 100 lines…",
  "key_points": [
    "Parser cleans up formula by normalizing typography",
    "Converts multi-word names into single variable",
    "Evaluates formula safely without using eval"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}