Support for inheritance? #38

Open
blambeau opened this Issue Jan 13, 2012 · 0 comments

Projects

None yet

1 participant

@blambeau
Collaborator

Hi,

I'd like to write an abstract grammar with two concrete instantiations and I expected Citrus to mimic ruby inheritance for this (I guess that Treetop does, btw). Unfortunately, the following example does not work:

grammar WithPar
  rule function
    /[a-z]/+ parens
  end
  rule parens '()' end
end

grammar WithBrack
  include WithPar
  root function
  rule parens '{}' end
end

I would expect the following to work, but it's not the case (see https://gist.github.com/1606092)

WithPar.parse "hello()"
WithBrack.parse "hello{}"

Is there a way to do this in Citrus?

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