\section{Formal Grammar of OPT--Code and OPT--Intent}
\label{sec:opt-formal-grammar}

To enable automated verification, interoperability, and agentic reasoning,
OPT expressions are defined using a formal grammar. The grammar below is
expressed in Extended Backus–Naur Form (EBNF).

\subsection{Lexical Conventions}

\begin{itemize}
  \item Identifiers are case-sensitive.
  \item Root tokens are one of: Lrn, Evo, Sym, Prb, Sch, Ctl, Swm.
  \item Whitespace is insignificant except as separator.
  \item Strings are sequences of non-semicolon characters.
\end{itemize}

\subsection{OPT--Code Grammar}

\begin{verbatim}
OPTCode      ::= "OPT" "=" RootExpr ";" FieldList

RootExpr     ::= Root
               | Root "/" RootExpr
               | Root "+" RootExpr

Root         ::= "Lrn" | "Evo" | "Sym" | "Prb"
               | "Sch" | "Ctl" | "Swm"

FieldList    ::= Field (";" Field)*

Field        ::= "Rep" "=" Value
               | "Obj" "=" Value
               | "Data" "=" Value
               | "Time" "=" Value
               | "Human" "=" Value

Value        ::= Token (("+" | "-" | "_")? Token)*

Token        ::= letter (letter | digit | "-" | "_")*
\end{verbatim}

\subsection{OPT--Intent Grammar}

\begin{verbatim}
OPTIntent    ::= "INTENT-OPT" "=" RootExpr ";"
                 IntentFieldList

IntentFieldList ::= IntentField (";" IntentField)*

IntentField  ::= "INTENT-GOAL" "=" Value
               | "INTENT-CONSTRAINTS" "=" Value
               | "INTENT-RISKS" "=" Value
               | "INTENT-CONTEXT" "=" Value
\end{verbatim}

\subsection{Composition Semantics}

The operators have the following interpretation:

\begin{itemize}
  \item "/" denotes hybrid composition with integrated interaction.
  \item "+" denotes additive coexistence of mechanisms.
\end{itemize}

Associativity is left-to-right. Precedence is equal unless specified
otherwise in an implementation.

\subsection{Extensibility}

Future OPT revisions may introduce additional fields or metadata extensions
without altering the core RootExpr grammar. Implementations should ignore
unknown fields while preserving structural validity.

