Calendar Wiki
Advertisement
;; @LICENSE Public Domain, no rights reserved
;; @COMPATIBLE superset of ISO 8601 and RFC 3339
;
; DATES
;
; era-sign            ::= plus | minus
year                ::= full-year | simple-year           ; ±E*CCYY | CCYY | YY
full-year           ::= short-year | long-year            ; ±E*CCYY | CCYY
basic-year          ::= short-year | simple-year          ; CCYY | YY
simple-year         ::= to-doublezero                     ; YY = 00..99
short-year          ::= simple-century simple-year        ; CCYY = 0000..9999
long-year           ::= positive-year | negative-year     ; ±E*CCYY
positive-year       ::= plus long-century simple-year     ; +E*CCYY
negative-year       ::= minus long-century simple-year    ; -E*CCYY
century             ::= simple-century | long-century     ; E*CC
simple-century      ::= to-doublezero                     ; CC = 00..99
long-century        ::= (1-6)*DIGIT simple-century        ; C+ = ...
triad-of-year       ::= to-four                           ; Q  = 1..4
month-of-year       ::= to-twelve                         ; MM = 01..12
month-of-triad      ::= to-three                          ; M  = 1..3
month-of-quart      ::= to-three                          ; M  = 1..3
day-of-year         ::= to-threesixtysix                  ; DDD = 001..365/366 not 364/371
day-of-triad        ::= to-ninetytwo                      ; DD = 01..90/91/92
day-of-month        ::= to-thirtyone                      ; DD = 01..28/29/30/31
day-of-week         ::= to-seven                          ; D = 1..7 not 0
day-of-quart        ::= to-ninetyeight                    ; DD = 01..91/98
day-of-moon         ::= to-thirtyfive                     ; DD = 01..28/35
day-of-lunation     ::= to-thirty                         ; DD = 01..29/30
weekday             ::= to-seven                          ; D = 0..7             ; null-days not handled yet
weekday-of-triad    ::= to-fourteen                       ; WW = 00/01..12/13/14
weekday-of-month    ::= to-five                           ; W = 0/1..4/5
weekday-of-lunation ::= to-five                           ; W = 0/1..4/5
week-of-year        ::= to-fiftythree                     ; WW = 01..52/53
week-of-triad       ::= to-fourteen                       ; WW = 01..12/13/14
week-of-quart       ::= to-fourteen                       ; WW = 01..13/14
week-of-month       ::= to-five                           ; W  = 1..4/5
week-of-moon        ::= to-five                           ; W  = 1..4/5
quart-of-year       ::= to-four                           ; Q = 1..4
moon-of-year        ::= to-thirteen                       ; MM = 01..13
lunation-of-year    ::= to-thirteen                       ; MM = 01..13
part-of-date        ::= part-of                           ; 
season-of-year      ::= to-four                           ; Q = 1..4
sign-of-season      ::= to-three                          ; M = 1..3
quarter-of-f-year   ::= to-four                           ; 'F'Q  = 0/1..4
month-of-f-year     ::= to-twelve                         ; 'F'MM = 00/01..12
day-of-f-year       ::= to-threesixty                     ; 'F'DDD = 001..360
day-of-f-month      ::= to-thirty                         ; 'F'DD = 00/01..30
;
; TIMES
;
hour                ::= to-twentyfour                     ; hh = 00..23/24
minute              ::= to-fiftynine                      ; mm = 00..59
second              ::= to-sixty                          ; ss = 00..58/59/60
part-of-time        ::= part-of                           ;
;
; GENERAL
;
part-of             ::= decimal-separator digit [digit]*  ; ('.'|',')f+
digit               ::= zero | to-nine
single-digit        ::= digit
double-digit        ::= single-digit single-digit
triple-digit        ::= double-digit single-digit 
zero-thru-two       ::= zero one-thru-two
zero-thru-three     ::= zero one-thru-three
zero-thru-four      ::= zero one-thru-four
zero-thru-five      ::= zero one-thru-five
zero-thru-seven     ::= zero one-thru-seven
zero-thru-nine      ::= zero one-thru-nine
zero-thru-ninetynine::= zero one-thru-ninetynine
one-thru-two        ::= one | two
one-thru-three      ::= one-thru-two   | three
one-thru-four       ::= one-thru-three | four
one-thru-five       ::= one-thru-four  | five
one-thru-seven      ::= one-thru-five  | six | seven
one-thru-nine       ::= one-thru-seven | eight | nine
one-thru-ninetynine ::= [zero one-thru-nine] | [one-thru-nine zero-thru-nine]
; fields "to-*":
; single-digit
to-two              ::= one | two                       | field-wildcard
to-three            ::= to-two   | three
to-four             ::= to-three | four
to-five             ::= to-four  | five
to-seven            ::= to-five  | six | seven
to-nine             ::= to-seven | eight | nine
; double-digit
to-nine-pad         ::= zero one-thru-nine              | field-wildcard
to-twelve           ::= to-nine-pad | [one zero-thru-two]
to-thirteen         ::= to-twelve | [one three]
to-fourteen         ::= to-thirteen | [one four]
to-twentyfour       ::= to-nine-pad | [one zero-thru-nine] | [two [zero-thru-four]]
to-twentyeight      ::= to-twentyfour | [two [five | six | seven | eight]]
to-twentynine       ::= to-twentyeight | [two nine]
to-thirty           ::= to-twentynine | [three zero]
to-thirtyone        ::= to-thirty | [three one]
to-thirtyfive       ::= to-thirtyone | [three [two | three | four | five]]
to-fiftytwo         ::= to-nine-pad | [one-thru-four zero-thru-nine] | [five zero-thru-two]
to-fiftythree       ::= to-fiftytwo | [five three]
to-fiftyeight       ::= to-fiftythree | [five [four | five | six | seven | eight]]
to-fiftynine        ::= to-fiftyeight | [five nine]
to-sixty            ::= to-fifty-nine | [six zero]
to-ninety           ::= to-fifty-nine | [[six | seven | eight] digit] | [nine zero]
to-ninetyone        ::= to-ninety | [nine one]
to-ninetytwo        ::= to-ninetyone | [nine two]
to-ninetyeight      ::= to-ninetytwo | [nine [three | four | five | six | seven | eight]]
to-ninetynine       ::= to-ninetyeight | [nine nine]
to-doublezero       ::= to-ninetynine | [zero zero]
; triple-digit
to-ninetynine-pad   ::= zero one-thru-ninetynine | field-wildcard
to-threesixty       ::= to-ninetynine-pad | [one-thru-two zero-thru-ninetynine] 
                     | [three [[zero-thru-five zero-thru-nine] | [six zero]]]
to-threesixtyfour   ::= to-threesixty | [three six [one | two | three | four]]
to-threesixtyfive   ::= to-threesixtyfour | [three six five]
to-threesixtysix    ::= to-threesixtyfive | [three six six]
to-threeseventyone  ::= to-threesixty | [three [[six one-to-nine] | [seven [zero | one]]]]
;
; Separators
;
separator           ::= datetime-separator | decimal-separator | span-separator
datetime-separator  ::= time-separator | space
null-separator      ::= empty | comment
date-separator      ::= [comment]* dash [comment]*
time-separator      ::= [comment]* colon [comment]*
decimal-separator   ::= [comment]* [comma | dot] [comment]*
span-separator      ::= [comment]* slash [comment]*
interval-separator  ::= span-separator | hyphen
uncertain-separator ::= tilde | plusminus
; 
; Wildcards
;
wildcard            ::= digit-wildcard | field-wildcard
digit-wildcard      ::= provide-wildcard | unknown-wildcard
provide-wildcard    ::= underscore
unknown-wildcard    ::= X
field-wildcard      ::= asterisk
template-wildcard   ::= hash
;
; Alternate path syntax
; optional, restricted
; only if compact forms and durations and time zones are not used
; processed after percent-decoding
date-key            ::= date-marker      ; uppercase keys only?
time-key            ::= time-marker
duration-key        ::= duration-marker
repetition-key      ::= repetition-marker
pair                ::= any-par | dating-pair
any-pair            ::= key pair-separator value
key                 ::= ; defined elsewhere
value               ::= date | time | datetime | duration | repetition
dating-pair         ::= datetime-pair | [date-pair || time-pair] | duration-pair | repetition-pair
datetime-pair       ::= date-key pair-separator datetime
date-pair           ::= date-key pair-separator date
time-pair           ::= time-key pair-separator time
duration-pair       ::= duration-key pair-separator duration
repetition-pair     ::= repetition-key pair-separator repetition
query               ::= query-marker [pair | value]
; normal key-value combinations should still be possible, but this is not specified here
; not implemented: time intervals specified by slash-separated start date as path and end date or duration with slashes as query without name value distinction, e.g. /2012/09/01?/10/08 = 2012-09-01/10-08
path-separator      ::= 
path-date-separator ::= slash
path-time-separator ::= slash
path-span-separator ::= question
path-query-marker   ::= hash | question
path-query-separator::= semicolon | ampersand
path-pair-separator ::= equals
path-date-marker    ::= slash | date-marker
path-time-marker    ::= slash | time-marker
;
; Markers
;
; prefix
; suffix
marker              ::= day-marker | month-marker 
                     | week-marker | moon-marker | quarter-marker
                     | lunar-marker | season-marker | fiscal-marker
                     | date-marker | time-marker | duration-marker | repetition-marker
quarter-marker      ::= triad-marker | quart-marker
triad-marker        ::= empty
quart-marker        ::= Q
season-marker       ::= S
month-marker        ::= empty
moon-marker         ::= M
lunar-marker        ::= L
week-marker         ::= W
day-marker          ::= empty
fiscal-marker       ::= F
date-marker         ::= D
time-marker         ::= T
duration-marker     ::= P
repetition-marker   ::= R
UTC-marker          ::= Z
definition-marker   ::= at
leap-item-marker    ::= asterisk
intercalary-marker  ::= plus
; 
; Pairs
;
comment-start       ::= open-angle
comment-end         ::= close-angle
date-start          ::= open-paren
date-end            ::= close-paren
duration-start      ::= open-bracket
duration-end        ::= close-bracket
repetition-start    ::= open-brace
repetition-end      ::= close-brace
;
; Unit symbols
;
;unit
year-unit           ::= Y
quarter-unit        ::= Q
triad-unit          ::= quarter-unit   ;  3M
quart-unit          ::= quarter-unit   ; 13W
season-unit         ::= quarter-unit   ;  3M
month-unit          ::= M
moon-unit           ::= month-unit     ;  4W or 28D
fiscal-unit         ::= month-unit | F ; 30D
lunation-unit       ::= month-unit | L ; 29/30D
week-unit           ::= W              ;  7D
day-unit            ::= D
hour-unit           ::= H
minute-unit         ::= M
second-unit         ::= S
;
; FORMATS
;
; -std suffix for human-readable standard (or extended) format with hyphens or colons
; -basic suffix for compact formats without hyphens or colons
;
; Existing formats
;
;century               ::= century ; see above
;year                  ::= year    ; see above
year-day              ::= year-day-std | year-day-basic
year-day-std          ::= [year]? date-separator day-of-year
year-day-basic        ::= [year]? null-separator day-of-year
year-month            ::= year-month-std | year-month-basic
year-month-std        ::= [year]? date-separator month-of-year
year-month-basic      ::= null-separator
year-month-implied    ::= null-separator
year-month-day        ::= year-month-day-std | basic-day-month-year
year-month-day-std    ::= [year-month-std | year-month-implied] date-separator day-of-month
year-month-day-basic  ::= year-basic null-separator  month-of-year null-separator day-of-month
year-week              ::= year-week-std | year-week-basic
std-week-year          ::= [year]? date-separator week-marker week-of-year
basic-week-year        ::= [year]? null-separator week-marker week-of-year   ; allows YY'W'WW
implied-year-week      ::= date-separator                                    ; 'W'?
year-week-day          ::= year-week-day-std | year-week-day-basic
year-week-day-std      ::= [year-week-std | implied-year-week] date-separator day-of-week
year-week-day-basic    ::= [year-week-basic]? null-separator day-of-week     ; allows YY'W'WWD and D
;
; New month-based formats
;
year-triad            ::= [full-year]? date-separator triad-of-year
year-triad-month      ::= year-triad date-separator month-of-triad ; forbids --M
year-triad-month-day  ::= [year-triad-month | date-separator date-separator month-of-triad] date-separator day-of-month ; allows --M-DD
year-triad-weekday    ::= year-triad date-separator weekday-of-triad date-separator weekday
year-month-weekday    ::= [year-month-std | date-separator] weekday-of-month date-separator weekday
; year-triad-month-weekday; possible, but not specified
;
; New week-based formats
;
weekyear               ::= full-year [week-marker | quart-marker | moon-marker]
; Quarts
year-quart            ::= year-quart-std | basic-quart-year
year-quart-std        ::= [full-year]? date-separator quart-marker quart-of-year
year-quart-basic      ::= [full-year]? null-separator quart-marker quart-of-year
year-quart-implied     ::= date-separator quart-marker
year-quart-day        ::= year-quart-day-std | year-quart-day-basic
year-quart-day-std    ::= [year-quart-std | year-quart-implied] date-separator day-of-quart ; allows '-Q-'DD
year-quart-day-basic  ::= year-quart-basic null-separator day-of-quart
year-quart-week        ::= year-quart-week-std | year-quart-week-basic
year-quart-week-std    ::= [year-quart-std | year-quart-implied] date-separator week-marker week-of-quart
year-quart-week-basic  ::= [year-quart-basic | quart-marker] null-separator week-marker week-of-quart
year-quart-week-day    ::= year-quart-week-day-std | year-quart-week-day-basic
year-quart-week-day-std    ::= year-quart-week-std date-separator day-of-week
year-quart-week-day-basic  ::= year-quart-week-basic null-separator day-of-week
; Dual months
year-quart-month      ::= year-quart-month-std | year-quart-month-basic
year-quart-month-std  ::= year-quart-std date-separator month-of-quart
year-quart-month-basic::= year-quart-basic null-separator month-of-quart
year-quart-month-day  ::= year-quart-month-day-std | year-quart-month-day-basic
year-quart-month-day-std  ::= year-quart-month-std date-separator day-of-month  ; 01..30/31
year-quart-month-day-basic::= year-quart-month-basic null-separator day-of-month; 01..30/31
year-quart-month-week      ::= year-quart-month-week-std | year-quart-month-week-basic
year-quart-month-week-std  ::= year-quart-month-std date-separator week-of-month     ; 4..5
year-quart-month-week-basic::= year-quart-month-basic null-separator week-of-month   ; 4..5
year-quart-month-week-day  ::= year-quart-month-week-day-std | year-quart-month-week-day-basic
year-quart-month-week-day-std   ::= year-quart-month-week-std date-separator day-of-week
year-quart-month-week-day-basic ::= year-quart-month-week-basic null-separator day-of-week
; Moons
year-moon                  ::= year-moon-std | year-moon-basic
year-moon-std              ::= [full-year]? date-separator moon-marker moon-of-year
year-moon-basic            ::= [full-year]? null-separator moon-marker moon-of-year
year-moon-implied          ::= date-separator moon-marker
year-moon-day              ::= year-moon-day-std | year-moon-day-basic
year-moon-day-std          ::= [year-moon-std | year-moon-implied]? date-separator day-of-moon
year-moon-day-basic        ::= [year-moon-basic]? null-separator day-of-moon
year-moon-week             ::= year-moon-week-std | year-moon-week-basic
year-moon-week-std         ::= [year-moon-std | year-moon-implied]? date-separator week-marker week-of-moon
year-moon-week-basic       ::= [year-moon-basic | moon-marker]? null-separator week-marker week-of-moon
year-moon-week-day         ::= year-moon-week-day-std | year-moon-week-day-basic
year-moon-week-day-std     ::= year-moon-week-std date-separator day-of-week
year-moon-week-day-basic   ::= year-moon-week-basic null-separator day-of-week
;
; New month-week-based formats
;
year-triad-week            ::= year-triad date-separator week-marker week-of-triad
year-triad-week-day        ::= year-triad-week date-separator day-of-week
year-month-week            ::= [year-month | year-month-implied] date-separator week-marker week-of-month
year-month-week-day        ::= year-month-week date-separator day-of-week
;
; New financial formats
; optional
;
fiscalyear                 ::= full-year fiscal-marker
; should the marker be part of the quarter, month and day fields instead of the year field?
year-fiscal-std            ::= [full-year]? date-separator fiscal-marker
year-fiscal-basic          ::= [full-year]? null-separator fiscal-marker
year-quarter-fiscal        ::= year-quarter-fiscal-std | year-quarter-fiscal-basic
year-quarter-fiscal-std    ::= year-fiscal-std date-separator quarter-of-f-year
year-quarter-fiscal-basic  ::= year-fiscal-basic null-separator quarter-of-f-year
year-month-fiscal          ::= year-month-fiscal-std | year-month-fiscal-basic
year-month-fiscal-std      ::= year-fiscal-std date-separator month-of-f-year
year-month-fiscal-basic    ::= year-fiscal-basic null-separator month-of-f-year
year-day-fiscal            ::= year-day-fiscal-std | year-day-fiscal-basic    ; deprecate?
year-day-fiscal-std        ::= year-fiscal-std date-separator day-of-f-year   ; deprecate?
year-day-fiscal-basic      ::= year-fiscal-basic null-separator day-of-f-year ; deprecate?
year-month-fiscal-day      ::= year-month-fiscal-day-std | year-month-fiscal-day-basic
year-month-fiscal-day-std  ::= year-month-fiscal-std date-separator day-of-f-month
year-month-fiscal-day-basic::= year-month-fiscal-basic null-separator day-of-f-month
;
; New astronomic and astrologic formats
; optional
;
; Lunar
;
lunaryear                  ::= full-year lunar-marker
; should the marker be part of the lunation field instead of the year field?
year-lunar-std             ::= [full-year]? date-separator lunar-marker
year-lunar-basic           ::= [full-year]? null-separator lunar-marker
year-lunation              ::= year-lunation-std | year-lunation-basic
year-lunation-std          ::= year-lunar-std lunation-of-year
year-lunation-basic        ::= year-lunar-basic lunation-of-year
year-lunation-day          ::= year-lunation-day-std | year-lunation-day-basic
year-lunation-day-std      ::= year-lunation-std date-separator day-of-lunation
year-lunation-day-basic    ::= year-lunation-basic null-separator day-of-lunation
year-lunation-weekday      ::= year-lunation-std date-separator weekday-of-lunation date-separator weekday 
; compact format of year-lunation-weekday is invalid
;
; Season and zodiac sign
;
seasonyear                 ::= full-year season-marker                 ; astroyear
; should the marker be part of the season field instead of the year field?
year-season                ::= year-season-std | year-season-basic
year-season-std            ::= [full-year]? date-separator season-marker season-of-year
year-season-basic          ::= [full-year]? null-separator season-marker season-of-year
year-season-implied        ::= date-separator season-marker
year-season-sign           ::= year-season-sign-std | year-season-sign-basic
year-season-sign-std       ::= [year-season-std | year-season-implied] date-separator sign-of-season
year-season-sign-basic     ::= year-season-basic null-separator sign-of-season
;
; Date in general
;
datetime            ::= [date [datetime-separator time]] | [[date-marker]? fraction-date]
date                ::= [date-marker]? integer-date
integer-date        ::= year-number | quarter | month | week | day
fraction-date       ::= date part-of-date ; includes part of day, i.e. time without 'T'
; date fields
; ordered by precision, no matter whether some part may be implied
year-number         ::= year | weekyear | fiscalyear | lunaryear | seasonyear ; year = monthyear
quarter             ::= triad | quart | fiscal-quarter | season
triad               ::= triad-year         ; triad-in-year
quart               ::= quart-year         ; quart-in-year
fiscal-quarter      ::= fiscal-quarter-year
season              ::= season-year        ; season-in-year
month               ::= common-month | dual-month | moon | fiscal-month | lunation | sign
common-month        ::= month-in-year | month-in-triad
month-in-year       ::= month-year
month-in-triad      ::= month-triad-year
sign                ::= sign-season-year   ; sign-in-season, sign-in-year is not defined
dual-month          ::= month-quart-year   ; month-in-quart
moon                ::= moon-year          ; moon-in-year
fiscal-month        ::= fiscal-month-year  ;
lunation            ::= lunation-year      ; lunation-in-year
week                ::= week-in-year | week-in-quarter | week-in-month
week-in-year        ::= week-year
week-in-quarter     ::= week-quart-year | week-triad-year
week-in-month       ::= week-month-quart-year | week-month-year | week-moon-year
day                 ::= day-in-year | day-in-quarter | day-in-month | day-in-week | weekday
day-in-year         ::= day-year | fiscal-day-year
day-in-quarter      ::= day-quart-year
day-in-month        ::= day-month-quart-year | day-month-triad-year 
                     | day-month-year | day-moon-year | day-lunation-year | fiscal-day-month-year
day-in-week         ::= day-week-year | day-week-quart-year | day-week-triad-year
                     | day-week-month-quart-year | day-week-month-year | day-week-moon-year
weekday             ::= weekday-in-quarter | weekday-in-month
weekday-in-quarter  ::= weekday-triad-year
weekday-in-month    ::= weekday-lunation-year | weekday-month-year
;
; Time 
;
time                       ::= hour-time | minute-time | second-time  ; time-marker is not mandatory
fraction-time              ::= [hour | hour-minute | hour-minute-second] part-of-time
hour-time                  ::= hour [part-of-time]?
minute-time                ::= hour-minute [part-of-time]?
second-time                ::= hour-minute-second [part-of-time]?
;hour-implied               ::= time-separator
hour-minute                ::= hour-minute-std | hour-minute-basic
std-hour-minute            ::= hour time-separator minute
basic-hour-minute          ::= hour null-separator minute
;hour-minute-implied        ::= implied-hour time-separator
hour-minute-second         ::= hour-minute-second-std | hour-minute-second-basic
hour-minute-second-std     ::= hour-minute-std time-separator second
hour-minute-second-basic   ::= hour-minute-basic null-separator second
timezone                   ::= UTC-marker | offset
offset                     ::= [plus | minus] [hour | hour-minute] 
;
;
; TO DO
; 
; Allow decimal time of day without ‘T’ prefix: “.5” and “,5” mean 12:00:00.  
; Allow decimal part with comma after century, year, week year, quart, triad, month, moon, week and, of course, day.  
; Furthermore, allow spreadsheet-compatible date-times with day-count from 1900-01-01 epoch and dot divider:
;
; Intervals, spans, periods, repetitions
;
; ‘Q’ is added for the 13|14-week quart, 3-month triads remain “3M”
; ‘F’ is added for the 30-day month (“30D”).
; ‘L’ is added for the lunar month (ca. 29.5 days). It should only be used with absolute start or end date.
;
repetition    ::= repetition-marker [number]? span-separator interval
interval      ::= datetime span-separator datetime 
               | datetime span-separator duration
               | duration span-separator datetime
               | duration
               = datetime span-separator [ datetime | duration ]
               | duration [ span-separator datetime ]?
duration      ::= duration-marker [ datetime | datetime-duration ]
datetime-duration ::= date-duration [time-marker time-duration]?
date-duration ::= [number year-unit]? [number [month-unit | week-unit]]? [number day-unit]? 
time-duration ::= [number hour-unit]? [number minute-unit]? [number second-unit]?
number        ::= [1-9] *DIGIT [part-of]?  ; are fractional parts allowed or just for one field?
;
; Alternate syntax
; optional
;
alt-datetime   ::= datetime | pair-datetime      ; [date-start datetime date-end]
pair-datetime  ::= date-start [integer-date [date-end date-start time]? | fraction-date] date-end]
;
alt-duration   ::= duration | pair-duration
pair-duration  ::= duration-start [ alt-datetime | datetime-duration ] duration-end
;
alt-interval   ::= interval | pair-interval
pair-interval  ::= interval-start alt-datetime interval-separator [ alt-datetime | alt-duration ]
                | alt-duration [ interval-separator alt-datetime ]? interval-end
;
alt-repetition ::= repetition | pair-repetition
pair-repetition::= [number]? repetition-start alt-interval repetition-end
; these do not yet handle the case where the markers are used in combination with parentheses or brackets
;
; other rules not fully implemented yet:
;
; When intervals are specified with start and end date and no duration,
; fields may be left out from the end date and are assumed to be the same as for the start date,
; e.g. 2012-09-10/11 is a two-day span.
; When start and end datetime in intervals are enclosed by '(' and ')',
; the separating slash may be replaced by a double hyphen ‘--’ or en dash ‘–’.
; The opening bracket is placed ''before'' the P marker if both are used.
; When the bracket notation is used, alternate symbols may be used for
; the year ‘a’, the month ‘mon’ and the minute ‘min’ and whitespace is permissable after symbols.
; The opening brace is placed ''after'' the R marker, the optional number of repetitions and then optional slash
;
; partial duration, uncertainty
; optional
;
field-start     ::= open-bracket
field-end       ::= close-bracket
field           ::= field-start field-list field-end
field-list      ::= field-value [semicolon field-value]*
field-value     ::= field-span | field-uncertain | field-item
field-span      ::= field-item interval-separator field-item
field-uncertain ::= field-item uncertain-separator field-item ; amount of uncertainty must be padded to the same length as usual field values, but may be zero, which is not yet handled, there is no way yet to specify deviation in one direction only (i.e. before/minus and after/plus)
field-item      ::= ;...
;
; Template
; optional
;
template-start     ::= comment-start
template-end       ::= comment-end
template-separator ::= slash
pattern-separator  ::= colon
template-field     ::= template-start template-ordinal [template-separator template-pattern]* template-end
template-ordinal   ::= field-value | template-wildcard              ; but no nested comment
template-pattern   ::= template-length [pattern-separator template-length]*
template-length    ::= [field-item || [leap-item-marker [number]?] || [intercalary-marker [number]?]]
;
; TERMINAL SYMBOLS
;
zero                ::= '0' | digit-wildcard
one                 ::= '1' | digit-wildcard
two                 ::= '2' | digit-wildcard
three               ::= '3' | digit-wildcard
four                ::= '4' | digit-wildcard
five                ::= '5' | digit-wildcard
six                 ::= '6' | digit-wildcard
seven               ::= '7' | digit-wildcard
eight               ::= '8' | digit-wildcard
nine                ::= '9' | digit-wildcard
plus                ::= '+'
minus               ::= '-' | '–' | '−' ; hyphen-minus, en-dash, minus sign
hyphen              ::= '--' | '–' | '‐' | '‑' | '­'; double hyphen, en-dash, hyphens
dash                ::= '-' | '–'       ; hyphen-minus, en-dash
plusminus           ::= '±';
slash               ::= '/'             ; solidus
comma               ::= ','
dot                 ::= '.'             ; period, full stop
colon               ::= ':'
semicolon           ::= ';'
tilde               ::= '~'
underscore          ::= '_'             ; low line
asterisk            ::= '*'             ; star
at                  ::= '@'
hash                ::= '#'
question            ::= '?'
ampersand           ::= '&'
equals              ::= '='
empty               ::= ''
space               ::= ' ' | \t | \n | \r | \f ; several types of whitespace
; Pairs
open-angle          ::= '<' | '‹'       ; angular bracket, guillemet
close-angle         ::= '>' | '›'
open-paren          ::= '('             ; round bracket, parentheses
close-paren         ::= ')'
open-bracket        ::= '['             ; square bracket
close-bracket       ::= ']'
open-brace          ::= '{'             ; curly bracket
close-brace         ::= '}'
; Letters, ASCII-case insensitive
A                   ::= 'A' | 'a'
B                   ::= 'B' | 'b'
C                   ::= 'C' | 'c'
D                   ::= 'D' | 'd'
E                   ::= 'E' | 'e'
F                   ::= 'F' | 'f'
G                   ::= 'G' | 'g'
H                   ::= 'H' | 'h'
I                   ::= 'I' | 'i' ; should not be used, because of confusion with one ‘1’
J                   ::= 'J' | 'j'
K                   ::= 'K' | 'k'
L                   ::= 'L' | 'l'
M                   ::= 'M' | 'm'
N                   ::= 'N' | 'n'
O                   ::= 'O' | 'o' ; should not be used, because of confusion with zero ‘0’
P                   ::= 'P' | 'p'
Q                   ::= 'Q' | 'q'
R                   ::= 'R' | 'r'
S                   ::= 'S' | 's'
T                   ::= 'T' | 't'
U                   ::= 'U' | 'u'
V                   ::= 'V' | 'v'
W                   ::= 'W' | 'w'
X                   ::= 'X' | 'x'
Y                   ::= 'Y' | 'y'
Z                   ::= 'Z' | 'z'
Advertisement