Asciidoc syntax definition

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
34 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoc syntax definition

mojavelinux
Administrator

On Thu, Apr 2, 2015 at 11:35 AM, sdaschner [via Asciidoctor :: Discussion] <[hidden email]> wrote:
So a "native"-Java solution would be the best IMO.

Absolutely. Though, the original goal is getting from not having a formal grammar (esp for inline parsing) to having a formal grammar. Once we get that ironed out, I imagine it will spawn many efforts to parse that grammar in different environments (including a replacement of the inline parsing in Asciidoctor Ruby). By no means does this choice for the prototype lock us in to a particular runtime.

In addition to ANTLR, I like the idea of something in Groovy. Perhaps we can even use ANTLR from Groovy in the prototype. Groovy is a much easier language to use for prototyping than Java. At the very least, the tests should be in Groovy (perhaps using Spock).

If we decide to use a library based on Scala, we may still be able to use it from another JVM language like Groovy. Or, we'll learn Scala if necessary.

I'd say we should probably move forward with at least a project that has ANTLR setup and maybe we'll add other libraries as we go along. I can setup the project this weekend or next week. If someone wants to do it before them, please feel free to jump in. I'd like to have something that uses a Gradle build, ANTLR (to start) and a test suite with Spock. Sound like a plan?

Reply | Threaded
Open this post in threaded view
|

Re: Asciidoc syntax definition

sdaschner
mojavelinux wrote
Sound like a plan?
It does!
So when will the asciidoctor-grammar Github project roughly be online?
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoc syntax definition

mojavelinux
Administrator

On Thu, Apr 2, 2015 at 12:29 PM, sdaschner [via Asciidoctor :: Discussion] <[hidden email]> wrote:
So when will the asciidoctor-grammar Github project roughly be online?

I'll go ahead and setup the blank project today. Let's call it asciidoctor-grammar-prototype for now to reflect that its state.

Voila!


The next step will be for someone to send a pull request with the base project. If no one gets to it before the weekend, I'll try to get it done (in time for Devoxx France especially). We should probably start with a README that explains what this effort is about and our goals.

Cheers,

Reply | Threaded
Open this post in threaded view
|

Re: Asciidoc syntax definition

mojavelinux
Administrator
In reply to this post by sdaschner
FYI, there is now a lexer underway in the IntelliJ plugin that includes a grammar.


-Dan

On Thu, Apr 2, 2015 at 4:42 AM, Dan Allen <[hidden email]> wrote:

On Thu, Apr 2, 2015 at 12:29 PM, sdaschner [via Asciidoctor :: Discussion] <[hidden email]> wrote:
So when will the asciidoctor-grammar Github project roughly be online?

I'll go ahead and setup the blank project today. Let's call it asciidoctor-grammar-prototype for now to reflect that its state.

Voila!


The next step will be for someone to send a pull request with the base project. If no one gets to it before the weekend, I'll try to get it done (in time for Devoxx France especially). We should probably start with a README that explains what this effort is about and our goals.

Cheers,




--
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoc syntax definition

wolandscat
In reply to this post by sdaschner
+1
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoc syntax definition

sdaschner
What do you think is the best approach to move this forward?

As the Asciidoctor Grammar Github project has been setup, shouldn't this be the leading role for grammar definitions?

Also a small test example (with the Groovy / Spock-Framework) would be a good thing IMO; I started hacking on the Grammar project, but had issues testing the resulted ANTLR class :-(
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoc syntax definition

abelsromero
I too started hacking this a month ago but I was overwhelmed by the complexity of the grammar and antlr itself. Right now I'm reading "The definitive Antlr4 reference" and it helps a lot.

If you want some examples, I "polished" the project and create a POC grammar, a helper class for testing and a simple spock test in my repo: https://github.com/abelsromero/asciidoc-grammar-prototype/tree/master/src/test

Hope it helps, and feel free to copy any code you like.
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoc syntax definition

asotobu
Wow Abel, this is a really awesome effort to make this grammar a reality. Maybe we could move this to official repo as standard point.
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoc syntax definition

sdaschner
Cool, your AntlrParser util is exactly what I've been looking for :-)

Thanks Abel!
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoc syntax definition

abelsromero
Glad it helps.

Also there's a task in the gradle.build to download  README AsciiDoc files form GitHub for testing, check 'downloadMultipleFiles '.
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoc syntax definition

mojavelinux
Administrator
Please feel free to move forward with this work by moving it into the upstream (via a PR). Since there's nothing there yet, there's no concern of clashing with an existing effort. What's important is that we start making incremental progress on this so that we can start to get into the conversations about what makes AsciiDoc more parsable. I'll be happy to jump in and lend a hand and review.

Cheers,

-Dan

On Thu, Jul 30, 2015 at 3:39 AM, abelsromero [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Glad it helps.

Also there's a task in the gradle.build to download  README AsciiDoc files form GitHub for testing, check 'downloadMultipleFiles '.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Asciidoc-syntax-definition-tp1920p3588.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoc syntax definition

abelsromero
The PR is in place https://github.com/asciidoctor/asciidoc-grammar-prototype/pull/4.

Who has permissions to merge on this repo?
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoc syntax definition

mojavelinux
Administrator
Thanks Abel! I've given you and Jakub admin access, so merge at will.

Cheers,

-Dan

On Mon, Aug 3, 2015 at 1:08 AM, abelsromero [via Asciidoctor :: Discussion] <[hidden email]> wrote:
The PR is in place https://github.com/asciidoctor/asciidoc-grammar-prototype/pull/4.

Who has permissions to merge on this repo?


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Asciidoc-syntax-definition-tp1920p3608.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoc syntax definition

vperi
In reply to this post by mojavelinux
Is an Antlr parser still under consideration?

Here's a take on a parser that uses multiple lexer modes to break down the complexity (just does title/author/attributes, no preamble, section 1 /title paragraphs --- a proof of concept). https://github.com/venkatperi/asciidoc-antlr

Clone the project and run:

$ git clone https://github.com/venkatperi/asciidoc-antlr
$ cd asciidoc-antlr
$ ./gradlew testRig #build and run the test rigger on the sample asciidoc
12