-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrammar.sty
41 lines (26 loc) · 970 Bytes
/
grammar.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
%%% Grammar macros for LaTeX. Use with latexify.py.
%%%
\typeout{*** Grammar.sty version 1.0, variant for pygramm ***}
\newcommand{\nonterminal}[1]{\ensuremath{\langle\mbox{\it #1}\rangle}}
\newcommand{\terminal}[1]{\mbox{\em #1}}
\newcommand{\literal}[1]{\fbox{\tt #1}}
\newcommand{\kleene}[1]{\mbox{$\lbrace$\mbox{#1}$\rbrace$}}
\newcommand{\optional}[1]{{[\,{#1}\,]}}
\newcommand{\OR}{\mbox{ $\mid\ $}}
\newcommand{\becomes}{\ensuremath{ \ ::= \ }\hfil}
% \newcommand{\derives}{\ensuremath{\stackrel{\ast}{\Rightarrow}}}
\newenvironment{grammar}{
\renewcommand{\arraystretch}{1.5}
\noindent
\begin{tabular}{l@{~\ensuremath{::=}~}p{4in}}}{
\end{tabular}\\
}
\newenvironment{testgrammar}{
\renewcommand{\arraystretch}{1.5}
\noindent
\begin{tabular}{ll@{~\ensuremath{::=}~}p{4in}}}{
\end{tabular}\\
}
% \newcommand{\prodlabel}[1]{\textsf{\small #1} }
% \newcommand{\action}[1]{\multicolumn{2}{p{5in}}{~~~$\{$ #1 $\}$}}
\typeout{*** End grammar.sty ***}