\section{Gramática ChronL}\label{gramatica}

A gramática é definida por um quadrúpulo G = (T\footnote{Optou-se por
definir nesta lista apenas os não-terminais que não estivessem definidos
nas produções. Optou-se também por defini-los usando expressões regulares
de \ac{Perl}.}, N, S, P), em que:

S = ChronL

N = \{ ChronL, Chrono, Id, Event, Date, Date1, Date2, Date3, Sepdt,
Sepdate, Approx, Era, Metadata, Metainfo, Class, Ref, Url, Idref,
Description, Line, Text1, Text, Format \}

\begin{longtable}{lcrcl}
T = & \{ & name      & = & \verb+/[\w\t\/\.()"'<> -]*\w/+ \\
    &  , & nl        & = & \verb|\n\| \\
    &  , & word      & = & \verb|/\w+/| \\
    &  , & number4   & = & \verb+/\d{4}/+ \\
    &  , & number2   & = & \verb+/\d{1,2}/+ \\
    &  , & path      & = & \verb|/[\w~\.\/=&-]+/| \\
    &  , & text      & = & \verb|/[^\n\t ]+/| \\
    &  , & text-str  & = & \verb|/(?:\\\*[^\n*])+/| \\
    &  , & text-emph & = & \verb!/(?:\\\*|[^\n*])+/! \\
    & \} & & &
\end{longtable}

\begin{longtable}{lcrcl}
P = & \{ & ChronL      & $\rightarrow$ & Chrono Chrono* \\
&&&&\\
    &  , & Chrono      & $\rightarrow$ & '>>' name Id nl Metadata* Event* \\
&&&&\\
    &  , & Id          & $\rightarrow$ & '\{' word '\}' \\
    &  , &             &             | & $\epsilon$\\
&&&&\\
    &  , & Event       & $\rightarrow$ & Date Date? name? Id nl Metadata* Description\\
&&&&\\
    &  , & Date        & $\rightarrow$ & '[' Approx Era number4 Date1 ']'\\
    &  , & Date1       & $\rightarrow$ & Sepdate number2 Date2\\
    &  , &             &             | & $\epsilon$\\
    &  , & Date2       & $\rightarrow$ & Sepdate number2 Date3\\
    &  , &             &             | & $\epsilon$\\
    &  , & Date3       & $\rightarrow$ & Sepdt number2 ':' number2\\
    &    &             &             | & $\epsilon$\\
&&&&\\
    &  , & Sepdt       & $\rightarrow$ & 'T'\\
    &  , &             &             | & $\epsilon$\\
    &  , & Sepdate     & $\rightarrow$ & '-'\\
    &  , &             &             | & ':'\\
    &  , &             &             | & '/'\\
    &  , & Approx      & $\rightarrow$ & '~'\\
    &  , &             &             | & $\epsilon$\\
    &  , & Era         & $\rightarrow$ & 'BC'\\
    &  , &             &             | & $\epsilon$\\
&&&&\\
    &  , & Metadata    & $\rightarrow$ & '!!' Metainfo nl\\
    &  , & Metainfo    & $\rightarrow$ & 'keyword' ':' name+ nl\\
    &  , &             &             | & 'author' ':' name+ nl\\
    &  , &             &             | & 'lang' ':' word nl\\
    &  , &             &             | & 'local' ':' name nl\\
    &  , &             &             | & 'ref' ':' Ref+ nl\\
    &  , &             &             | & 'isa' ':' Class+ nl\\
&&&&\\
    &  , & Class       & $\rightarrow$ & '[' name '|' name ']'\\
    &  , & Ref         & $\rightarrow$ & '[' name '|' (Url | Idref) ']'\\
    &  , & Url         & $\rightarrow$ & 'http://' path\\
    &  , &             &             | & 'ftp://' path\\
    &  , &             &             | & 'img://' path\\
    &  , &             &             | & 'file://' path\\
    &  , & Idref       & $\rightarrow$ & '\{' word (':' word)? '\}'\\
&&&&\\
    &  , & Description & $\rightarrow$ & Line Line*\\
    &  , & Line        & $\rightarrow$ & nl\\
    &  , &             &             | & Text1 Text nl\\
    &  , & Text1       & $\rightarrow$ & Format\\
    &  , &             &             | & text1\\
    &  , & Text        & $\rightarrow$ & Format\\
    &  , &             &             | & text\\
    &  , & Format      & $\rightarrow$ & '**' text-str '**'\\
    &  , &             &             | & '*' text-emp '*'\\
    &  , &             &             | & Ref\\
    &  , &             &             | & Class\\
    & \} &&&
\end{longtable}
