Text steps (FPC) · Open standard · FPC 1.0

Flow Pseudocode

Pseudocode anyone can read, with just enough structure for tools and AI to read it too: a typed header, CALL lines for APIs and STEP markers that carry keys. Every logic and flow in Rabbinatix exports as FPC, which the app calls text steps.

Try the validator

Spec: CC BY 4.0 · Reference parser: MIT

What FPC is, and why

There is no single global standard for pseudocode. The best-known conventions are textbook styles and the exam-board specifications used in schools, with keywords like IF … THEN … ELSE … END IF. They are made for people: they have no types, no API calls, and no way to map a line back to what it came from.

FPC keeps that familiar keyword style and adds only what a round trip with tools and AI needs:

  • A typed header

    INPUT and OUTPUT in the same compact shape syntax as the endpoint editor.

  • CALL lines for APIs

    CALL AuthService POST /api/v2/login WITH { … }: which system, which contract.

  • STEP markers with keys

    The app's own keys, so a line maps back to the logic or node it came from.

  • A small, strict grammar

    Readable by anyone who has seen textbook pseudocode, parsed without guessing, easy for an AI to write from one page.

FPC doesn't depend on any language or vendor. It is open: anyone may write, read or build tools for it. We don't claim it is already a standard; we publish it so others can adopt it.

A quick example

A sign-in flow. The first two lines say which FPC it follows and what it describes; then come its inputs, outputs and steps.

user-login.fpc
FPC 1.0FLOW "User login" KEY FLOW-AUTH-LOGIN-001 VERSION 1.3.0INPUT email: string(email), password: string, rememberMe?: booleanOUTPUT token: string, expiresIn: integerSTEP LOGIC-AUTH-LOGIN-001/CHK "Inputs valid?"  IF email IS EMPTY OR password IS EMPTY THEN    FAIL 400 "email is required"  END IFSTEP LOGIC-AUTH-LOGIN-001/CALL  result ← CALL AuthService POST /api/v2/login WITH { email, password }  IF result.status = 401 THEN    FAIL 401 "Invalid credentials"  END IF  RETURN { token: result.body.accessToken, expiresIn: result.body.expiresIn }
  • Keywords are UPPER CASE and every block ends with END. Indentation is for people.
  • ← sets a value (type <- if you like); = compares.
  • -- starts a comment.

Construct reference

Every construct, generated from the same table the parser uses. The node types show which logic nodes each one writes; every node in the catalogue has an FPC form.

Document

Header

Every document starts with the FPC version, then what it describes: a FLOW (several systems) or one LOGIC. KEY is the app's key; VERSION or REVISION says which version it came from.

Syntax

FPC 1.0FLOW|LOGIC "name" [KEY key] [VERSION x.y.z | REVISION n]

Example

FPC 1.0LOGIC "Sign in" KEY LOGIC-AUTH-LOGIN-001 VERSION 1.3.0

System

The system a LOGIC document runs in.

Syntax

SYSTEM name

Example

SYSTEM AuthService

Trigger

How the logic starts: an HTTP request (endpoint), a UI or app event, a schedule or queue, or a call from other logic (a reusable function).

Syntax

ON REQUEST METHOD /pathON EVENT "name"ON SCHEDULE "spec"ON CALL

Example

ON REQUEST POST /api/v2/login

Nodes: io.onRequest, io.onEvent, io.trigger, io.functionEntry

Inputs and outputs

Typed inputs and outputs in the compact shape syntax. `?` marks an optional field, `| null` a nullable one. Endpoint logic reads its request as `request` and may name outputs by HTTP status (`OUTPUT 200: { … }, 401: { error: string }`).

Syntax

INPUT name: type, name?: typeOUTPUT name: type

Example

INPUT email: string(email), password: string, rememberMe?: booleanOUTPUT token: string, expiresIn: integer

Step

A section of the document carrying one of the app's keys, so tools can map lines back to objects. A step runs until the next STEP. In a FLOW each step is one logic; unknown or missing keys mean "new".

Syntax

STEP key ["title"] [IN system]

Example

STEP LOGIC-AUTH-LOGIN-001 "Sign in" IN AuthService

Comment

From `--` to the end of the line. Comments never change meaning.

Syntax

-- text

Example

-- exported 2026-09-30 12:00 UTC

Data

Set

Gives a variable (or a field or item of one) a value. `SET` may be left out; `<-` is the ASCII form of `←`.

Syntax

SET target ← expressiontarget ← expression

Example

SET total ← total + line.price * line.quantity

Nodes: data.setVar, data.getVar, obj.set

Values

Strings, numbers, booleans, null, objects and lists. `{ email }` is short for `{ email: email }`.

Syntax

"text"  42  3.5  true  false  null  (or TRUE FALSE NULL)  { name: value }  [a, b]

Example

SET body ← { email, password, tags: ["new", "web"] }

Nodes: data.literal, data.makeObject, data.makeArray, data.dictionary

Fields and items

A missing field reads as null (it never fails).

Syntax

value.field  value[index]  value["odd key"]

Example

result.body.accessToken

Nodes: obj.get, obj.break, col.get

Log

Writes a line to the run log.

Syntax

LOG expression

Example

LOG format("signed in {id}", { id })

Nodes: util.log

Control flow

Sequence

Statements run top to bottom. Indentation is for people; blocks are closed by END.

Syntax

statementstatement

Example

SET a ← 1SET b ← a + 1

Nodes: flow.sequence, util.rerouteExec, util.reroute

If

Conditions are true unless they are false, null, 0, "" or "false".

Syntax

IF condition THEN  …ELSE IF condition THEN  …ELSE  …END IF

Example

IF email IS EMPTY OR password IS EMPTY THEN  FAIL 400 "email is required"END IF

Nodes: flow.branch

Match

Runs the first CASE whose value equals the value, else the ELSE block.

Syntax

MATCH value  CASE literal[, literal]    …  ELSE    …END MATCH

Example

MATCH result.status  CASE 200    RETURN result.body  CASE 401, 403    FAIL 401 "Invalid credentials"END MATCH

Nodes: flow.switch, boundary.callContract

For each

Runs the body once per item. A value that is not a list runs it zero times.

Syntax

FOR EACH item[, index] IN list  …END FOR

Example

FOR EACH line IN order.items  SET total ← total + line.totalEND FOR

Nodes: flow.forEach

For range

Counts from first to last, both included. The bounds are read once.

Syntax

FOR index FROM first TO last  …END FOR

Example

FOR i FROM 1 TO 3  LOG iEND FOR

Nodes: flow.loop

Repeat

Runs the body n times (the same as FOR i FROM 1 TO n).

Syntax

REPEAT n TIMES  …END REPEAT

Example

REPEAT 3 TIMES  CALL Mailer send WITH { to }END REPEAT

Nodes: flow.loop

While

Checks the condition before each round.

Syntax

WHILE condition [DO]  …END WHILE

Example

WHILE page.next IS NOT NULL  SET page ← CALL Catalog GET /products WITH { cursor: page.next }END WHILE

Nodes: flow.while

Break and continue

Leave the innermost loop, or go on with its next round.

Syntax

BREAKCONTINUE

Example

FOR EACH item IN items  IF item.id = wanted THEN    BREAK  END IFEND FOR

Nodes: flow.break

Parallel

Branches may run at the same time; the statement ends when all are done. Simulation runs them in order.

Syntax

PARALLEL  BRANCH    …  BRANCH    …END PARALLEL

Example

PARALLEL  BRANCH    EMIT EventBus user.logged_in WITH { userId }  BRANCH    LOG "audit"END PARALLEL

Nodes: flow.parallel

Return

Ends the logic with its outputs. Endpoint logic returns an HTTP status and a body. Other logic that reaches its end without RETURN returns {} (its text shows no RETURN line, as it has no Return step).

Syntax

RETURN [expression]RETURN status WITH body [HEADERS headers]

Example

RETURN 200 WITH { token, expiresIn: 3600 }

Nodes: io.return, io.returnResponse

Calls

Call an API

Calls another system through its API contract. The result has `status`, `body` and `headers`; MATCH on `result.status` for each declared response.

Syntax

CALL System METHOD /path [WITH expression]

Example

result ← CALL AuthService POST /api/v2/login WITH { body: { email, password } }

Nodes: boundary.callContract

Call an operation

A database, queue, cache or external-service operation, by its name. A query returns the row or null (test it with `found(x)`).

Syntax

CALL System operation [WITH expression]

Example

user ← CALL UsersDb users.findByEmail WITH { email }

Nodes: boundary.queryDatabase, boundary.insert, boundary.update, boundary.delete, boundary.consumeEvent, boundary.callExternal, boundary.cache

Call logic

Runs other logic by its key: a reusable function, or in a FLOW the next system's logic.

Syntax

CALL LOGIC key [WITH expression]

Example

line ← CALL LOGIC LOGIC-LIB-LINE-TOTAL-001 WITH { item }

Nodes: fn.call

Emit

Publishes an event to a queue or topic.

Syntax

EMIT System event [WITH expression]

Example

EMIT EventBus user.logged_in WITH { userId }

Nodes: boundary.publishEvent

Errors and timing

Fail

Stops with an error: an HTTP status or an UPPER_CASE code, and a message.

Syntax

FAIL status|CODE message

Example

FAIL 401 "Invalid credentials"FAIL UPSTREAM_ERROR "User Service failed"

Nodes: flow.throw

Try

CATCH gets `{ code, message }`. FINALLY runs after TRY or CATCH end (also when CATCH fails), not after RETURN.

Syntax

TRY  …CATCH error  …FINALLY  …END TRY

Example

TRY  SET data ← parseJson(text)CATCH e  LOG e.messageEND TRY

Nodes: flow.try

Retry

Runs the body again when it fails, up to n times, waiting BACKOFF milliseconds between tries.

Syntax

RETRY n TIMES [BACKOFF ms] [AS attempt]  …ON SUCCESS  …ON FAILURE [AS error]  …END RETRY

Example

RETRY 3 TIMES BACKOFF 200  CALL Payments POST /charges WITH { body }ON FAILURE AS e  FAIL 502 e.messageEND RETRY

Nodes: flow.retry

Wait

Pauses (virtual time in simulation). Without a unit the duration is in milliseconds.

Syntax

WAIT duration [ms|s|m|h]

Example

WAIT 500 ms

Nodes: flow.wait, flow.delay

Expressions

Operators

ASCII alternatives: `<-` for ←, `!=` for ≠, `<=` for ≤, `>=` for ≥, `==` for =.

Syntax

+ - * / %  = ≠ < ≤ > ≥  AND OR NOT  IN  IS [NOT] EMPTY  IS [NOT] NULL

Example

IF total ≥ 100 AND NOT user.blocked THEN

Nodes: op.equals, op.notEquals, op.gt, op.lt, op.gte, op.lte, op.and, op.or, op.not, op.add, op.subtract, op.multiply, op.divide, op.modulo, col.contains, val.isEmpty, val.isNull, val.isRequired

Conditional value

A value chosen by a condition; the parentheses are required.

Syntax

(IF condition THEN a ELSE b)

Example

SET label ← (IF count = 1 THEN "item" ELSE "items")

Nodes: data.select

Functions

The named functions of the node catalogue (see the function list). Unknown names are errors.

Syntax

name(argument, …)

Example

IF NOT isEmail(lower(trim(email))) THEN

Operators

OperatorASCIIMeaning
←<-assignment (in SET)
ORlogical or
ANDlogical and
NOTlogical not (prefix)
===equal (deep for lists and objects)
≠!=not equal
<less than
≤<=less or equal
>greater than
≥>=greater or equal
INmembership in a list
IS [NOT] EMPTYnull, "", [] or {} (postfix)
IS [NOT] NULLnull or missing (postfix)
+add, or join two strings
-subtract (and prefix minus)
*multiply
/divide (fails on zero)
%remainder

Reserved words (upper case only): FPC FLOW LOGIC KEY VERSION REVISION SYSTEM ON REQUEST EVENT SCHEDULE INPUT OUTPUT STEP SET IF THEN ELSE END MATCH CASE FOR EACH IN FROM TO REPEAT TIMES WHILE DO CALL WITH EMIT TRY CATCH FINALLY RETRY BACKOFF AS SUCCESS FAILURE PARALLEL BRANCH WAIT RETURN HEADERS FAIL LOG BREAK CONTINUE AND OR NOT IS EMPTY NULL TRUE FALSE

Functions

The node catalogue's named functions. Any other name is an error, so a typo is caught, not guessed.

Values

default(value, fallback) → any
value, or fallback when value is null
exists(value) → boolean
the path exists (the value may be null)
found(value) → boolean
a query found something (not null, not an empty list)
compare(a, b) → integer
-1, 0 or 1
typeOf(value) → string
string, integer, number, boolean, object, array or null

Objects

get(object, "path") → any
a nested value by path (`a.b[0].c`); null when missing
set(object, "path", value) → object
a copy with a nested value set
remove(object, "path") → object
a copy without a nested value
merge(a, b) → object
shallow merge, b over a
transform(source, [[target, source], …]) → object
a new object: each target path ← source path
template(template, data) → any
fills {{path}} placeholders from data
keys(object) → string[]
the field names
values(object) → list
the field values
entries(object) → { key, value }[]
the fields as { key, value } items

Strings

format("text {name}", { name }) → string
fills {name} placeholders
concat(a, b) → string
joins two strings (null counts as "")
contains(text, search) → boolean
text contains search
startsWith(text, prefix) → boolean
endsWith(text, suffix) → boolean
trim(text) → string
without surrounding spaces
lower(text) → string
upper(text) → string
length(text) → integer
number of characters
replace(text, search, replacement) → string
replaces every occurrence
split(text, separator) → string[]
join(list, separator) → string
regexMatch(text, "pattern", "flags"?) → { matches: boolean, groups: string[] }
regular expression match
substring(text, start, end?) → string
part of the text (negative positions count from the end)
indexOf(text, search) → integer
position of search, or -1
padStart(text, length, fill) → string
fill added at the start up to length
padEnd(text, length, fill) → string
fill added at the end up to length
base64Encode(text) → string
UTF-8 text as Base64
base64Decode(text) → string
Base64 to text; fails with INVALID_BASE64
urlEncode(text) → string
escaped for a web address
urlDecode(text) → string
reverses urlEncode; fails with INVALID_URL_ENCODING
formatNumber(value, decimals, thousands, point) → string
a number with fixed decimals and a thousands separator ("1,234.50"); fails with INVALID_NUMBER
hash(text, "algorithm", "encoding") → string
SHA-256, SHA-1 or MD5 of the text, as hex or base64
hmac(text, key, "algorithm", "encoding") → string
an HMAC signature of the text with a secret key, as hex or base64

Lists

len(list) → integer
number of items
at(list, index) → any
the item at index (null when out of range); same as list[index]
append(list, item) → list
a copy with the item appended
sum(list, "path"?) → number
sum of the items (or of a field of each item)
sortBy(list, "path", descending) → list
a sorted copy
map(list, "LOGIC-KEY") → list
calls the logic for each item and keeps its first output
filter(list, "LOGIC-KEY") → list
keeps the items for which the logic returns true
find(list, "LOGIC-KEY") → any
the first item for which the logic returns true, or null
some(list, "LOGIC-KEY") → boolean
true if the logic returns true for any item
every(list, "LOGIC-KEY") → boolean
true if the logic returns true for every item (also for an empty list)
first(list) → any
the first item, or null
last(list) → any
the last item, or null
groupBy(list, "path"?) → object
the items grouped by the text of a field: { value: [items] }
average(list, "path"?) → number
the average of the items (or of a field of each item); 0 for none
slice(list, start, end?) → list
items from start up to end (negative positions count from the end)
reverse(list) → list
a reversed copy
unique(list) → list
repeated items removed
itemIndex(list, item) → integer
position of an equal item, or -1
flatten(list) → list
a list of lists joined into one list

Math

round(value, decimals) → number
rounded to decimals (halves up)
floor(value) → integer
rounded down
ceil(value) → integer
rounded up
abs(value) → number
without its sign
min(a, b) → number
the smaller value
max(a, b) → number
the larger value
power(base, exponent) → number
base raised to exponent
sqrt(value) → number
square root
clamp(value, min, max) → number
the value kept between min and max

Dates

parseDate(value) → { date, timestamp, valid }
reads ISO text or epoch milliseconds as a UTC date-time
formatDate(date, "pattern") → string
yyyy-MM-dd HH:mm style text (UTC); fails with INVALID_DATE
addTime(date, amount, "unit") → string(date-time)
the date moved by amount units (days, months…)
timeBetween(from, to, "unit") → integer
whole units from from to to
dateParts(date) → { year, month, day, hour, minute, second, millisecond, weekday }
the parts of a date (UTC; weekday 1 = Monday)
makeDate(year, month, day, hour, minute, second) → string(date-time)
a UTC date-time from its parts
startOf(date, "unit") → string(date-time)
the start of the hour, day, week (Monday), month or year (UTC)
endOf(date, "unit") → string(date-time)
the last moment of the hour, day, week, month or year (UTC)

Validation

isEmail(value) → boolean
a valid email address
isType(value, "type") → boolean
the value has the type
matchesShape(value, "shape") → boolean
the value matches a shape (compact syntax)
inRange(value, min, max) → boolean
min ≤ value ≤ max
matches(value, "pattern") → boolean
the value matches a regular expression
passwordOk(value, { minLength, requireDigit, requireUpper }) → boolean
the password meets the policy
checkRequired(value, "field") → { valid, message }
check with a message: "<field> is required"
checkEmail(value, "field") → { valid, message }
check with a message
checkType(value, "type", "field") → { valid, message }
check with a message
checkShape(value, shape, "field") → { valid, message }
check with a message (first failing path)
checkRange(value, min, max, "field") → { valid, message }
check with a message
checkRegex(value, "pattern", "field") → { valid, message }
check with a message
checkPassword(value, policy, "field") → { valid, message }
check with a message (first failing rule)

Conversion

toString(value) → string
objects become JSON
toNumber(value) → number
not a number → 0
isNumeric(value) → boolean
the value converts to a number
toBoolean(value) → boolean
parseJson(text) → any
parses JSON; fails with INVALID_JSON

Runtime

customCode("name", { inputs }) → any
calls a Custom Code function; its JavaScript stays in the logic (deps.code.<name> in exported code)
now() → string(date-time)
current date-time; a new value each time
uuid() → string(uuid)
a new id each time
random(min, max) → integer
integer between min and max

Types

INPUT and OUTPUT use the compact shape syntax of the endpoint editor: string, number, integer, boolean, null, any, a format in brackets like string(email), enum(a, b), objects in braces, T[] for a list, ? for an optional field and | null for a value that may be null.

INPUT email: string(email), createdAt: string(date-time)INPUT age?: integer, score: number, active: booleanINPUT role: enum(admin, member, guest)INPUT tags: string[], owner: { id: string, name?: string } | null

Endpoint logic reads its request as request and may name its outputs by HTTP status: OUTPUT 200: { token: string }, 401: { error: string }, returned with RETURN 200 WITH { token }.

CALL, STEP and keys

CALL AuthService POST /api/v2/login WITH { body }
A call through an API contract: the system, the method and the path, exactly as the contract says. The result has status, body and headers, so you MATCH on result.status. Databases, queues and external services use their operation name: CALL UsersDb users.findByEmail WITH { email }; events are sent with EMIT.
CALL LOGIC LOGIC-LIB-LINE-TOTAL-001 WITH { item }
Runs other logic by its key: a reusable function, or, in a FLOW, the next system's logic. The API it goes through is kept as a comment.
STEP LOGIC-AUTH-LOGIN-001 "Sign in" IN AuthService
A section with one of the app's keys. A FLOW is a sequence of steps across systems, one per logic. Keys are how tools map lines back to objects: keep them exactly as they are. A step with an unknown key, or with none, means "new".
LOGIC "Sign in" KEY LOGIC-AUTH-LOGIN-001 VERSION 1.3.0
Every export says which object it came from and which version: its named version when the current revision has one, otherwise REVISION n, plus the export time as a comment.

Copy to AI

No AI runs inside Rabbinatix: use the assistant you already have. The workflow is copy and paste.

  1. Step 1

    Copy the text steps

    In the logic editor's Code panel, Text tab (its … menu), or a flow's Text steps panel: Copy as text steps or Download text steps (.fpc).

  2. Step 2

    Add the cheat sheet

    Paste the one-page cheat sheet with it, so the assistant knows the rules and the functions.

  3. Step 3

    Ask for your language

    "Implement this FPC in TypeScript", or "convert my code to FPC 1.0", then check the answer with the validator below.

FPC and your AI assistant in Rabbinatix

Connect the AI assistant in your editor to Rabbinatix and it reads and writes logic and flows as FPC itself: no prompts to copy, no replies to paste.

Ask your assistant
With a key of your own (Integrations → AI assistants), your assistant gets the FPC of any logic or flow, writes code from it in your project, or turns your code into FPC, checks and tests it, and leaves it as a draft. You review the diff and accept it. How it works.
Is my code in step?
Paste a generated file's header, or the FPC your code was written from. You see whether it matches the current version and what changed since, and can ask your assistant to update the code for exactly those changes: a small edit instead of a rewrite.

Validator

Paste FPC to check it as you type. Problems show their line and column; valid FPC is shown in its tidied form. Nothing leaves your browser.

3 errors

For editors: a TextMate grammar for syntax highlighting (VS Code and others) ships in the repository under tools/fpc-vscode.

Grammar

The full grammar in EBNF.

(* FPC 1.0. Keywords are UPPER CASE and reserved only in upper case.
   NL is a line break. Inside ( ), [ ] and { } line breaks are ignored.
   "--" starts a comment that runs to the end of the line. *)

document    = { NL | comment NL }, "FPC", version, NL,
              ( "FLOW" | "LOGIC" ), string, [ "KEY", key ], [ "VERSION", semver ], [ "REVISION", integer ], NL,
              { header NL }, block, { step } ;
header      = comment
            | "SYSTEM", name
            | "ON", ( "REQUEST", method, path | "EVENT", string | "SCHEDULE", string | "CALL" )
            | ( "INPUT" | "OUTPUT" ), param, { ",", param } ;
param       = ( identifier | integer | string ), [ "?" ], ":", type ;
step        = "STEP", key, [ string ], [ "IN", name ], NL, block ;

block       = { statement | comment NL | NL } ;
statement   = simple, [ comment ], NL | compound ;
simple      = [ "SET" ], target, "←", expression
            | call
            | "EMIT", name, word, [ "WITH", expression ]
            | "WAIT", expression, [ "ms" | "s" | "m" | "h" ]
            | "RETURN", [ expression ]
            | "RETURN", integer, "WITH", expression, [ "HEADERS", expression ]
            | "FAIL", ( integer | identifier | string ), expression
            | "LOG", expression
            | "BREAK" | "CONTINUE" ;
compound    = "IF", expression, "THEN", NL, block,
              { "ELSE", "IF", expression, "THEN", NL, block }, [ "ELSE", NL, block ], "END", "IF", NL
            | "MATCH", expression, NL, { "CASE", expression, { ",", expression }, NL, block },
              [ "ELSE", NL, block ], "END", "MATCH", NL
            | "FOR", "EACH", identifier, [ ",", identifier ], "IN", expression, [ "DO" ], NL, block, "END", "FOR", NL
            | "FOR", identifier, "FROM", expression, "TO", expression, [ "DO" ], NL, block, "END", "FOR", NL
            | "REPEAT", expression, "TIMES", NL, block, "END", "REPEAT", NL
            | "WHILE", expression, [ "DO" ], NL, block, "END", "WHILE", NL
            | "TRY", NL, block, [ "CATCH", [ identifier ], NL, block ], [ "FINALLY", NL, block ], "END", "TRY", NL
            | "RETRY", expression, "TIMES", [ "BACKOFF", expression ], [ "AS", identifier ], NL, block,
              [ "ON", "SUCCESS", NL, block ], [ "ON", "FAILURE", [ "AS", identifier ], NL, block ], "END", "RETRY", NL
            | "PARALLEL", NL, { "BRANCH", NL, block }, "END", "PARALLEL", NL ;
target      = identifier, { "." , field | "[", expression, "]" } ;
call        = "CALL", "LOGIC", key, [ "WITH", expression ]
            | "CALL", name, method, path, [ "WITH", expression ]
            | "CALL", name, word, [ "WITH", expression ] ;

expression  = or ;
or          = and, { "OR", and } ;
and         = not, { "AND", not } ;
not         = "NOT", not | comparison ;
comparison  = sum, [ ( "=" | "≠" | "<" | "≤" | ">" | "≥" | "IN" ), sum | "IS", [ "NOT" ], ( "EMPTY" | "NULL" ) ] ;
sum         = product, { ( "+" | "-" ), product } ;
product     = unary, { ( "*" | "/" | "%" ), unary } ;
unary       = "-", unary | postfix ;
postfix     = primary, { "." , field | "[", expression, "]" } ;
primary     = number | string | "true" | "false" | "null" | "TRUE" | "FALSE" | "NULL"
            | identifier, [ "(", [ expression, { ",", expression } ], ")" ]
            | "(", expression, ")"
            | "(", "IF", expression, "THEN", expression, "ELSE", expression, ")"
            | "{", [ entry, { ",", entry }, [ "," ] ], "}"
            | "[", [ expression, { ",", expression }, [ "," ] ], "]"
            | call ;
entry       = ( identifier | string ), [ ":", expression ] ;

type        = single, { "|", single } ;
single      = ( "string" | "number" | "integer" | "boolean" | "null" | "any" | "object" | "array" ), [ "(", word, ")" ]
            | "enum", "(", value, { ",", value }, ")"
            | "{", [ field, [ "?" ], ":", type, { ",", field, [ "?" ], ":", type } ], "}"
            | "[", type, "]"
            | single, "[", "]" ;

(* lexical *)
identifier  = letter, { letter | digit | "_" | "$" } - keyword ;
key         = word ;                          (* LOGIC-AUTH-LOGIN-001, LOGIC-AUTH-LOGIN-001/CHK *)
word        = ? characters with no space between them ? ;
path        = "/", word ;                     (* /api/v2/users/{id} *)
method      = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" ;
name        = word | string ;                 (* a system: AuthService, "Auth Service" *)
string      = '"', { character | "\", escape }, '"' ;
number      = digit, { digit }, [ ".", digit, { digit } ], [ ( "e" | "E" ), [ "+" | "-" ], digit, { digit } ] ;
comment     = "--", { character } ;
(* ASCII alternatives: "<-" for "←", "!=" or "<>" for "≠", "<=" for "≤", ">=" for "≥", "==" for "=" *)

Versioning

  • Every document names its FPC version on its first line: FPC 1.0.
  • Minor versions (1.1, 1.2…) only add: new statements or functions. A 1.x document without them is valid 1.0; a 1.0 reader warns about a newer minor version.
  • A major version (2.0) may change meaning, and a 1.x reader refuses it.
  • Conformance levels: Level 1 tools export valid FPC (read only). Level 2 tools also import it back (round trip), keeping keys.

Licence

The spec: CC BY 4.0

Share and adapt it for any purpose, including commercial, as long as you give credit.

The reference parser: MIT

The lexer, parser, validator and printer are plain TypeScript with no dependencies. Use them in your own tools.