
sawine@55: %-----cut here with a sharp machete or an 19.95 ginsu knife
sawine@55: %************************************************************************
sawine@55: %* BNF.tex								*
sawine@55: %* 									*
sawine@55: %* plain tex macros for formatting grammars				*
sawine@55: %*									*
sawine@55: %* Erik Quanstrom 							*
sawine@55: %* 10. November 1990							*
sawine@55: %************************************************************************
sawine@55: 
sawine@55: %things to fix:
sawine@55: %	make configurable
sawine@55: %	work with texinfo
sawine@55: 
sawine@55: \gdef\actifygrammarchars{%
sawine@55: 	\catcode`\>\active%
sawine@55: 	\catcode`\<\active%
sawine@55: 	\catcode`\:\active%
sawine@55: 	\catcode`\"\active%
sawine@55: 	\catcode`\;\active%
sawine@55: 	\catcode`\.\active%
sawine@55: 	\catcode`\|\active%
sawine@55: 	\catcode`\,\active}
sawine@55: 
sawine@55: \gdef\deactifygrammarchars{%
sawine@55: 	\catcode`\>12%
sawine@55: 	\catcode`\<12%
sawine@55: 	\catcode`\:12%
sawine@55: 	\catcode`\;12%
sawine@55: 	\catcode`\.12%
sawine@55: 	\catcode`\|12%
sawine@55: 	\catcode`\,12}
sawine@55: 
sawine@55: \newif\ifquote
sawine@55: \quotefalse
sawine@55: 
sawine@55: \begingroup
sawine@55:    \actifygrammarchars
sawine@55:    \gdef>{\/\endgroup$\rangle$\relax}
sawine@55:    \gdef<{$\langle$\begingroup\sl}
sawine@55:    \gdef:{$\rightarrow$}
sawine@55: 
sawine@55:    \begingroup
sawine@55: 	\catcode`\"\active
sawine@55: 	\gdef"{\ifquote%
sawine@55: 		'\endgroup\quotefalse%
sawine@55: 	   \else%
sawine@55: 		\quotetrue\begingroup\deactifygrammarchars\bf`%
sawine@55: 	\fi}%
sawine@55:    \endgroup
sawine@55: 
sawine@55:    \gdef;{\hfill\break}
sawine@55:    \gdef.{\relax}
sawine@55:    \gdef|{$\vert$}
sawine@55:    \gdef,{;\hbox to 1cm{\hfill}}
sawine@55: \endgroup
sawine@55: 
sawine@55: \def\begingrammar{%
sawine@55: 	\begingroup
sawine@55: 	\advance\leftskip by 1cm%
sawine@55: 	\parindent=-1cm%
sawine@55: 	\actifygrammarchars%
sawine@55: 	\def\endgrammar{\endgroup}
sawine@55: 	\parskip 1ex%
sawine@55: 	\relax
sawine@55: }
sawine@55: 
sawine@55: %
sawine@55: %
sawine@55: %
sawine@55: \def\ul{\lower .2ex\hbox to 1ex{\hrulefill}\relax}%
sawine@55: 




