FS FormScript

Specification 1.0 · level 3 of 5

The rules belong to the form, not to the screen.

A regulated form has one data model and several presentations: web, phone, API, PDF, email. In practice they drift. FormScript puts the rule in one document, so every conforming runtime returns the same values, the same validity, the same error codes and the same output.

loan_application.forms


form loan_application version = "1.0" {
  text {
    "applicant.first": "First name"
    "applicant.last": "Last name"
    "applicant.income": "Annual income"
    "applicant.amount": "Loan amount"
    "applicant.term": "Term in months"
    "applicant.monthly": "Monthly payment"
    "applicant.guarantor": "Guarantor name"
    "applicant.consent": "The applicant agrees to a credit check"
  }

  group applicant {
    field first_name {
      type = string
      label = t("applicant.first")
      required = true
    }
    field last_name {
      type = string
      label = t("applicant.last")
      required = true
    }
21 packages 312 normative statements 776 tests

One document. Watch the guarantor leave.

Change the income. The live form, the output JSON, and a second evaluation of the same engine move together.

Document

Live form

Output

Second execution: the same TypeScript engine. Level 4 needs an independent runtime — not claimed yet.

What FormScript gives the team

Three things stop being duplicated the moment the rule lives in the document.

The rule is the document

Validation, applicability, derived values, locale and accessibility live in one file that diffs in review and can be read by legal.

Spec-7 → Spec-13

Two runtimes, one answer

The browser and the server evaluate the same document. Same values, same validity, same error codes — so a disagreement is a bug, not a design.

Spec-15.1

Errors that mean something

Stable diagnostic codes, a fixed catalogue, typed values with honest absence, and decimal arithmetic that does not drift by a cent.

Spec-10 · Spec-14

How it fits in

Three steps from a blank repository to a form two runtimes agree on.

Write the document

A form, its fields, its types, its rules and its output block. Plain text, reviewed like code.

Render it anywhere

The document emits render intents; a renderer turns them into controls. The same intents drive web, phone and PDF.

Prove it

The conformance suite runs the document against every normative statement and reports the level it reaches.

21packages
312statements
776tests
101conformance rows
3 / 5level claimed

21 packages · 312 statements · 776 tests · 776 over 21 files · 101 conformance rows · level 3 of 5

Run the real engine in your browser

The playground is the same lexer, parser, analyser and engine the conformance suite runs — with a live form beside it.