modularity in parboiled

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

modularity in parboiled

Mark Butler
Hi Mathias,

We finished our DSL a while ago and we have now migrated from the JSON format we were using to the DSL. We are very happy with the result as it made the DSL representation much simpler.

We started off using XText but I switched to Parboiled because I wanted a Python like indentation grammar, but this is not straightforward in XText. Once I had made the switch, I really appreciated the way Parboiled avoids code generation, as it simplifies the development cycle.

I have been working with examples from Debasish Ghosh's "DSLs in Action" (Manning). It is unfortunate the book does not mention Parboiled as it is a very useful tool.

The only thing I miss about the JSON DSL is because of the way we were using GSON - we had a top level map which we could add language components to - it was highly modular so we could easily add new constructs to the language. With Parboiled, we just have a single monolithic parser - although I note this is true with other comparable solutions.

Is there any way of making the parser modular?

I am working with Parboiled using Java, so maybe the situation with different with Scala?

Thanks again,

Mark

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: modularity in parboiled

mathias
Administrator
Mark,

> Is there any way of making the parser modular?

yes, you should have no problem in spreading out your rules across several composed parsers or across a class hierarchy.

You can find an example for parser composition in this test:
https://github.com/sirthias/parboiled/blob/master/parboiled-java/src/test/java/org/parboiled/SplitParserTest.java

and an example for distributing rules across a parser class hierarchy in this test:
https://github.com/sirthias/parboiled/blob/master/parboiled-java/src/test/java/org/parboiled/ParserInheritanceTest.java

HTH and cheers,
Mathias

---
[hidden email]
http://www.parboiled.org

On 05.06.2013, at 10:14, Mark Butler [via parboiled users] <[hidden email]> wrote:

>
>
> Hi Mathias,
>
> We finished our DSL a while ago and we have now migrated from the JSON
> format we were using to the DSL. We are very happy with the result as it
> made the DSL representation much simpler.
>
> We started off using XText but I switched to Parboiled because I wanted a
> Python like indentation grammar, but this is not straightforward in XText.
> Once I had made the switch, I really appreciated the way Parboiled avoids
> code generation, as it simplifies the development cycle.
>
> I have been working with examples from Debasish Ghosh's "DSLs in Action"
> (Manning). It is unfortunate the book does not mention Parboiled as it is a
> very useful tool.
>
> The only thing I miss about the JSON DSL is because of the way we were using
> GSON - we had a top level map which we could add language components to - it
> was highly modular so we could easily add new constructs to the language.
> With Parboiled, we just have a single monolithic parser - although I note
> this is true with other comparable solutions.
>
> Is there any way of making the parser modular?
>
> I am working with Parboiled using Java, so maybe the situation with
> different with Scala?
>
> Thanks again,
>
> Mark
>
>
>
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://users.parboiled.org/modularity-in-parboiled-tp4024204.html
> To start a new topic under parboiled users, email [hidden email]
> To unsubscribe from parboiled users, visit
Loading...