Name

cx:ebnf-convert — Converts other EBNF notations to W3C EBNF.

Synopsis

The cx:ebnf-convert step is a wrapper around Gunther Rademacher’s grammar converter.

Input portPrimarySequenceContent types
source✔  text 
Output portPrimarySequenceContent types
result✔  xml text 
Option nameTypeValuesDefault value
epsilon-referencesxs:boolean false()
factoringxs:string('full-left', 'left-only', 'full-right', 'right-only', 'none') 'full-left'
inline-terminalsxs:boolean true()
notationxs:string?('abnf', 'antlr_3', 'antlr_4', 'bison', 'gold', 'instaparse', 'ixml', 'javacc', 'jison', 'pegjs', 'phythia', 'pss', 'rex_5_9', 'w3c', 'xtext') ()
remove-recursionxs:string('full', 'left', 'right', 'none') 'full'
timestampxs:boolean true()
verbosexs:boolean false()
xmlxs:boolean false()
This is an extension step; to use it, your pipeline must include its declaration. For example, by including the extension library with an import at the top of your pipeline:
<p:import href="https://xmlcalabash.com/ext/library/ebnf-convert.xpl"/>
Declaration
 1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc">
   |   <p:input port="source" content-types="text"/>
   |   <p:output port="result" content-types="xml text"/>
   |   <p:option name="factoring"
 5 |             as="xs:string"
   |             select="'full-left'"
   |             values="('full-left', 'left-only', 'full-right', 'right-only', 'none')"/>
   |   <p:option name="remove-recursion"
   |             as="xs:string"
10 |             select="'full'"
   |             values="('full', 'left', 'right', 'none')"/>
   |   <p:option name="inline-terminals" as="xs:boolean" select="true()"/>
   |   <p:option name="epsilon-references" as="xs:boolean" select="false()"/>
   |   <p:option name="notation"
15 |             as="xs:string?"
   |             values="('abnf', 'antlr_3', 'antlr_4', 'bison', 'gold', 'instaparse', 'ixml',                      'javacc', 'jison', 'pegjs', 'phythia', 'pss', 'rex_5_9', 'w3c', 'xtext')"/>
   |   <p:option name="xml" as="xs:boolean" select="false()"/>
   |   <p:option name="verbose" as="xs:boolean" select="false()"/>
   |   <p:option name="timestamp" as="xs:boolean" select="true()"/>
20 |</p:declare-step>
Errors
CodeDescription
cxerr:XC0022It is a dynamic error (cxerr:XC0022) if the grammar conversion fails.

Description

There are wide variety of different EBNF notations. This step converts many of them to the EBNF notation defined by the W3C. This notation is used in the XML specification, in the XPath and XQuery family of specifications, and, perhaps most significantly in this context, by the cx:railroad step to make railroad diagrams.

The input notations are:

The notations phythia, pss, and rex_5_9 are legacy formats.

It is a dynamic error (cxerr:XC0022) if the grammar conversion fails.

This conversion process is also available implicitly in the cx:railroad step.

Dependencies

This step is included in the XML Calabash application. If you are getting XML Calabash from Maven, you will also need to include the extension dependency:

  • com.xmlcalabash:ebnf-convert:3.0.0-alpha24

The following third-party dependencies will also be included transitively:

  • de.bottlecaps.ebnf-convert:ebnf-convert-lib:0.70