microsoft / prose

Microsoft Program Synthesis using Examples SDK is a framework of technologies for the automatic generation of programs from input-output examples. This repo includes samples and sample data for the Microsoft Program Synthesis using Example SDK.
https://microsoft.github.io/prose/
Other
620 stars 100 forks source link

Setting recursion limits of grammars #33

Closed wslee closed 5 years ago

wslee commented 5 years ago

Hello and thank you very much for the great framework!

I have defined a recursive DSL grammar, and want to make the search space finite by limiting depth and "unrolling" the grammar finite times. Perhaps could I do that by annotating production rules of the grammar? Then, what kinds of keywords can I use when using the DSL compiler?

vuminhle commented 5 years ago

Thanks for your nice words and questions.

You can annotate the (recursive) argument with @recurse[int] to limit the number of unrolling. For instance,

string s := const
         | Concat(const, @recurse[3] s);
wslee commented 5 years ago

@vuminhle Thank you so much! It works well :)