8

On this site I've found some solutions how to typeset Backus-Naur-Forms, e.g.:

Unfortunately both solution are very uncomfortable for use with Extended Backus-Naur-Form. That especially includes [ optional ] and { some more } constructions which were added.

I wonder if there is a package that enables me to typeset EBNF with the following requirements:

  • logic markup (nonterminal and terminal symbols, terminal descriptions),
  • automated line-break (and something like hanging with indentation instead of | f.i. [because | is used for or])
  • numbered and unnumbered production rules
  • (optional) hyperref support for jumping to nonterminal definitions

Question: Is there a package that is able to do that? If not, how should I start implementing (list, paragraphs, ...)?

A dummy document (what I think it could look like):

\documentclass{article}
\begin{document}
\begin{ebnf}
\prodrule{nonterm} \nonterm{thing} [ \term{option} ] \{ \termdesc{something} \} | \nonterm{variable}
\prodrule{thing} \term{object}
\prodrule{variable} \termdesc{anything}
\end{ebnf}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.