-
-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple inheritance (and foreign rule invocation) #201
Comments
Hi Philipp, That's correct, we don't currently support multiple inheritance. In the past, we have discussed supporting something like mixins or traits (http://scg.unibe.ch/archive/phd/schaerli-phd.pdf), but there is still some debate as to whether the added complexity would be worth it. If you want to experiment with this, I'd suggest first focusing on manipulating the grammar objects themselves. Specifically, take a look at the If you look at the definition of As a next step, you might propose an API / internal DSL that would expose the feature and let people try it out. If you can figure out a sensible semantics (and have a few compelling examples to convince everyone that it's worth implementing) the final step would be to implement the syntax. But I think you can make a lot of progress on the problem without worry about syntax just yet. Hope that helps, and let me know if you have any more questions. |
Thank you, Patrick, this is really helpful. I will give it a try and let you know if/when I achieved something presentable. |
Great, sounds good! Feel free to share your in progress work too. I'm definitely interested in this and would be happy to discuss things even if you haven't worked all the kinks out. |
Hi Philip (and Pat),
As you said, multiple inheritance introduces a bunch of problems... what to
do about rule name clashes, for example.
In OMeta, I was able to get the benefits of multiple inheritance without
the associated problems by introducing a mechanism called "foreign rule
invocation" -- see Sec. 2.3.4 of my dissertation
<http://web.cs.ucla.edu/~todd/theses/warth_dissertation.pdf>. I think it
would be interesting to explore what *that* might be like in Ohm, rather
than MI. There are still some things that you'd have to work out (e.g., how
to specify semantic actions for rules from different grammars that have the
same name) but I think it's very doable, and I'd expect it to be a much
better fit for Ohm...
I'd be happy to provide some guidance if you're interested in pushing in
this direction. Let me know :)
Cheers,
Alex
…On Mon, May 8, 2017 at 6:49 AM, Patrick Dubroy ***@***.***> wrote:
Great, sounds good! Feel free to share your in progress work too. I'm
definitely interested in this and would be happy to discuss things even if
you haven't worked all the kinks out.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#201 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAPHi7scrpFIgA2jcwTXWsz-6DG7s4XQks5r3x16gaJpZM4NTw12>
.
|
Hi Alex, Thanks for the reference! I found some time to play with the foreign rule invocation mechanism of OMeta and have a question. Let's assume I have two subclasses of the OMeta JSParser which both extend My current approach looks like this:
If the new syntax constructs are in different expressions (e.g., if there are within different functions), the parser succeeds, but if the new constructs are in the same expression it fails. I can see why it fails (I assume, since the input is "forwarded" to one parser at a time and the By the way, my long-term goal is to research mechanisms for handling conficts which can arise in these kind of compositions of modular extensions. Cheers, |
Closing this issue for housekeeping purposes, since I don't think we will be implementing multiple inheritance anytime soon. |
Tracking the feature request for foreign rule invocation in #191. |
Hello,
As far as I understand, Ohm does not support multiple inheritance for extending grammars, right? I might be working on this within the scope of my master's thesis and would appreciate some pointers.
Maybe you can tell me, if there was already some work done for achieving this or which parts of the code would need to change for this (I'm not familiar with the code base, yet). I'm aware of the fact that multiple inheritance introduces a new class of problems, but I'd like to try out a "quick" solution which does not deal with conflicts for now.
Thank you
Philipp
The text was updated successfully, but these errors were encountered: