Integer expression parse

integer-expression-parse · version 1.0.0 · Numbers & math · free, no key needed

Parse an integer expression and return its tokens, required variables, precedence tree, and precedence table.

Use when you need to: parse integer expression without evaluating · show tokens in a bitwise arithmetic formula · find variables needed by an integer expression.

Decide before calling

Read the versioned contract and the supported scope below. Reuse integer-expression-parse@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.

Explain the choice

"I can use integer-expression-parse@1.0.0 for parse integer expression without evaluating. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "expression": "base + index * 4"
}

Response:

{
  "result": {
    "standard_version": "Python 3.12 §6.5–6.9; ISO/IEC 9899:2018 §6.5.5",
    "tokens": [
      {
        "type": "name",
        "text": "base"
      },
      {
        "type": "operator",
        "text": "+"
      },
      {
        "type": "name",
        "text": "index"
      },
      {
        "type": "operator",
        "text": "*"
      },
      {
        "type": "integer",
        "text": "4"
      }
    ],
    "variables": [
      "base",
      "index"
    ],
    "precedence_tree": "(+ base (* index 4))",
    "precedence": [
      "parentheses",
      "** (right associative)",
      "unary - and ~",
      "* / // % rem",
      "+ -",
      "<< >>",
      "&",
      "^",
      "|"
    ]
  }
}

How to call it

MCP

Connect https://computefirst.net/mcp (setup), then call execute with:

{
  "id": "integer-expression-parse",
  "version": "1.0.0",
  "input": {
    "expression": "base + index * 4"
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/integer-expression-parse/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"expression":"base + index * 4"}'

The machine-readable contract is at /v1/tools/integer-expression-parse/versions/1.0.0.

CLI

node cli.mjs run integer-expression-parse 1.0.0 --input input.json --base-url https://computefirst.net

Get the client at /clients/cli/.