mail-address-semantics/mas-v0.2-spec/grammar/mas-v0.2.abnf
tegwick a12e1c4370 MAS-WP-0005-T07: v0.2 draft bundle; mas_core accepts v0.1 and v0.2 statutes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 252470@bnt-lap001
Assistant-Session: ad628c8f-4be2-4979-94c9-76c7ed6f8241
2026-10-18 22:19:34 +02:00

62 lines
2.1 KiB
ABNF

; Mail Address Semantics (MAS) v0.2 (draft)
; The canonical grammar is unchanged from v0.1.1. The v0.2 stand-ins
; ("--" for "=", "---" for "!") are not canonical syntax: they parse as
; opaque targets and are interpreted only by statute-aware
; implementations (SPECIFICATION section 6.3).
; Canonical ASCII local-part grammar
;
; This grammar describes the local-part only. Domain syntax is provided by
; the underlying email specifications.
;
; P1 accepts: target [facet]
; P2 accepts: target [facet] [interaction]
;
; Generators MUST NOT emit both facet and interaction in v0.1 even though
; P2 parsers accept the combined canonical form.
mas-local-p1 = target [facet]
mas-local-p2 = target [facet] [interaction]
target = resource-target / opaque-target
resource-target = resource-type "=" resource-id
opaque-target = dot-string
; v0.1.1 (SCP-2): lower-case words joined by single "-" or "_".
; Never upper case, never "--", "__" or a leading/trailing separator.
resource-type = type-word *(("-" / "_") type-word)
type-word = 1*(LCALPHA / DIGIT)
; Resource identifiers may contain additional "=" characters as data.
resource-id = resource-id-segment *("." resource-id-segment)
resource-id-segment = resource-id-char *resource-id-char
facet = "+" value
interaction = "!" value
value = value-segment *("." value-segment)
value-segment = value-char *value-char
; dot-string prevents leading, trailing, or repeated ".".
dot-string = atom *("." atom)
atom = atom-char *atom-char
; Conservative canonical ASCII subset derived from RFC 5322 atext while
; reserving MAS operators + ! $ ^ and "=" where structural.
;
; ALPHA / DIGIT are imported from RFC 5234 core rules.
atom-char = ALPHA / DIGIT /
"#" / "%" / "&" / "'" / "*" / "-" / "/" / "?" /
"_" / "`" / "{" / "|" / "}" / "~"
LCALPHA = %x61-7A ; a-z
resource-id-char = atom-char / "="
value-char = atom-char / "="
; Explicitly excluded from canonical values:
; "+" "!" "$" "^" "@"
;
; Quoted local-parts are outside canonical MAS v0.1.
; SMTPUTF8 local-parts are outside canonical MAS v0.1 machine grammar.