Moving from Janurary CTP to MaySorry if this has already been covered over the past few days, but I didn't see it anywhere.  I'm using MGrammar in a project I'm working on to create a programming language.  I had taken some code from the MGBasic stuff as well as some other site I can't remember right now, both used the MGraphXamlReader and DynamicParserExtensions classes.  I had been loading my grammar via this code:<br/> <br/>             var errorReporter = this.errorReporter;<br/>             var compiler = new MGrammarCompiler<br/>             {<br/>                 SourceItems = new SourceItem[] { <br/>                         new SourceItem { <br/>                             Name = &quot;EZLanguage&quot;, <br/>                             ContentType = ContentType.Mg, <br/>                             TextReader = new StringReader(grammarString) <br/>                         },<br/>                 },<br/>             };<br/>             if (compiler.Compile(errorReporter) != 0 || errorReporter.HasErrors)<br/>             {<br/>                 return null;<br/>             }<br/>             var dynamicParser = new DynamicParser();<br/>             compiler.LoadDynamicParser(dynamicParser);<br/> <br/>             return dynamicParser;<br/> <br/> And I've since switched it to (changed the names around but this code does work and parser isn't null after this runs<br/> <br/>                     using (Stream stream = this.GetType().Assembly.GetManifestResourceStream(language.mx&quot;))<br/>                     {<br/>                         // Construct a DynamicParser based on the Simple.mx file<br/>                         parser = DynamicParser.LoadFromStream(stream, &quot;language&quot;);<br/>                     }<br/> <br/> I've gone inside of the DynamicParserExtensions class, ParseToXaml method and changed this line which was giving an error<br/>             var result = parser.Parse&lt;object&gt;(null, input, errorReporter);<br/> to<br/>             var result = parser.Parse&lt;object&gt;(input, errorReporter, xamlMap);<br/> <br/> Which seems to me would still work as its still getting the same information.  However, when I run my app and try to map my code to xaml and then from xaml to c# objects (which used to work perfectly with this code) I'm now getting a <br/> <br/> An unhandled exception of type 'System.StackOverflowException' <br/> that just switches back and forth between the functions Parse, ParseToXaml, ParseToObject.  Has anyone experienced this and have any suggestions on how to get the MGraphXamlReader and DynamicParserExtensions classses to work with the new May CTP?  Thanks in advance!<br/>© 2009 Microsoft Corporation. All rights reserved.Thu, 18 Jun 2009 18:37:17 Z0b78a343-8bfe-4099-91e4-c0c81116a020http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#0b78a343-8bfe-4099-91e4-c0c81116a020http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#0b78a343-8bfe-4099-91e4-c0c81116a020MyBrokenGnomehttp://social.msdn.microsoft.com/Profile/en-US/?user=MyBrokenGnomeMoving from Janurary CTP to MaySorry if this has already been covered over the past few days, but I didn't see it anywhere.  I'm using MGrammar in a project I'm working on to create a programming language.  I had taken some code from the MGBasic stuff as well as some other site I can't remember right now, both used the MGraphXamlReader and DynamicParserExtensions classes.  I had been loading my grammar via this code:<br/> <br/>             var errorReporter = this.errorReporter;<br/>             var compiler = new MGrammarCompiler<br/>             {<br/>                 SourceItems = new SourceItem[] { <br/>                         new SourceItem { <br/>                             Name = &quot;EZLanguage&quot;, <br/>                             ContentType = ContentType.Mg, <br/>                             TextReader = new StringReader(grammarString) <br/>                         },<br/>                 },<br/>             };<br/>             if (compiler.Compile(errorReporter) != 0 || errorReporter.HasErrors)<br/>             {<br/>                 return null;<br/>             }<br/>             var dynamicParser = new DynamicParser();<br/>             compiler.LoadDynamicParser(dynamicParser);<br/> <br/>             return dynamicParser;<br/> <br/> And I've since switched it to (changed the names around but this code does work and parser isn't null after this runs<br/> <br/>                     using (Stream stream = this.GetType().Assembly.GetManifestResourceStream(language.mx&quot;))<br/>                     {<br/>                         // Construct a DynamicParser based on the Simple.mx file<br/>                         parser = DynamicParser.LoadFromStream(stream, &quot;language&quot;);<br/>                     }<br/> <br/> I've gone inside of the DynamicParserExtensions class, ParseToXaml method and changed this line which was giving an error<br/>             var result = parser.Parse&lt;object&gt;(null, input, errorReporter);<br/> to<br/>             var result = parser.Parse&lt;object&gt;(input, errorReporter, xamlMap);<br/> <br/> Which seems to me would still work as its still getting the same information.  However, when I run my app and try to map my code to xaml and then from xaml to c# objects (which used to work perfectly with this code) I'm now getting a <br/> <br/> An unhandled exception of type 'System.StackOverflowException' <br/> that just switches back and forth between the functions Parse, ParseToXaml, ParseToObject.  Has anyone experienced this and have any suggestions on how to get the MGraphXamlReader and DynamicParserExtensions classses to work with the new May CTP?  Thanks in advance!<br/>Wed, 03 Jun 2009 22:33:27 Z2009-06-03T22:34:19Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#7c3f0a91-0eb1-43ac-be65-12e33b4d65d0http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#7c3f0a91-0eb1-43ac-be65-12e33b4d65d0Kraig Brockschmidthttp://social.msdn.microsoft.com/Profile/en-US/?user=Kraig%20BrockschmidtMoving from Janurary CTP to MayThere's actually a new object model with this CTP for dynamic parsing, and we're just about to post information on that in the next day or two. I just have to do a final review, so you can blame me for the delay :)<br/><br/>I'll let you know as soon as it's live; it'll show up in our Featured Items as well on the home page so you can always just subscribe to that feed if you haven't already.<br/><br/>.KraigThu, 04 Jun 2009 04:29:35 Z2009-06-04T04:29:35Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#776b247e-35c8-45f2-8275-1dce54f48109http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#776b247e-35c8-45f2-8275-1dce54f48109MyBrokenGnomehttp://social.msdn.microsoft.com/Profile/en-US/?user=MyBrokenGnomeMoving from Janurary CTP to MayKraig,<br/> <br/> Cool thanks, will be looking forward to that.Thu, 04 Jun 2009 08:59:39 Z2009-06-04T08:59:39Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#1291c64d-da0c-4b59-bdfb-ea4058c51411http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#1291c64d-da0c-4b59-bdfb-ea4058c51411Kraig Brockschmidthttp://social.msdn.microsoft.com/Profile/en-US/?user=Kraig%20BrockschmidtMoving from Janurary CTP to May<p>The paper from Clemens Syzperski is now available at <a href="http://msdn.microsoft.com/en-us/library/dd878360.aspx">http://msdn.microsoft.com/en-us/library/dd878360.aspx</a>. We're trying to improve the code formatting in the article, because the tool that we have to create an article like this has a whitespace phobia. But it should be plenty usable in the meantime. The URL will remain the same.<br/><br/>.Kraig</p>Thu, 04 Jun 2009 21:48:50 Z2009-06-04T21:48:50Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#394effa0-f461-48c8-b2a5-19e694d51a13http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#394effa0-f461-48c8-b2a5-19e694d51a13Shawn Wildermuthhttp://social.msdn.microsoft.com/Profile/en-US/?user=Shawn%20WildermuthMoving from Janurary CTP to MayThe problem I think he's asking about (and that I need) is to know how to use a .mx image as a compiled grammar (as re-compiling the grammar is a time waster).  Is there a way to use a .mx file instead of the Compiler having to parse the .mg file?<hr class="sig">The Silverlight Tour is Coming to: Boston, MA - April 29-May 1, 2009 Washington, DC - June 16-18, 2009 http://silverlight-tour.com http://wildermuth.com http://agilitrain.comFri, 05 Jun 2009 06:09:13 Z2009-06-05T06:09:13Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#79945ee4-6c30-4f58-9c09-4dbdb767575bhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#79945ee4-6c30-4f58-9c09-4dbdb767575bShawn Wildermuthhttp://social.msdn.microsoft.com/Profile/en-US/?user=Shawn%20WildermuthMoving from Janurary CTP to MayI was suprised how simple it was to use a pre-complied image: <div><br/></div> <div>This:</div> <div><br/></div> <div> <div></div> <pre lang="x-c#">Stream mgStream = File.OpenRead(mgPath); CompilationResults results = Compiler.Compile(   new CompilerOptions   {     Sources =      {       new TextItem        {           Reader = new StreamReader(mgStream),           ContentType = TextItemType.MGrammar        }     }   }); theParser = results.ParserFactories[LanguageName].Create(); theParser.GraphBuilder = new NodeGraphBuilder(); </pre> <br/> <div><br/></div> <div>Became this:</div> <div><br/></div> <div> <div></div> <pre lang="x-c#">var grammar = new MImage(mxPath); theParser = grammar.ParserFactories[LanguageName].Create(); theParser.GraphBuilder = new NodeGraphBuilder();</pre> <br/> <div></div> <div><br/></div> <div>Nice!</div> </div> </div><hr class="sig">The Silverlight Tour is Coming to: Boston, MA - April 29-May 1, 2009 Washington, DC - June 16-18, 2009 http://silverlight-tour.com http://wildermuth.com http://agilitrain.comFri, 05 Jun 2009 06:31:33 Z2009-06-05T06:31:33Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#b3b39371-27ae-497d-9334-da7294a62561http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#b3b39371-27ae-497d-9334-da7294a62561MyBrokenGnomehttp://social.msdn.microsoft.com/Profile/en-US/?user=MyBrokenGnomeMoving from Janurary CTP to MayI'm actually not sure either one of them is what I'm looking for.  When I was using the Janurary CTP I was using this code to load it<br/> <br/> var errorReporter = this.errorReporter;<br/>             var compiler = new MGrammarCompiler<br/>             {<br/>                 SourceItems = new SourceItem[] { <br/>                         new SourceItem { <br/>                             Name = &quot;EZLanguage&quot;, <br/>                             ContentType = ContentType.Mg, <br/>                             TextReader = new StringReader(grammarString) <br/>                         },<br/>                 },<br/>             };<br/>             if (compiler.Compile(errorReporter) != 0 || errorReporter.HasErrors)<br/>             {<br/>                 return null;<br/>             }<br/>             var dynamicParser = new DynamicParser();<br/>             compiler.LoadDynamicParser(dynamicParser);<br/> <br/>             return dynamicParser;<br/> <br/> <br/> You'll notice I'm using a string, grammarString.  This is not currently the issue as I've switched it over to use the compiled grammar file, so I don't think Shawn's example will help me.  When using the Janurary CTP I had been using the DynamicParsersExtensions and MGraphXamlReader classes to store the AST in XAML and then it was using LINQ to take the XAML and store them in classes.  Very much like these two guys did<br/> <br/> http://rogeralsing.com/2008/11/22/linqing-mgrammar-to-cil/<br/> http://www.nootaikok.com/2009/01/c-code-generation-using-mgrammar.html<br/> <br/> Now with the May CTP update the DynamicParsersExtensions and MGraphXamlReader classes no longer work.  I haven't read all of Kraig's post so it may or may not contain the answer I'm looking for, but basically I just need this functionality back (or something very close to it so I don't have to rewrite all my code :( )Fri, 05 Jun 2009 14:14:59 Z2009-06-05T14:14:59Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#f2cfe477-e82e-45cb-8c32-1a1d93b45c48http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#f2cfe477-e82e-45cb-8c32-1a1d93b45c48MyBrokenGnomehttp://social.msdn.microsoft.com/Profile/en-US/?user=MyBrokenGnomeMoving from Janurary CTP to May::bump:: Anyone have any luck with this?  Looks like I'm going to have to revert back to the January ctp as the May version doesn't (apparently) do what we need it to.<br/> <br/> In case you're wondering why I need it to do this, using the techniques in the links from my last post I created a language in MGrammar that is very domain specific, but the code gets converted to C# and compiled on the fly.  With the May CTP I have yet to figure out how to get do the XAML mappings that I talked about in my previous post so that the MGraphXamlReader files will call the appropriate method depending on what type of node it reached in my MGrammar AST.<br/>Mon, 15 Jun 2009 18:58:37 Z2009-06-15T18:58:37Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#eb395c65-f0d9-46bc-aca5-9edfafadeef9http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/0b78a343-8bfe-4099-91e4-c0c81116a020#eb395c65-f0d9-46bc-aca5-9edfafadeef9Marcin Kruszynskihttp://social.msdn.microsoft.com/Profile/en-US/?user=Marcin%20KruszynskiMoving from Janurary CTP to MayI have sucessfully converted Microsoft samples with MGraphXamlReader. May CTP still have old MGraph object model and I didn't change API to new model.<br/>My version of samples work for me.<br/><br/>You can download them from: <a href="http://martinkruszynski.blogspot.com/2009/06/xaml-samples-ultra-flexible-event.html">http://martinkruszynski.blogspot.com/2009/06/xaml-samples-ultra-flexible-event.html</a><br/><br/><br/><br/><br/>Martin Kruszyński<br/><br/>BTW I have publicated my 2 Oslo samples recently: <a href="http://martinkruszynski.blogspot.com/2009/06/user-interface-modeling-with-oslo-my.html">http://martinkruszynski.blogspot.com/2009/06/user-interface-modeling-with-oslo-my.html</a>. In first my sample I tried to use new object model for MGraph and my parser works, but I'm waiting for more samples from Microsoft how to use new API.Thu, 18 Jun 2009 18:37:17 Z2009-06-18T18:42:34Z