\documentclass[a4paper]{article}
\usepackage[danish]{babel}
\usepackage{bnf}

\begin{document}

\begin{grammar}
[(colon){$\rightarrow\ $}]
[(semicolon){\hspace{-7pt}$|$}]
[(comma){}]
[(period){{\\[1ex]\mbox{}\hspace{-2em}}}]
[(quote){\begin{bf}$\;$}{\end{bf}}]
[(nonterminal){$\langle$}{$\rangle$}]

\vspace{-4ex}\mbox{}.
<program>:\\
    "program" "id" ";" <decls> <subprog\_decls> <comp> ".".
<decls>:\\
    "var" <var\_decls>\\
    ;"\boldmath$\epsilon$\unboldmath".
<var\_decls>:\\
    "id" <id\_list>\\
    ;"id" <id\_list> <var\_decls>.
<id\_list>:\\
    "," "id" <id\_list>\\
    ;":" <type> ";".
<type>:\\
    "integer"\\
    ;"boolean".
<subprog\_decls>:\\
    <subprog\_decls> <subprog\_decl>\\
    ;"\boldmath$\epsilon$\unboldmath".
<subprog\_decl>:\\
    <subprog\_head> <decls> <subprog\_decls> <comp> ";".
<subprog\_head>:\\
    "function" "id" "(" <formals> ")" ":" <type> ";"\\
    ;"procedure" "id" "(" <formals> ")" ";".
<formals>:\\
    <formal\_parms>\\
    ;"\boldmath$\epsilon$\unboldmath".
<formal\_parms>:\\
    <param\_spec>\\
    ;<param\_spec> "," <formal\_parms>.
<param\_spec>:\\
    <const\_param>\\
    ;"var" <var\_param>\\
    ;"function" <func\_param>\\
    ;"procedure" <proc\_param>.
<const\_param>:\\
    "id" <const\_id\_list>.
<const\_id\_list>:\\
    "," "id" <const\_id\_list>\\
    ;":" <type> ";".
<var\_param>:\\
    "id" <var\_id\_list>.
<var\_id\_list>:\\
    "," "id" <var\_id\_list>\\
    ;":" <type> ";".
<func\_param>:\\
    "id" <func\_id\_list>.
<func\_id\_list>:\\
    "," "id" <func\_id\_list>\\
    ;":" <type> ";".
<proc\_param>:\\
    "id" <proc\_id\_list>.
<proc\_id\_list>:\\
    "," "id" <id\_list>\\
    ;"\boldmath$\epsilon$\unboldmath".
<comp>:\\
    "begin" <stat\_list> "end".
<stat\_list>:\\
    <statement>\\
    ;<stat\_list> ";" <statement>.
<statement>:\\
    "id" "\boldmath$:=$\unboldmath" <expr>\\
    ;<proc\_stat>\\
    ;<comp>\\
    ;"if" <expr> "then" <statement> "else" <statement>\\
    ;"if" <expr> "then" <statement>\\
    ;"while" <expr> "do" <statement>\\
    ;"\boldmath$\epsilon$\unboldmath".
<proc\_stat>:\\
    "id" "(" <actuals> ")".
<actuals>:\\
    <expr\_list>\\
    ;"\boldmath$\epsilon$\unboldmath".
<expr\_list>:\\
    <expr>\\
    ;<expr\_list> "," <expr>.
<expr>:\\
    <simple\_expr>\\
    ;<simple\_expr> <relop> <simple\_expr>.
<relop>:\\
    "\boldmath$=$\unboldmath"\\
    ;"\boldmath$<>$\unboldmath"\\
    ;"\boldmath$<$\unboldmath"\\
    ;"\boldmath$\le$\unboldmath"\\
    ;"\boldmath$\ge$\unboldmath"\\
    ;"\boldmath$>$\unboldmath".
<simple\_expr>:\\
    <term>\\
    ;<simple\_expr> <combi\_addop> <term>.
<combi\_addop>:\\
    <addop>\\
    ;"\boldmath$-$\unboldmath".
<addop>:\\
    "or"\\
    ;"\boldmath$+$\unboldmath".
<term>:\\
    <factor>\\
    ;<term> <mulop> <factor>.
<mulop>:\\
    "and"\\
    "\boldmath$*$\unboldmath"\\
    "\boldmath$/$\unboldmath".
<factor>:\\
    "id"\\
    ;"id" "(" <actuals> ")"\\
    ;"(" <expr> ")"\\
    ;"\boldmath$-$\unboldmath" <factor>\\
    ;"not" <factor>\\
    ;"num"\\
    ;"true"\\
    ;"false".
\end{grammar}

\end{document}
