PEGs are by definition/design composable. Parsers are created by chaining
together the parslets... which are in turn really little parsers.

I would for example have a parser for sql. Then have a module that includes
that definition and defines a helper method 'sql' that returns an sql
parser as a parslet.

That would then be used by including the module in your upper level parser,
then using the you could define a rule for say "sql_string" using "quote
sql quote".

Does that make sense?

Cheers
Nigel
---
"No man is an island... except Phillip"


On 23 March 2012 22:04, Jason Garber <[email protected]> wrote:

> RedCloth-parslet on Github is probably way more complex than what you're
> looking for, but it is nonetheless an example of splitting up a big parser
> across files and calling other parsers from inside a parser.  Hope it helps
>
> Sent from my iPhone
>
> On Mar 23, 2012, at 12:10 AM, Pradeek J <[email protected]> wrote:
>
>  Hi, What is the recommended code structure for writing the parser? Almost
> all example parsers seem to be just one big class. Is there a recommended
> way of splitting it up into modular files? Thanks.
>
> - Pradeek
>
>

Reply via email to