Skip to content

Feature Request: Composing Grammars #18

Description

@quad

Context: I'm porting an existing handwritten parser to use parsus.

Right now, parsus is built on the presumption that a Grammar is complete. It would be helpful if Grammars could be composed.

Because it doesn't support this natively, I've resorted to this hack:

internal abstract class C<T> : Grammar<T>() {
   // ... grammar
}

val extendedGrammar = object : C<Expression>() {
    // Additional grammar
    override val root by parser_in_C_class
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions