-
Notifications
You must be signed in to change notification settings - Fork 96
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
How to make grammar recursive #49
Comments
The issue you're having is unrelated to the grammar being recursive: as you observe, it's that you need witness functions for every parameter. In your initial grammar, it wasn't relevant because there's only one program for the AST To better understand what's going on, the semantics of the witness function is, given a In your case, if you're learning, say, a (I'm a little confused by the semantics of making your grammar recursive. Since |
Thank you for the prompt response! I am still a little confused on how to go about the Specs. So should the witness function for the recursive argument in the operators return a spec that models all possible images inputs for that function. And if so wouldn't that set of possible image inputs be dependent on what color you are tying to filter out. Lastly, is there any documentation or examples on how to write your Spec? To address why we want the grammar to be recursive is so that we can solve problem like:
The program that we would want to generate that could solve this would be |
A witness function is a function from the Sorry, I don't think we have any example code of defining your own Okay, I see that |
I took your advice and wrote a
With these changes I made my grammar recursive again:
And I was able to synthesize simple Another thing I noticed was that the function pointer sent to |
We were able to solve our issues. We were making an error where one of your Witness functions wasn't accepting our custom partial image spec as a parameter, this resulted in the search ending earlier than it should have. After correcting that witness function we were able to start synthesizing interesting programs! |
HI PROSE Team! My group and I are using PROSE for a synthesis project for image transformations. We are running into an issue where we can't make the grammar work recursively. We initially started to generate programs using this DSL:
This works as expected and we are able to synthesize correct programs. However, the obvious limitation is that the grammar doesn't allow recursive operations, so we can only synthesize very simple programs. We then modified the grammar to be in the format:
However, with the same input / output test cases we weren't able to synthesize any program. From what I have been able to tell by googling around a bit is that we need another witness function for the 'single 'arguments for each of these grammar rules, however, I am not sure what those witness functions are meant to do. It was very clear what the witness functions for the color argument for the operators should be. Our repo is available here: https://github.com/RyanLuu/ArChEs/tree/recursive/demo/arches_v1/synthesis
Any help or suggestions on how to get our grammar working recursively would be greatly appreciated!
The text was updated successfully, but these errors were encountered: