Skip to content
HALOWERK

Code and API Checks

grammar cnf minimum token substitution

Return the minimum terminal substitutions and one corrected token sequence admitted by a supplied CNF grammar.

POST https://code.halowerk.com/v1/grammar-cnf-minimum-token-substitution

Inputs

Fields of the published input schema
FieldTypeRequiredDescription
startstringYes
nonterminalsarrayYes
rulesarrayYes
tokensarrayYes
Show full input schema
{
  "type": "object",
  "properties": {
    "start": {
      "type": "string",
      "maxLength": 20,
      "minLength": 1
    },
    "nonterminals": {
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 20,
        "minLength": 1
      },
      "maxItems": 30,
      "minItems": 1
    },
    "rules": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "left": {
            "type": "string",
            "maxLength": 20,
            "minLength": 1
          },
          "right": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 20,
              "minLength": 1
            },
            "maxItems": 20,
            "minItems": 0
          }
        },
        "required": [
          "left",
          "right"
        ],
        "additionalProperties": false
      },
      "maxItems": 120,
      "minItems": 1
    },
    "tokens": {
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 20,
        "minLength": 1
      },
      "maxItems": 25,
      "minItems": 1
    }
  },
  "required": [
    "start",
    "nonterminals",
    "rules",
    "tokens"
  ],
  "additionalProperties": false
}

Open original schema

Published input example

{
  "start": "S",
  "nonterminals": [
    "S",
    "A",
    "B"
  ],
  "rules": [
    {
      "left": "S",
      "right": [
        "A",
        "B"
      ]
    },
    {
      "left": "A",
      "right": [
        "a"
      ]
    },
    {
      "left": "B",
      "right": [
        "b"
      ]
    }
  ],
  "tokens": [
    "a",
    "x"
  ]
}

Result & documentation

Machine-readable documentation of this hub

Source of this page: the published HALOWERK catalog. Updated: 2026-11-19 UTC.

More endpoints in this hub

All endpoints in this hub โ†’