MGrammar - Unordered and optional multi-projections?Given this grammar: <div><br/></div> <div> <pre>module test { language test { syntax Main = OneTwo*; syntax OneTwo = o:One t:Two &quot;\r\n&quot; =&gt; Result { One =&gt; true, Two =&gt; true } | Two One &quot;\r\n&quot; =&gt; Result { One =&gt; true, Two =&gt; true } | One &quot;\r\n&quot; =&gt; Result { One =&gt; true, Two =&gt; false } | Two &quot;\r\n&quot; =&gt; Result { One =&gt; false, Two =&gt; true }; token One = &quot;one&quot;; token Two = &quot;two&quot;; interleave Ignore = &quot; &quot;; } }</pre> <br/></div> <div>How could I refactor the syntax &quot;OneTwo&quot; to have only a single projection? In my real language I have a bunch of other tokens before and after the two optional and unordered items and the | list can be quite extensive and long if I have to enumerate every possible combination. Furthermore if you have a third item (&quot;OneTwoThree&quot; for example) then your | list can get exponentially grow. </div> <div><br/></div> <div>Is there a trick to defining unordered and optional items in the middle of a complex syntax?</div>© 2009 Microsoft Corporation. All rights reserved.Sat, 27 Jun 2009 15:53:06 Zd866d9d5-3d52-4ae2-bf68-1270b10b8f7ahttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/d866d9d5-3d52-4ae2-bf68-1270b10b8f7a#d866d9d5-3d52-4ae2-bf68-1270b10b8f7ahttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/d866d9d5-3d52-4ae2-bf68-1270b10b8f7a#d866d9d5-3d52-4ae2-bf68-1270b10b8f7ajustncase80http://social.msdn.microsoft.com/Profile/en-US/?user=justncase80MGrammar - Unordered and optional multi-projections?Given this grammar: <div><br/></div> <div> <pre>module test { language test { syntax Main = OneTwo*; syntax OneTwo = o:One t:Two &quot;\r\n&quot; =&gt; Result { One =&gt; true, Two =&gt; true } | Two One &quot;\r\n&quot; =&gt; Result { One =&gt; true, Two =&gt; true } | One &quot;\r\n&quot; =&gt; Result { One =&gt; true, Two =&gt; false } | Two &quot;\r\n&quot; =&gt; Result { One =&gt; false, Two =&gt; true }; token One = &quot;one&quot;; token Two = &quot;two&quot;; interleave Ignore = &quot; &quot;; } }</pre> <br/></div> <div>How could I refactor the syntax &quot;OneTwo&quot; to have only a single projection? In my real language I have a bunch of other tokens before and after the two optional and unordered items and the | list can be quite extensive and long if I have to enumerate every possible combination. Furthermore if you have a third item (&quot;OneTwoThree&quot; for example) then your | list can get exponentially grow. </div> <div><br/></div> <div>Is there a trick to defining unordered and optional items in the middle of a complex syntax?</div>Fri, 26 Jun 2009 15:40:41 Z2009-06-26T15:40:41Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/d866d9d5-3d52-4ae2-bf68-1270b10b8f7a#7b315326-cf5c-4841-9535-9f2febdfa9cfhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/d866d9d5-3d52-4ae2-bf68-1270b10b8f7a#7b315326-cf5c-4841-9535-9f2febdfa9cflcorneliussenhttp://social.msdn.microsoft.com/Profile/en-US/?user=lcorneliussenMGrammar - Unordered and optional multi-projections?Hi. Had the same issue last year. Gio promised to fix it :-)<br/> <br/> http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/3d5cb0ce-ac57-47e0-a17c-55e977f2b56b<br/> <br/> <span class=fullbadge><a class=author rel=nofollow href="../../../../Profile/en-US/?user=Giovanni Della-Libera&amp;referrer=http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/3d5cb0ce-ac57-47e0-a17c-55e977f2b56b&amp;rh=CzYHduEuAZ/Ki7VYZq2u4nPCU49VWwl44fdm3O/yCnU%3d&amp;sp=forums" class=author><span class=name>Giovanni Della-Libera</span> </a> : </span> &quot;Hi!  I'm on the dev team for MGrammar and we've been thinking about this scenario, so I'm glad to see a customer hitting it.  We'd like to make this easy to indicate in the language.  Will let you know once we've made progress here.&quot;Sat, 27 Jun 2009 13:28:15 Z2009-06-27T13:28:15Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/d866d9d5-3d52-4ae2-bf68-1270b10b8f7a#971c274c-666f-46ed-b8ca-0cca006562f2http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/d866d9d5-3d52-4ae2-bf68-1270b10b8f7a#971c274c-666f-46ed-b8ca-0cca006562f2justncase80http://social.msdn.microsoft.com/Profile/en-US/?user=justncase80MGrammar - Unordered and optional multi-projections?Yup that appears to be the exact same problem.Sat, 27 Jun 2009 15:53:06 Z2009-06-27T15:53:06Z