GuntherRademacher / ebnf-convert

Grammar Converter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ebnf-convert - Grammar Converter

This is a tool for converting various forms of BNF and EBNF grammars to W3C-style EBNF, which is the notation that is used primarily in the XML and XQuery recommendations. It is useful for creating syntax diagrams using the RR tool, as well as for generating parsers with REx Parser Generator.

Input grammars are accepted in these notations:

Besides converting these grammar notations, ebnf-convert can also perform some grammar transformation, e.g. factorization and elimination of direct recursion. To some extent this transforms BNF to EBNF, yielding more compact diagrams.

ebnf-convert has a simple browser UI as well as a command line interface for batch execution.

Distribution

ebnf-convert comes as a .zip, containing a .war file. The .war file can be deployed in servlet containers like Tomcat or Jetty for serving the browser UI. This makes up the webapp that is running on the original website, https://www.bottlecaps.de/ebnf-convert (note: IPv6 only).

The .war file is a Java "executable war", i.e. it can also be started standalone from command line:

Usage: java -jar ebnf-convert.war [-xml|-f FACTORING|-r KIND|-noinline|-noepsilon|-v]... GRAMMAR

  -xml             create output grammar in XML, rather than EBNF
  -f FACTORING     apply factoring (any of "full-left" (default), "left-only", "full-right", "right-only", or "none")
  -r KIND          remove direct recursion, where KIND is any of "full" (default), "left", "right", or "none"
  -noinline        do not inline nonterminals that derive to a single string literal
  -noepsilon       do not keep nonterminal referemces, that derive to epsilon only
  -v               verbose output

  GRAMMAR          path of foreign grammar

Building ebnf-convert

For building ebnf-convert, JDK 11 (or higher) must be available. In the project folder, run this command to build the distribution .zip file in the build/distributions folder:

gradlew

Installation

Some platforms may have packages available, find out about that on Repology.

Thanks

This project makes use of

License

Copyright (c) 2011-2024 Gunther Rademacher. ebnf-convert is provided under the Apache 2 License.

Links

The official website for ebnf-convert is https://www.bottlecaps.de/ebnf-convert (note: IPv6 only).

About

Grammar Converter

License:Apache License 2.0


Languages

Language:XSLT 44.3%Language:XQuery 34.4%Language:Java 21.3%