<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>The Hogg Blog : &amp;quot;M&amp;quot;</title><link>http://blogs.msdn.com/thehoggblog/archive/tags/_2600_quot_3B00_M_2600_quot_3B00_/default.aspx</link><description>Tags: &amp;quot;M&amp;quot;</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Turtle Graphics Update </title><link>http://blogs.msdn.com/thehoggblog/archive/2009/11/25/turtle-graphics-thanksgiving-update.aspx</link><pubDate>Thu, 26 Nov 2009 01:43:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9928910</guid><dc:creator>Jason Hogg</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/thehoggblog/comments/9928910.aspx</comments><wfw:commentRss>http://blogs.msdn.com/thehoggblog/commentrss.aspx?PostID=9928910</wfw:commentRss><wfw:comment>http://blogs.msdn.com/thehoggblog/rsscomments.aspx?PostID=9928910</wfw:comment><description>It is that time of the year again – thanksgiving. So that of course means I need to update the version of Turtle Graphics that I posted a year ago to test out Oslo. Turtle Graphics was a Logo like programming language created in the early 1980's as a means of introducing novices and children to programming on the BBC Microcomputer. Turtle graphics helped introduce people to programming using a simple functional language that provided instant visual gratification allowing the user to move a triangular turtle across the screen using simple commands such as forward, backward, right turn and left turn....(&lt;a href="http://blogs.msdn.com/thehoggblog/archive/2009/11/25/turtle-graphics-thanksgiving-update.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9928910" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/thehoggblog/attachment/9928910.ashx" length="2261512" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/DSL/default.aspx">DSL</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Oslo/default.aspx">Oslo</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/_2600_quot_3B00_M_2600_quot_3B00_/default.aspx">&amp;quot;M&amp;quot;</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Turtle+Graphics/default.aspx">Turtle Graphics</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Education/default.aspx">Education</category></item><item><title>Oslo MGrammar Turtle Graphics for VS2008</title><link>http://blogs.msdn.com/thehoggblog/archive/2008/12/12/oslo-mgrammar-logo-for-vs2007.aspx</link><pubDate>Sat, 13 Dec 2008 04:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9204452</guid><dc:creator>Jason Hogg</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/thehoggblog/comments/9204452.aspx</comments><wfw:commentRss>http://blogs.msdn.com/thehoggblog/commentrss.aspx?PostID=9204452</wfw:commentRss><wfw:comment>http://blogs.msdn.com/thehoggblog/rsscomments.aspx?PostID=9204452</wfw:comment><description>&lt;P&gt;My colleague Joshy Joseph reminded me that the MGrammar based Turtle Graphics parser that I posted &lt;A class="" href="http://blogs.msdn.com/thehoggblog/archive/2008/11/25/a-logo-turtle-graphics-sample-in-mgrammar.aspx" mce_href="http://blogs.msdn.com/thehoggblog/archive/2008/11/25/a-logo-turtle-graphics-sample-in-mgrammar.aspx"&gt;here&lt;/A&gt;&amp;nbsp;was for VS2010. I have attached a newer version of the solution that Joshy coverted to run in VS2008. I noticed that Doug Finke has also done the same thing whilst also creating a couple of additional samples as well. Take a look at his &lt;A class="" href="http://dougfinke.com/blog/?cat=195" mce_href="http://dougfinke.com/blog/?cat=195"&gt;blog&lt;/A&gt; for more details... &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9204452" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/thehoggblog/attachment/9204452.ashx" length="2826604" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Fun/default.aspx">Fun</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/DSL/default.aspx">DSL</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/PDC2008/default.aspx">PDC2008</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Software+Factories/default.aspx">Software Factories</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Oslo/default.aspx">Oslo</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/_2600_quot_3B00_M_2600_quot_3B00_/default.aspx">&amp;quot;M&amp;quot;</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Turtle+Graphics/default.aspx">Turtle Graphics</category></item><item><title>Creating a Logo / Turtle Graphics Textual DSL using Oslo MGrammar</title><link>http://blogs.msdn.com/thehoggblog/archive/2008/11/25/a-logo-turtle-graphics-sample-in-mgrammar.aspx</link><pubDate>Wed, 26 Nov 2008 01:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9142858</guid><dc:creator>Jason Hogg</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/thehoggblog/comments/9142858.aspx</comments><wfw:commentRss>http://blogs.msdn.com/thehoggblog/commentrss.aspx?PostID=9142858</wfw:commentRss><wfw:comment>http://blogs.msdn.com/thehoggblog/rsscomments.aspx?PostID=9142858</wfw:comment><description>&lt;P&gt;In the early 1980's a programming language called &lt;A class="" href="http://en.wikipedia.org/wiki/Turtle_graphics" mce_href="http://en.wikipedia.org/wiki/Turtle_graphics"&gt;Turtle Graphics&lt;/A&gt;&amp;nbsp;was used as a means of introducing novices to programming on the &lt;A class="" href="http://blogs.msdn.com/thehoggblog/archive/2008/03/22/glory-days-home-computing-in-the-80-s.aspx" mce_href="http://blogs.msdn.com/thehoggblog/archive/2008/03/22/glory-days-home-computing-in-the-80-s.aspx"&gt;BBC Microcomputer&lt;/A&gt;. Turtle graphics, a graphical version of Logo, helped introduce people to programming using a simple functional language that provided instant visual gratification allowing the user to move a triangular turtle across the screen using simple commands such as forward, backward, right turn and left turn.&lt;/P&gt;
&lt;P&gt;At PDC this year the Connected Systems team introduced a new language called "M" - which allows textual DSL's to be created. I will talk more about this language in future posts especially compared with the F# Lexer and Parser that we used to create our textual DSL for &lt;A class="" href="http://blogs.msdn.com/thehoggblog/archive/2007/08/26/parser-for-secpal-simplified-english-grammar-now-available.aspx" mce_href="http://blogs.msdn.com/thehoggblog/archive/2007/08/26/parser-for-secpal-simplified-english-grammar-now-available.aspx"&gt;SecPAL&lt;/A&gt;, but first I wanted to create a programming language with which to learn Mg. I thought a version of Turtle Graphics would be fun - and interesting for anyone else interested in experimenting with or learning Mg. &lt;/P&gt;
&lt;P&gt;The programming language I am liberally calling Logo (and the associated interpreter) are fairly simple - but I thought it would be fun for people to play with, especially those with children who are looking for new ways to introduce their kids to progamming. I did the bulk of the work specifying the grammar for this simple version of Logo on the flight back from LA to Seattle - which should give you a sense of how intuitive Mg is - and how productive the Intellipad authoring experience is. &lt;/P&gt;
&lt;P&gt;Given that Thanksgiving is just two days away I figured it would be patriotic (odd coming from an Aussie/Kiwi/Pom hybrid) to show how simple it is for this language to draw the United States flag - a design which obviously would make significant use of loops and nested loops.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;IMG title="Logo Editor" alt="Logo Editor" src="http://blogs.msdn.com/photos/jason_hogg/images/9142865/500x163.aspx" mce_src="http://blogs.msdn.com/photos/jason_hogg/images/9142865/500x163.aspx"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The screenshot above shows the output from this program. The complete logo program listing is also included below so you can see how complex objects can be created using a simple grammar comprising of just 5 commands:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Commands - Commands perform actions such as moving or rotating.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;Rotate n &lt;/STRONG&gt;- Rotate 'n' degrees&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;Draw n&lt;/STRONG&gt; - Draw a line 'n' pixels long&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;MoveAbs x, y&lt;/STRONG&gt; - Move to an absolute position&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;Move x,y&lt;/STRONG&gt; - Move to a position relative to last move / draw command&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Loops - Sets of instructions which are executde iteratively. Loops can be nested.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;Loop n&lt;/STRONG&gt; &lt;STRONG&gt;{&lt;/STRONG&gt; [Command] &lt;STRONG&gt;}&lt;/STRONG&gt;*&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have attached the full source code for this so that you can play with this yourself. The source code is based on the PDC (October?) version of Oslo which you will have to first download from MSDN. The language could easily be extended to include color, line widths, other types of lines such as bezier curves etc - which should provide a good introduction for anyone interested.&amp;nbsp;Post pointers if you do anything fun with this.&lt;/P&gt;
&lt;P&gt;In addition to the formal grammar for my logo language (logo.mg) the .zip file also includes a WPF interpreter that interprets the parsed output of our logo programs and converts them into WPF Path Geometry syntax. There is also a simple editor that allows you to edit and run our Logo programs - providing a nice easy way to start teaching your children to program. Or for yourself to start modifying the language as described above. &lt;/P&gt;
&lt;P&gt;Enjoy!!! And (to those in America) Happy Thanksgiving... &lt;/P&gt;&lt;PRE&gt;// Logo (and Mg) sample program &lt;BR&gt;// Happy Thanksgiving! 
&lt;P&gt;// Move to top left&lt;BR&gt;MoveAbs 25,25 &lt;/P&gt;

&lt;P&gt;// Draw five rows of stars&lt;BR&gt;Loop 5&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; // Draw ten columns of stars&lt;BR&gt;&amp;nbsp;&amp;nbsp; Loop 10&lt;BR&gt;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp; // Draw five points to make each star&lt;BR&gt;&amp;nbsp;&amp;nbsp; Loop 5&lt;BR&gt;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rotate -54&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Draw 5&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rotate 126&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Draw 5&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; Move 20 -1&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; Move -210,20&lt;BR&gt;}&lt;/P&gt;

&lt;P&gt;// Draw the lines next to the stars&lt;BR&gt;MoveAbs 430,25&lt;BR&gt;Rotate -90&lt;BR&gt;Loop 5&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; // Lines are 5 pixels high&lt;BR&gt;&amp;nbsp;&amp;nbsp; Loop 5&lt;BR&gt;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Draw 200&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Move 200,1&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; Move 0 15&lt;BR&gt;}&lt;/P&gt;

&lt;P&gt;// Draw the lower lines on the flag&lt;BR&gt;MoveAbs 430,125&lt;BR&gt;Loop 5&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; // Lines are 5 pixels high&lt;BR&gt;&amp;nbsp;&amp;nbsp; Loop 5&lt;BR&gt;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Draw 410&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Move 410,1&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; Move 0,15&lt;BR&gt;}&lt;/P&gt;

&lt;/PRE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9142858" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/thehoggblog/attachment/9142858.ashx" length="867454" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/DSL/default.aspx">DSL</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/PDC2008/default.aspx">PDC2008</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Software+Factories/default.aspx">Software Factories</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Oslo/default.aspx">Oslo</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/_2600_quot_3B00_M_2600_quot_3B00_/default.aspx">&amp;quot;M&amp;quot;</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Turtle+Graphics/default.aspx">Turtle Graphics</category></item></channel></rss>