\input basic
\input synchart
\font K←CMSS8

% TIPSyntax.TEX
\hbox to size
{Syntax Diagram for TIP Tables \hfil        Werner Winiger 30-Sep-81 11:53:08


}
{\SyntaxChart

\parindent 0pt

% \def\LeftArrow{\vrule height 0.5vu depth 0.5vu width 2.5vu}
% \def\RightArrow{\vrule height 0.5vu depth 0.5vu width 2.5vu}
% \def\ArrowLine{\vrule height 0.5vu depth 0.5vu width 2.5vu}
% \def\NoArrows{\def\LeftArrow{}\def\RightArrow{}\def\ArrowLine{}}

% \T{<char>} yields a circular terminal node with the character
% aesthetically placed, assuming CMTT8 is used. The 4.5417pt is the
% height of plus and minus, and 4.2pt is the character width.
% Colons and periods should be followed by a \CommaStrut to make
% them line up with semicolons and commas.  For parens, brackets,
% and braces, put an extra \hss on the outer side to center them better.
% This macro may be used for multi-character terminal symbols, but
% \KW should be used for keywords. 
\def\T#1{\Terminal
	 {\vbox to 4.5417pt{\vss\hbox expand -4.2pt{\hss#1\hss}\vss\vfilneg}}}

\def\CommaStrut{\save0\hbox{,}\lower 1dp0\null}

\def\KW#1{\Terminal{\:K \hskip-2pt#1\Strut\hskip-2pt}} % Use this for keywords.

\def\N{\Nonterminal} % just an abbreviation.

\def\Optional#1{\Alternatives{\Middle{#1}\Lower{\Empty}}}
\def\Rept#1{\Repeat{\Upper{\BigLeftArrow}\Middle{#1}}}
\def\Star#1{\Repeat{\Upper{#1}\Middle{\Empty}}}
\def\LongStar#1{\Optional{\Rept{#1}}}
\def\TwoAlts[#1|#2]{\Alternatives
	{\Upper{\TrimBot{#1}}\Lower{\TrimTop{#2}}}}
\def\RAW#1#2{\Repeat{\Upper{#1}\Middle{#2}}} % Repeat Above With
\def\RBW#1#2{\Repeat{\Middle{#2}\Lower{#1}}} % Repeat Below With
\def\\{\Fil}
\def\-{\QQLine}

\def\semicolon{\T{;}}
\def\comma{\T{,}}
\def\colon{\T{:}}
\def\rightarow{\T{=>}}
\def\greater{\T{>}}
\def\period{\T{.}}


\def\Expression{
\RAW{\Empty}{\Alternatives
     {\Upper{\KW{AND}\\\N{TriggerTerm}}
      \Middle{\KW{WHILE}\\\N{EnableTerm}}
      \Lower{\rightarow\\\N{Statement}}}}
}

\def\ResultList
{\Alternatives
     {\Middle{\N{ResultName}}
      \Lower{\N{Number}}
      \Lower{\N{String}}
      \Lower{\KW{Char}}
      \Lower{\KW{Coords}}}
}

\def\Key
{\N{KeyIdent}\TwoAlts[\KW{Up}|\KW{Down}]
}

\def\Action
{\Alternatives
     {\Middle{\Key}
      \Lower{\KW{Mouse}}}
}

\def\State
{\Alternatives
     {\Middle{\Key}
      \Lower{\N{PredicatIdent}}}
}

\def\TimeOut
{\Alternatives
     {\Upper{\KW{BEFORE}\\\N{Number}}
      \Middle{\Empty}
      \Lower{\KW{AFTER}\\\N{Number}}}
}

\noindent
\hbox expand 50pt{
\Define{TIPTable}
\N{Options}\\
\N{TriggerStmt}
\EndDef}
\par

\noindent
\hbox expand 50pt{
\Define{Options}
\Optional
     {\KW{OPTIONS}\\
      \Alternatives
           {\Middle{\TwoAlts[\KW{Small}|\KW{Fast}]\\
		    \Optional{\comma\\\N{Keys}}}
            \Lower{\N{Keys}}}}
\Fil\EndDef}
\par

\noindent
\hbox expand 50pt{
\Define{Keys}
\TwoAlts[\KW{PrintKeys}|\KW{DefaultKeys}]
\Fil\EndDef}
\par

\noindent
\hbox to size{
\Define{TriggerStmt}
{\def\ArrowLine{\Empty}
\KW{SELECT}
\KW{TRIGGER}
}
\KW{FROM}
\RAW{\semicolon}{\N{TriggerChoice}}
\KW{ENDCASE}
\Optional{\N{FinalChoice}}
\Fil\EndDef}
\par

\noindent
\hbox to size{
\Define{EnableStmt}
{\def\ArrowLine{\Empty}
\KW{SELECT}
\KW{ENABLE}
}
\KW{FROM}
\RAW{\semicolon}{\N{EnableChoice}}
\KW{ENDCASE}
\Optional{\N{FinalChoice}}
\Fil\EndDef}
\par

\noindent
\hbox expand 50pt{
\Define{TriggerChoice}
\N{TriggerTerm}
\N{Expression}
\Fil\EndDef}
\par

\noindent
\hbox expand 50pt{
\Define{EnableChoice}
\N{EnableTerm}
\N{Expression}
\Fil\EndDef}
\par

\noindent
\hbox expand 50pt{
\Define{Expression}
\Expression
\Fil\EndDef}
\par

\noindent
\hbox expand 50pt{
\Define{FinalChoice}
\rightarow\\
\N{Statement}
\Fil\EndDef}
\par

\noindent
\hbox expand 50pt{
\Define{Statement}
\Alternatives
     {\Upper{\N{TriggerStmt}}
      \Middle{\N{EnableStmt}}
      \Lower{\N{Results}}}\\
\Fil\EndDef}
\par

\noindent
\hbox expand 50pt{
\Define{TriggerTerm}
\Action\\
\TimeOut\\
\Fil\EndDef}
\par

\noindent
\hbox expand 50pt{
\Define{EnableTerm}
\State\\
\Fil\EndDef}
\par

\noindent
\hbox expand 50pt{
\Define{Results}
\RAW{\comma}{\ResultList}
\Fil\EndDef}
\par

}
\vfil\end