<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>My Other Pants &#187; Irony</title>
	<atom:link href="http://myotherpants.com/tag/irony/feed/" rel="self" type="application/rss+xml" />
	<link>http://myotherpants.com</link>
	<description>I left it in my other pants</description>
	<lastBuildDate>Tue, 24 Jan 2012 18:11:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>I&#8217;m totally plugged in!</title>
		<link>http://myotherpants.com/2010/09/im-totally-plugged-in/</link>
		<comments>http://myotherpants.com/2010/09/im-totally-plugged-in/#comments</comments>
		<pubDate>Sun, 12 Sep 2010 23:01:59 +0000</pubDate>
		<dc:creator>Ball</dc:creator>
				<category><![CDATA[work safe]]></category>
		<category><![CDATA[braincrack]]></category>
		<category><![CDATA[DSL]]></category>
		<category><![CDATA[Irony]]></category>
		<category><![CDATA[VS10]]></category>

		<guid isPermaLink="false">http://myotherpants.com/?p=211</guid>
		<description><![CDATA[There are few things in life better than humus and pita chips. There are few things in life are as insidiously addictive as brain-crack, the idea not executed. These ideas sit in your brain festering, growing malignantly, until there is no hope of you ever achieving them like the &#8220;perfect utopia&#8221; they have become. I [...]]]></description>
			<content:encoded><![CDATA[<p>There are few things in life better than humus and pita chips.</p>
<p>There are few things in life are as insidiously addictive as <a href="http://www.zefrank.com/theshow/archives/2006/07/071106.html">brain-crack</a>, the idea not executed.  These ideas sit in your brain festering, growing malignantly, until there is no hope of you ever achieving them like the &#8220;perfect utopia&#8221; they have become.</p>
<p>I bring this up because I had 2 in particular that where starting to rattle around in my brain like horrid clattering moose (moose clatter, right?).  I&#8217;m a junkie for computer languages, and when <a href="http://richardminerich.com/">Rick Minerich</a> mentioned <a href="http://Irony.codeplex.com">Irony</a> recently followed quickly by a project manager asking about writing a testing DSL, I started to feel that tumor grow in my delicate, delicious brains.  I should write a language.  Then it split in twain.  There is no reason to have a programming language, even a DSL, without an editor that understands it.  I&#8217;d need a Visual Studio plug in to make that work.  And those are hard, right?  Besides, I would want to <i>do it right</i> and reuse the parser built for the first to syntax highlight the second.  Uh, oh.  I now have an idea for the <i>perfect DSL framework</i> rattling around in my skull.</p>
<p>The problem is, I only have enough room in my brain for a handful of things at any given time.  So, I took the weekend to clean house.  The idea is not to get something perfect.  I just want to get it done enough to say, &#8220;I did that.&#8221; And now I can get to sleep tonight.  My DSL isn&#8217;t for supporting your important work, it is for proving I know how to do it.</p>
<p>First lesson learned:  Irony has crappy and out of date documentation.  Every example I&#8217;ve seen uses API calls no longer in the library.  In addition, most focus on how cool the internal DSL Irony uses for creation of the language grammar.  And it is cool.  But some of us missed the <a href="http://myotherpants.com/2009/05/irony-and-cicles/">last mile</a>.  I&#8217;m not going to solve that issue here.  <a href="http://github.com/Ball/CirclesDSL">I did, however, post my weekend exploration to github</a>.  Enjoy!</p>
<p>Second lesson learned: VS 2010 isn&#8217;t that hard to extend, <a href="http://msdn.microsoft.com/en-us/library/dd885242.aspx">once you know where to look</a>.</p>
<p>Third lesson learned (again): I can&#8217;t spell.  I had set the file extension to &#8220;circles&#8221; when I was using a file called &#8220;circle&#8221;.  That means my plugin wasn&#8217;t triggering Saturday, so I had a Ukulele break and came back to it this afternoon. </p>
<p>Fourth lesson learned: Visual Studio lies.  It gave me an error when my extension crashed about ActivityLog.xml but I couldn&#8217;t find it.  I had to enable -log at the command line for the extension.  Then it was easy.</p>
<p>Fifth lesson learned: a full grammar sucks for syntax highlighting.  Effective syntax highlighting requires robustness because it should work, not only on a full program, but on a program as it is being typed.  See the screen shots to better understand.</p>
<p><a href="http://myotherpants.com/wp-content/uploads/2010/09/circles_lang_incomplete.png"><img src="http://myotherpants.com/wp-content/uploads/2010/09/circles_lang_incomplete.png" alt="An incomplete circle definition" title="Incomplete Circles" width="349" height="361" class="aligncenter size-full wp-image-213" /></a></p>
<p><a href="http://myotherpants.com/wp-content/uploads/2010/09/circles_lang_complete.png"><img src="http://myotherpants.com/wp-content/uploads/2010/09/circles_lang_complete.png" alt="Complete Circles Definition" title="circles_lang_complete" width="349" height="361" class="size-full wp-image-212" /></a></p>
<p>I&#8217;m not &#8220;finishing&#8221; this project.  It has done what it was meant to do, serve as a prof of concept sketch that I can refer to later.  Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://myotherpants.com/2010/09/im-totally-plugged-in/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Irony and Circles</title>
		<link>http://myotherpants.com/2009/05/irony-and-cicles/</link>
		<comments>http://myotherpants.com/2009/05/irony-and-cicles/#comments</comments>
		<pubDate>Sun, 31 May 2009 13:48:08 +0000</pubDate>
		<dc:creator>Ball</dc:creator>
				<category><![CDATA[work safe]]></category>
		<category><![CDATA[DSL]]></category>
		<category><![CDATA[Irony]]></category>
		<category><![CDATA[VS10]]></category>

		<guid isPermaLink="false">http://myotherpants.com/?p=65</guid>
		<description><![CDATA[When I started my DSL talk for los officiea, I was looking around for neat DSL things to add when I found Irony.  I found it at a Lang.NET talk.  Then I wrote a small DSL to define some geometric circles.  So, here&#8217;s a quick rundown of how I made it happen. Irony is used [...]]]></description>
			<content:encoded><![CDATA[<p>When I started my DSL talk for los officiea, I was looking around for neat DSL things to add when I found Irony.  I found it at a Lang.NET talk.  Then I wrote a small DSL to define some geometric circles.  So, here&#8217;s a quick rundown of how I made it happen.</p>
<p>Irony is used to define a parser.  Inside the parser&#8217;s constructor, we build the BNF tree that describes the grammar.  When that&#8217;s done, Irony will spit out an Abstract Syntax Tree (AST) that we can use for &#8220;real work&#8221;.  Let&#8217;s take a look at some of the grammar, before we see the Parser code.</p>
<p><strong>program</strong> &lt;- <em>shape</em> +</p>
<p><strong>shape</strong> &lt;- <em>circle</em> | <em>polygon</em> | <em>rectangle</em></p>
<p><strong>circle</strong> &lt;- circle <em>point</em> radius <em>number</em></p>
<p><strong>point</strong> &lt;- [ <em>number</em> , <em>number</em> ]</p>
<p>What this looks like is the program &#8216;circle [100, 150] radius 35&#8242;.  It gives me circle with a center and a radius.  What&#8217;s that look like in C#?  Or at least the circle bit?<br />
<span id="more-65"></span></p>
<pre name="code" class="c-sharp">
public class ShapesParser : GrammarParser {

  public ShapesParser() {
     // Terminal statements
     var numbers = new NumberTerminal("number");
     // Non-Terminal
     var circle = new NonTerminal("circle", CircleBuilder);
     var point = new NonTerminal("point", PointBuilder);

     // Rules
     circle.Rule = "circle" + point + "radius" + number;
     point.Rule = "[" + number + "," + number + "]";
     this.Root = Circle
  }
}
</pre>
<p>You&#8217;ll notice the definitions for the non-Terminals contain delegates.  These are methods in the ShapesGrammar that accept an NodeArgs and breaks out the interesting stuff and creates the custom node for the AST.  This means we aren&#8217;t beholden to the default way ASTs fall out of the grammar, but inform it with some real smarts and make it fit our mindset.</p>
<p>But it seems that every time I play with Irony, I run into something.  I started playing with FSharp, but the hyperstrong typing is far too picky.  This wouldn&#8217;t be a problem if I was confident in FSharp and Irony, but I have to do a lot of casting involving an API I&#8217;m just learning.  In addition, there&#8217;s a disjunction between functions in fsharp and delegates.  I&#8217;ll have to figure that out.</p>
<p>Yesterday, I started working on Irony again, using VS10 because I can.  Then it turns out nUnit is having problems loading .NET 4 dlls, because I didn&#8217;t build it.  Enter yack shaving as I&#8217;m having issues building Nant.  </p>
<p>None of these are Irony&#8217;s problem.  It&#8217;s a great library, and as soon as I get a full demo working, I&#8217;ll be posting more.</p>
]]></content:encoded>
			<wfw:commentRss>http://myotherpants.com/2009/05/irony-and-cicles/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

