Re: Asciidoc syntax definition
Posted by
jirutka on
Apr 01, 2015; 7:29pm
URL: https://discuss.asciidoctor.org/Asciidoc-syntax-definition-tp1920p2924.html
I know Parboiled quite well. I wrote some extensions for Markdown parser written on top of Parboiled and also wrote some little grammar/parser of mine in it. Before that I wrote two grammar/parsers (see
RSQL) in
JavaCC, another classic parser generator. Parboiled was much simpler to use than JavaCC. By the way, another benefit of PEG is extensibility, users can write plugins extending the parser.
The problem is that
Parboiled is a legacy project that isn’t under active development anymore. Sirthias (author of Parboiled) concluded that Java is very unsuitable for this, so he’s currently working on
Parboiled 2 that is written entirely in Scala.
Java really isn’t a good choice for writing parser, it’ll be better to use Groovy, Scala or any other language that runs on JVM and provide only Java facade.
I think that the most universal would be JavaScript. It runs in a web browser (needed for live preview), on a server (node.js / io.js) and also in JVM (Nashorn, JS engine in Java 8, is quite good as I heard).
We should also consider implementation in some low-level language, to get small binary library usable as Ruby/Python/whatever native extension. I think that Rust is currently the best choice for that. There’s a promising project
rust-peg.