Core Markers

In .ncds draft format, NormCode uses three primary symbols. Everything else is natural language.

Symbol Name Meaning Example
<- Value Concept "This is data" (nouns) <- document summary
<= Functional Concept "This is an action" (verbs) <= summarize this text
<* Context Concept Loop/timing state <* current item

Basic Structure

Plans execute inside-out (innermost first) and top-to-bottom (sibling order).

/: Final output (produced last)
<- document summary
    /: Action to produce the output
    <= summarize this text
    /: Input for the action (produced first)
    <- clean text
        <= extract main content, removing headers
        <- raw document

The Golden Rule: Each inference has exactly ONE action (<=). If you need multiple steps, nest them.

Concept Types

In formal .ncd syntax, concepts have explicit type markers:

Value Types (Non-Functional)

Symbol Name Description Example
{} Object Generic entity/data {document}
<> Proposition State/condition (boolean) <validation passed>
[] Relation Collection (list/dict) [documents]

Action Types (Functional)

Symbol Name Description Example
::() Imperative Command/action ::(calculate sum)
::()<> Judgement Evaluation (true/false) ::(is valid)<ALL True>

Syntactic Operators

These operators are free (no LLM call), instant, and deterministic.

Assigning Operators ($)

Operator Name Purpose
$. Specification Select first valid value from candidates
$+ Continuation Append along an axis (accumulation)
$- Selection Extract specific elements
$= Identity Merge concepts (alias)

Grouping Operators (&)

Operator Name Purpose
&[{}] Group In Collect items with labels (dictionary)
&[#] Group Across Flatten items to list

Timing Operators (@)

Operator Name Purpose
@:' Conditional Execute if condition is true
@:! Negated Execute if condition is false
@. Completion Wait for dependency to complete

Looping Operator (*)

Operator Name Purpose
*. Iterate For each item in collection

Multi-Input Operations

Actions can have multiple inputs. They see all listed inputs—but nothing else.

<- user sentiment
    <= determine if the user is satisfied
    <- support ticket
    <- conversation history

The action sees both support ticket AND conversation history—but nothing else from the workflow.

Iteration Pattern

Loop over collections with the iteration pattern:

<- all summaries
    <= for every document in the list return the document summary
        <= select document summary to return
        <- document summary
            <= summarize this document
            <- document to process now
    <- documents
    <* document to process now

Key components: <- documents is the base collection. <* document to process now marks the current element in each iteration.

Conditional Execution

Execute steps only when conditions are met:

<- final output
    <= select reviewed output if available otherwise use draft
    <- draft needs review?
        <= check if draft requires review
        <- draft output
    <- reviewed output
        <= perform human review
            <= if draft needs review
            <* draft needs review?
        <- draft output
    <- draft output

The review step only runs if draft needs review? evaluates to true.

File Formats

NormCode has multiple formats for different stages:

Format Purpose Description
.ncds Draft/Authoring Start here—rough logic, easy to write
.ncd Formal Syntax Structured with operators and types
.nci.json Inference Structure Clear flow structure for analysis
.concept.json + .inference.json Executable Loaded by orchestrator at runtime

Typical workflow: Write .ncds → Compiler transforms to .ncd → Activation produces .concept.json + .inference.json → Orchestrator executes.

Back to Documentation