<?xml version="1.0" encoding="iso-8859-1"?>

<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
  xmlns:admin="http://webns.net/mvcb/"
  xmlns:cc="http://web.resource.org/cc/"
  xmlns="http://purl.org/rss/1.0/">

<channel rdf:about="http://blogs.codehaus.org/people/bamboo//archives/boo.html">
<title>bamboozled - boo</title>
<link>http://blogs.codehaus.org/people/bamboo//archives/boo.html</link>
<description></description>
<dc:language>en-us</dc:language>
<dc:creator></dc:creator>
<dc:date>2008-08-05T09:52:06-03:00</dc:date>
<admin:generatorAgent rdf:resource="http://www.movabletype.org/?v=2.661" />

<items>
<rdf:Seq><rdf:li rdf:resource="http://blogs.codehaus.org/people/bamboo/archives/001722_boo_ometa_and_extensible_parsing_i.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/bamboo/archives/001698_boo_082_is_here.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/bamboo/archives/001688_towards_extensible_parsing.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/bamboo/archives/001659_boo_081_is_here.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/bamboo/archives/001648_make_the_world_a_better_place_with_boo.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/bamboo/archives/001641_boo_babel.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/bamboo/archives/001640_back_from_the_mono_summit_07.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/bamboo/archives/001637_mono_summit_2007.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/bamboo/archives/001631_mockingboo_with_meta_programming_facilities.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/bamboo/archives/001629_boojay_does_eclipse.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/bamboo/archives/001627_boojay_discussion_group.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/bamboo/archives/001626_boo_08_is_here.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/bamboo/archives/001623_introducing_boojay.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/bamboo/archives/001620_a_pattern_matching_facility_for_boo.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/bamboo/archives/001612_boo_079_is_here.html" />
</rdf:Seq>
</items>

</channel>

<item rdf:about="http://blogs.codehaus.org/people/bamboo/archives/001722_boo_ometa_and_extensible_parsing_i.html">
<title>boo, ometa and extensible parsing I</title>
<link>http://blogs.codehaus.org/people/bamboo/archives/001722_boo_ometa_and_extensible_parsing_i.html</link>
<description><![CDATA[<p>
Meanwhile in a <a href="http://code.google.com/p/boo-extensions/">repository</a> not far away:
<br />
<pre><font color="#000000">    <font color="#006699"><strong>namespace</strong></font> metaboo

    <font color="#006699"><strong>import</strong></font> Boo.Lang.Compiler
    <font color="#006699"><strong>import</strong></font> Boo.Lang.Compiler.Ast
    <font color="#006699"><strong>import</strong></font> Boo.OMeta
    <font color="#006699"><strong>import</strong></font> Boo.OMeta.Parser

    syntax Units<font color="#000000"><strong>:</strong></font>
        atom <font color="#000000"><strong>=</strong></font> mass <font color="#000000"><strong>|</strong></font> <font color="#009966"><strong>super</strong></font>
        mass <font color="#000000"><strong>=</strong></font> <font color="#000000"><strong>(</strong></font>integer <font color="#000000"><strong>&gt;</strong></font><font color="#000000"><strong>&gt;</strong></font> value <font color="#006699"><strong>as</strong></font> Expression, <font color="#ff00cc">&quot;</font><font color="#ff00cc">kg</font><font color="#ff00cc">&quot;</font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>^</strong></font> <font color="#000000"><strong>[</strong></font><font color="#000000"><strong>|</strong></font> Mass<font color="#000000"><strong>(</strong></font>$value, <font color="#ff00cc">&quot;</font><font color="#ff00cc">kg</font><font color="#ff00cc">&quot;</font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>|</strong></font><font color="#000000"><strong>]</strong></font>

    syntax Ranges<font color="#000000"><strong>:</strong></font>
        atom <font color="#000000"><strong>=</strong></font> integer_range <font color="#000000"><strong>|</strong></font> <font color="#009966"><strong>super</strong></font>
        integer_range <font color="#000000"><strong>=</strong></font> <font color="#000000"><strong>(</strong></font>integer <font color="#000000"><strong>&gt;</strong></font><font color="#000000"><strong>&gt;</strong></font> begin <font color="#006699"><strong>as</strong></font> Expression, DOT, DOT, integer <font color="#000000"><strong>&gt;</strong></font><font color="#000000"><strong>&gt;</strong></font> <font color="#006699"><strong>end</strong></font> <font color="#006699"><strong>as</strong></font> Expression<font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>^</strong></font> <font color="#000000"><strong>[</strong></font><font color="#000000"><strong>|</strong></font> range<font color="#000000"><strong>(</strong></font>$begin, $<font color="#006699"><strong>end</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>|</strong></font><font color="#000000"><strong>]</strong></font>

    <font color="#006699"><strong>def</strong></font> parse<font color="#000000"><strong>(</strong></font>code <font color="#006699"><strong>as</strong></font> <font color="#009966"><strong>string</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
        compiler <font color="#000000"><strong>=</strong></font> BooCompiler<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>
        compiler.Parameters.References.Add<font color="#000000"><strong>(</strong></font>System.Reflection.Assembly.GetExecutingAssembly<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>
        compiler.Parameters.Input.Add<font color="#000000"><strong>(</strong></font>IO.StringInput<font color="#000000"><strong>(</strong></font><font color="#ff00cc">&quot;</font><font color="#ff00cc">code</font><font color="#ff00cc">&quot;</font>, code<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>
        compiler.Parameters.Pipeline <font color="#000000"><strong>=</strong></font> CompilerPipeline<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>
        compiler.Parameters.Pipeline.Add<font color="#000000"><strong>(</strong></font>BooParserStep<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>
        <font color="#006699"><strong>return</strong></font> compiler.Run<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>

    code <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">&quot;&quot;&quot;</font>
<font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">import</font><font color="#ff00cc"> </font><font color="#ff00cc">metaboo</font><font color="#ff00cc">.</font><font color="#ff00cc">Units</font>
<font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">import</font><font color="#ff00cc"> </font><font color="#ff00cc">metaboo</font><font color="#ff00cc">.</font><font color="#ff00cc">Ranges</font>

<font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">a</font><font color="#ff00cc"> </font><font color="#ff00cc">=</font><font color="#ff00cc"> </font><font color="#ff00cc">3kg</font>
<font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">print</font><font color="#ff00cc"> </font><font color="#ff00cc">a</font>
<font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">for</font><font color="#ff00cc"> </font><font color="#ff00cc">i</font><font color="#ff00cc"> </font><font color="#ff00cc">in</font><font color="#ff00cc"> </font><font color="#ff00cc">1</font><font color="#ff00cc">.</font><font color="#ff00cc">.</font><font color="#ff00cc">3</font><font color="#ff00cc">:</font>
<font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">print</font><font color="#ff00cc"> </font><font color="#ff00cc">i</font>
<font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">&quot;&quot;&quot;</font>

    result <font color="#000000"><strong>=</strong></font> parse<font color="#000000"><strong>(</strong></font>code<font color="#000000"><strong>)</strong></font>
    <font color="#0099ff"><strong>assert</strong></font> <font color="#ff0000">0</font> <font color="#000000"><strong>=</strong></font><font color="#000000"><strong>=</strong></font> <font color="#0099ff"><strong>len</strong></font><font color="#000000"><strong>(</strong></font>result.Errors<font color="#000000"><strong>)</strong></font>, result.Errors.ToString<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>
    <font color="#0099ff"><strong>assert</strong></font> <font color="#ff0000">1</font> <font color="#000000"><strong>=</strong></font><font color="#000000"><strong>=</strong></font> <font color="#0099ff"><strong>len</strong></font><font color="#000000"><strong>(</strong></font>result.CompileUnit.Modules<font color="#000000"><strong>)</strong></font>
    <font color="#0099ff"><strong>print</strong></font> result.CompileUnit.Modules<font color="#000000"><strong>[</strong></font><font color="#ff0000">0</font><font color="#000000"><strong>]</strong></font>.ToCodeString<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>
</font></pre>
</p>
<p>And the output is, of course:
<br />
<pre style="padding: 1cm; background-color: black; color: white">
	import metaboo.Units
	import metaboo.Ranges
	
	a = Mass(3, 'kg')
	print a
	for i in range(1, 3):
		print i
</pre>
</p>]]></description>
<dc:subject>boo</dc:subject>
<dc:creator>bamboo</dc:creator>
<dc:date>2008-08-05T09:52:06-03:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/bamboo/archives/001698_boo_082_is_here.html">
<title>boo 0.8.2 is here</title>
<link>http://blogs.codehaus.org/people/bamboo/archives/001698_boo_082_is_here.html</link>
<description><![CDATA[<p>Yeah, it's that time again!</p>
<p>As usual <a href="http://jira.codehaus.org/secure/IssueNavigator.jspa?reset=true&amp;pid=10671&amp;fixfor=13814http://jira.codehaus.org/secure/IssueNavigator.jspa?reset=true&amp;pid=10671&amp;fixfor=13814">lots and lots of improvements</a> in this new release including:</p>
<ul>
  <li><a href="http://jira.codehaus.org/browse/BOO-807">complete</a> <a href="http://jira.codehaus.org/browse/BOO-805">nullable</a> <a href="http://jira.codehaus.org/browse/BOO-985">type</a> <a href="http://jira.codehaus.org/browse/BOO-822">support</a><br /></li>

  <li><a href="http://jira.codehaus.org/browse/BOO-619">special notation</a> for nullable types (T?) and enumerables (T*)<br /></li>

  <li><a href="http://jira.codehaus.org/browse/BOO-1002">improved booish behavior</a> with nicer colors (it should work inside emacs now :))</li>

  <li><a href="http://jira.codehaus.org/browse/BOO-988">'else' block</a> for 'for' and 'while loops</li>

  <li><a href="http://jira.codehaus.org/browse/BOO-1013">generics</a>, <a href="http://jira.codehaus.org/browse/BOO-1016">generics</a>, <a href="http://jira.codehaus.org/browse/BOO-1005">generics</a></li>

  <li>and <a href="http://jira.codehaus.org/browse/BOO-977">generics</a>!</li>
</ul>
<p>With many many kudos to Avishay Lavie, C&#233;dric Vivier and Marcus Griep!</p>
<p>C&#233;dric deserves special mention for working on all fronts and really pushing for the release. Superb work!</p>
<p>What? - <a href="http://boo.codehaus.org/">http://boo.codehaus.org/</a></p>
<p>Download - <a href="http://boo.codehaus.org/Download">http://boo.codehaus.org/Download</a></p>
<p>Official irc channel - <a href="irc://irc.codehaus.org/boo">irc://irc.codehaus.org/boo</a></p>
<p>Have fun!</p>
]]></description>
<dc:subject></dc:subject>
<dc:creator>bamboo</dc:creator>
<dc:date>2008-05-20T20:06:45-03:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/bamboo/archives/001688_towards_extensible_parsing.html">
<title>Towards Extensible Parsing</title>
<link>http://blogs.codehaus.org/people/bamboo/archives/001688_towards_extensible_parsing.html</link>
<description><![CDATA[<p style="font-size: 15px;">Almost four years ago <a href="http://jira.codehaus.org/browse/BOO-1">the first feature request</a> was entered into the boo issue tracker.</p>
<blockquote>
  <p style="font-size: 15px;">There should be a way to extend the parser so it could recognize custom measurement unit literals such as <strong>1kg</strong> and <strong>2cm</strong>.</p>
</blockquote>
<p style="font-size: 15px;">Since then boo has improved a lot but with no solution for BOO-1 in the horizon.</p>
<p style="font-size: 15px;">I think I'm getting close to solve it in a interesting way using <a href="http://citeseer.ist.psu.edu/643425.html">PEGs</a> implemented as a <a href="http://en.wikipedia.org/wiki/Interpreter_pattern">graph of expression objects</a>.</p>
<p style="font-size: 15px;">PEGs are very likable. Conceptually simple and composable.</p>
<p style="font-size: 15px;">Take the PEG that recognizes integer expressions involving the <strong>+</strong> and <strong>*</strong> operators:</p>
<blockquote>
  <p style="font-size: 15px;">grammar &lt;- spaces addition eof<br />
  addition &lt;- term ("+" spaces term)*<br />
  term &lt;- factor ("*" spaces factor)*<br />
  factor &lt;- [0-9]+ spaces<br />
  spaces &lt;- (' ' / '\t')*<br />
  eof &lt;- !.</p>
</blockquote>
<p style="font-size: 15px;">where:</p>
<blockquote>
  <p style="font-size: 15px;"><strong>()</strong> means grouping.</p>

  <p style="font-size: 15px;"><strong>*</strong> means zero or more matches.</p>

  <p style="font-size: 15px;"><strong>+</strong> means one or more matches.</p>

  <p style="font-size: 15px;"><strong>/</strong> is the prioritized choice operator. If the first expression succeeds, the whole expression succeeds. If the first expression fails, it backtracks and evaluates the second expression.</p>

  <p style="font-size: 15px;"><strong>!</strong> is the not predicate operator which succeeds if its operand fails. It never consumes any input.</p>

  <p style="font-size: 15px;"><strong>.</strong> matches any input.</p>
</blockquote>
<p style="font-size: 15px;">The grammar can be translated to boo very simply using the <strong>peg</strong> macro from <a href="http://code.google.com/p/boo-extensions/source/browse/trunk/extensions/src/Boo.Pegs">Boo.Pegs</a>:</p>
<blockquote>
  <pre>
<font color="#000000"><font color="#006699"><strong>import</strong></font> Boo.Pegs

peg<font color="#000000"><strong>:</strong></font>
    grammar <font color="#000000"><strong>=</strong></font> spaces, addition, eof
    addition <font color="#000000"><strong>=</strong></font> term, <font color="#000000"><strong>--</strong></font><font color="#000000"><strong>(</strong></font><font color="#FF00CC">"</font><font color="#FF00CC">+</font><font color="#FF00CC">"</font>, spaces, term<font color="#000000"><strong>)</strong></font>
    term <font color="#000000"><strong>=</strong></font> factor, <font color="#000000"><strong>--</strong></font><font color="#000000"><strong>(</strong></font><font color="#FF00CC">"</font><font color="#FF00CC">*</font><font color="#FF00CC">"</font>, spaces, factor<font color="#000000"><strong>)</strong></font>
    factor <font color="#000000"><strong>=</strong></font> <font color="#000000"><strong>++</strong></font><font color="#000000"><strong>[</strong></font><font color="#FF0000">0</font><font color="#000000"><strong>-</strong></font><font color="#FF0000">9</font><font color="#000000"><strong>]</strong></font>, spaces
    spaces <font color="#000000"><strong>=</strong></font> <font color="#000000"><strong>--</strong></font><font color="#000000"><strong>(</strong></font><font color="#CC00CC">'</font><font color="#CC00CC"> </font><font color="#CC00CC">'</font> <font color="#000000"><strong>/</strong></font> <font color="#CC00CC">'</font><font color="#CC00CC">\t</font><font color="#CC00CC">'</font><font color="#000000"><strong>)</strong></font>
    eof <font color="#000000"><strong>=</strong></font> <font color="#006699"><strong>not</strong></font> any<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>
    
<font color="#0099FF"><strong>assert</strong></font> grammar.Match<font color="#000000"><strong>(</strong></font>PegContext<font color="#000000"><strong>(</strong></font><font color="#FF00CC">"</font><font color="#FF00CC"> </font><font color="#FF00CC"> </font><font color="#FF00CC">6</font><font color="#FF00CC">*</font><font color="#FF00CC">6</font><font color="#FF00CC"> </font><font color="#FF00CC">+</font><font color="#FF00CC"> </font><font color="#FF00CC">6</font><font color="#FF00CC"> </font><font color="#FF00CC">"</font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font></font>
</pre>
</blockquote>
<p style="font-size: 15px;">I had to be a little creative in mapping the PEG operators to valid boo expressions because as it must be clear by now boo doesn't allow the introduction of completely new syntax and that's what the fuss is all about here.</p>
<p style="font-size: 15px;">I actually like the way it looks.</p>
<p style="font-size: 15px;">Implementing something more useful such as expression evaluation on top of that requires a few semantic actions operating a stack:</p>
<blockquote>
  <pre>
<font color="#000000"><font color="#006699"><strong>import</strong></font> Boo.Pegs
<font color="#006699"><strong>import</strong></font> System.Collections.Generic

stack <font color="#000000"><strong>=</strong></font> Stack<font color="#000000"><strong>[</strong></font><font color="#006699"><strong>of</strong></font> <font color="#009966"><strong>int</strong></font><font color="#000000"><strong>]</strong></font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>
push <font color="#000000"><strong>=</strong></font> stack.Push
pop <font color="#000000"><strong>=</strong></font> stack.Pop

peg<font color="#000000"><strong>:</strong></font>
    grammar <font color="#000000"><strong>=</strong></font> spaces, addition, eof
    addition <font color="#000000"><strong>=</strong></font> term, <font color="#000000"><strong>--</strong></font><font color="#000000"><strong>(</strong></font><font color="#FF00CC">"</font><font color="#FF00CC">+</font><font color="#FF00CC">"</font>, spaces, term, <font color="#000000"><strong>{</strong></font> push<font color="#000000"><strong>(</strong></font>pop<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>+</strong></font> pop<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>}</strong></font><font color="#000000"><strong>)</strong></font>
    term <font color="#000000"><strong>=</strong></font> factor, <font color="#000000"><strong>--</strong></font><font color="#000000"><strong>(</strong></font><font color="#FF00CC">"</font><font color="#FF00CC">*</font><font color="#FF00CC">"</font>, spaces, factor, <font color="#000000"><strong>{</strong></font> push<font color="#000000"><strong>(</strong></font>pop<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>*</strong></font> pop<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>}</strong></font><font color="#000000"><strong>)</strong></font>
    factor <font color="#000000"><strong>=</strong></font> <font color="#000000"><strong>++</strong></font><font color="#000000"><strong>[</strong></font><font color="#FF0000">0</font><font color="#000000"><strong>-</strong></font><font color="#FF0000">9</font><font color="#000000"><strong>]</strong></font>, <font color="#000000"><strong>{</strong></font> push<font color="#000000"><strong>(</strong></font><font color="#009966"><strong>int</strong></font>.Parse<font color="#000000"><strong>(</strong></font>$text<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>}</strong></font>, spaces
    spaces <font color="#000000"><strong>=</strong></font> <font color="#000000"><strong>--</strong></font><font color="#000000"><strong>(</strong></font><font color="#CC00CC">'</font><font color="#CC00CC"> </font><font color="#CC00CC">'</font> <font color="#000000"><strong>/</strong></font> <font color="#CC00CC">'</font><font color="#CC00CC">\t</font><font color="#CC00CC">'</font><font color="#000000"><strong>)</strong></font>
    eof <font color="#000000"><strong>=</strong></font> <font color="#006699"><strong>not</strong></font> any<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>
    
<font color="#0099FF"><strong>assert</strong></font> grammar.Match<font color="#000000"><strong>(</strong></font>PegContext<font color="#000000"><strong>(</strong></font><font color="#FF00CC">"</font><font color="#FF00CC"> </font><font color="#FF00CC"> </font><font color="#FF00CC">6</font><font color="#FF00CC">*</font><font color="#FF00CC">6</font><font color="#FF00CC"> </font><font color="#FF00CC">+</font><font color="#FF00CC"> </font><font color="#FF00CC">6</font><font color="#FF00CC"> </font><font color="#FF00CC">"</font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>
<font color="#0099FF"><strong>assert</strong></font> <font color="#FF0000">42</font> <font color="#000000"><strong>=</strong></font><font color="#000000"><strong>=</strong></font> pop<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font></font>
</pre>
</blockquote>
<p style="font-size: 15px;">Semantic actions are just closures that get executed as matching succeeds. <strong>$text</strong> returns the text matched so far by the current rule.</p>
<p style="font-size: 15px;">Beautiful.</p>
<p style="font-size: 15px;">The underlying implementation based on a graph of expression objects really shines when one considers what it takes to extend the grammar above with support for hexadecimal literals:</p>
<blockquote>
  <pre>
<font color="#000000">peg<font color="#000000"><strong>:</strong></font>
    <font color="#CC0000">//</font><font color="#CC0000"> </font><font color="#CC0000">rebind</font>
    factor.Expression <font color="#000000"><strong>=</strong></font> hex_number <font color="#000000"><strong>/</strong></font> factor.Expression
    hex_number <font color="#000000"><strong>=</strong></font> <font color="#FF00CC">"</font><font color="#FF00CC">0x</font><font color="#FF00CC">"</font>, <font color="#000000"><strong>++</strong></font>hex_digit, <font color="#000000"><strong>{</strong></font> push<font color="#000000"><strong>(</strong></font><font color="#009966"><strong>int</strong></font>.Parse<font color="#000000"><strong>(</strong></font>$text<font color="#000000"><strong>[</strong></font><font color="#FF0000">2</font><font color="#000000"><strong>:</strong></font><font color="#000000"><strong>]</strong></font>, NumberStyles.HexNumber<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>}</strong></font>, spaces
    hex_digit <font color="#000000"><strong>=</strong></font> <font color="#000000"><strong>[</strong></font><font color="#FF0000">0</font><font color="#000000"><strong>-</strong></font><font color="#FF0000">9</font>, a<font color="#000000"><strong>-f</strong></font>, A<font color="#000000"><strong>-<span style="font-weight: normal;">F</span></strong></font><font color="#000000"><strong>]</strong></font>
<font color="#0099FF"><strong>assert</strong></font> grammar.Match<font color="#000000"><strong>(</strong></font>PegContext<font color="#000000"><strong>(</strong></font><font color="#FF00CC">"</font><font color="#FF00CC"> </font><font color="#FF00CC"> </font><font color="#FF00CC">0xa</font><font color="#FF00CC">*</font><font color="#FF00CC">2</font><font color="#FF00CC"> </font><font color="#FF00CC">+</font><font color="#FF00CC"> </font><font color="#FF00CC">11</font><font color="#FF00CC">*</font><font color="#FF00CC">0x02</font><font color="#FF00CC">"</font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>
<font color="#0099FF"><strong>assert</strong></font> <font color="#FF0000">42</font> <font color="#000000"><strong>=</strong></font><font color="#000000"><strong>=</strong></font> pop<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font></font>
</pre>
</blockquote>
<p style="font-size: 15px;">It's not yet clear how this extensibility mechanism will be exposed at the boo language level but the simplicity at the peg level is encouraging.</p>
<p style="font-size: 15px;">One last feature worth pointing out is the ability to match based on a previously matched rule. For instance, the closing tag of a xml element must match the name in the starting tag:</p>
<blockquote>
  <pre>
<font color="#000000"><font color="#006699"><strong>import</strong></font> Boo.Pegs

peg<font color="#000000"><strong>:</strong></font>
    element <font color="#000000"><strong>=</strong></font> <font color="#CC00CC">'</font><font color="#CC00CC">&lt;</font><font color="#CC00CC">'</font>, tag, <font color="#CC00CC">'</font><font color="#CC00CC">&gt;</font><font color="#CC00CC">'</font>, content, <font color="#CC00CC">'</font><font color="#CC00CC">'</font>, @tag, <font color="#CC00CC">'</font><font color="#CC00CC">&gt;</font><font color="#CC00CC">'</font>
    tag <font color="#000000"><strong>=</strong></font> <font color="#000000"><strong>++</strong></font><font color="#000000"><strong>(</strong></font>a<font color="#000000"><strong>-</strong></font>z<font color="#000000"><strong>)</strong></font>
    content <font color="#000000"><strong>=</strong></font> <font color="#000000"><strong>--</strong></font><font color="#000000"><strong>(</strong></font>element <font color="#000000"><strong>/</strong></font> text<font color="#000000"><strong>)</strong></font>
    text <font color="#000000"><strong>=</strong></font> <font color="#006699"><strong>not</strong></font> <font color="#FF00CC">"</font><font color="#FF00CC">&lt;</font><font color="#FF00CC">"</font>, any<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>
    
<font color="#0099FF"><strong>assert</strong></font> element.Match<font color="#000000"><strong>(</strong></font>PegContext<font color="#000000"><strong>(</strong></font><font color="#FF00CC">"</font><font color="#FF00CC">&lt;</font><font color="#FF00CC">foo</font><font color="#FF00CC">&gt;</font><font color="#FF00CC">&lt;</font><font color="#FF00CC">bar</font><font color="#FF00CC">&gt;</font><font color="#FF00CC">Hello</font><font color="#FF00CC">&lt;</font><font color="#FF00CC">/</font><font color="#FF00CC">bar</font><font color="#FF00CC">&gt;</font><font color="#FF00CC">&lt;</font><font color="#FF00CC">/</font><font color="#FF00CC">foo</font><font color="#FF00CC">&gt;</font><font color="#FF00CC">"</font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font></font>
</pre>
</blockquote>
<p style="font-size: 15px;">I've found the idea for the <span style="font-style: italic;">last</span> <span style="font-style: italic;">match</span> operator <strong>@</strong> first described in <a href="http://www.mail-archive.com/peg@lists.csail.mit.edu/msg00020.html">this article</a>. Great idea.</p>
<p style="font-size: 15px;">I've been also greatly inspired by conversations I've had with <a href="http://primates.ximian.com/~massi/blog/">Massi</a> who's <a href="http://primates.ximian.com/~massi/blog/archive/2008/Feb-03.html">exploring similar territory</a> and <a href="http://evain.net/blog/">Jb</a> during the last Mono Meeting in <del>Barcelona</del> Madrid and with <a href="http://www.ohloh.net/accounts/3973">Cedric</a> over a beer in Paris. I think Massi will be pleased to know that I haven't given any thoughts to performance leaving all the fun to him.</p>
<p style="font-size: 15px;">Extensible parsing. Soon in a boo compiler close to you.</p>
<p style="font-size: 15px;"><br /></p>
]]></description>
<dc:subject></dc:subject>
<dc:creator>bamboo</dc:creator>
<dc:date>2008-05-09T01:40:19-03:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/bamboo/archives/001659_boo_081_is_here.html">
<title>boo 0.8.1 is here</title>
<link>http://blogs.codehaus.org/people/bamboo/archives/001659_boo_081_is_here.html</link>
<description><![CDATA[<p><a href="http://jira.codehaus.org/secure/IssueNavigator.jspa?reset=true&amp;pid=10671&amp;fixfor=13813" target="_blank">Lots of improvements</a> in this release including a <a href="http://jira.codehaus.org/browse/BOO-95" target="_blank">simpler way for writing macros</a>, support for <a href="http://jira.codehaus.org/browse/BOO-926" target="_blank">nested functions</a>, a <a href="http://jira.codehaus.org/browse/BOO-834" target="_blank">better interactive interpreter</a>, error messages that include <a href="http://jira.codehaus.org/browse/BOO-959" target="_blank">suggestions for misspelled names</a>, <a href="http://jira.codehaus.org/browse/BOO-879" target="_blank">exception filters</a>, <a href="http://jira.codehaus.org/browse/BOO-880" target="_blank">exception fault handlers</a> and <a href="http://jira.codehaus.org/browse/BOO-24" target="_blank">for loop IDisposeable.Dispose integration</a>.</p> <p>With many many kudos to Avishay Lavie, Cédric Vivier, Daniel Grunwald and Marcus Griep!</p> <p>What? - <a href="http://boo.codehaus.org/">http://boo.codehaus.org/</a><br>Download - <a href="http://boo.codehaus.org/Download">http://boo.codehaus.org/Download</a><br>Official irc channel - irc://irc.codehaus.org/boo</p> <p>Have fun!</p>]]></description>
<dc:subject>boo</dc:subject>
<dc:creator>bamboo</dc:creator>
<dc:date>2008-02-08T14:34:42-03:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/bamboo/archives/001648_make_the_world_a_better_place_with_boo.html">
<title>Make the world a better place with boo</title>
<link>http://blogs.codehaus.org/people/bamboo/archives/001648_make_the_world_a_better_place_with_boo.html</link>
<description><![CDATA[<p></p> <p>Gaiaware has just announced the <a href="http://ajaxwidgets.com/news_gaia_programming_contest.aa">Gaia Programming Contest</a>. A contest "... about creating an Ajax Application that will serve as a meeting place for people dedicated to solving environmental issues...". </p> <p>Very good but there's more: "... no Close Source dependencies can be used which means that the end product must be compilable on <a href="http://www.mono-project.com/Main_Page">Mono</a> ...". Great!</p> <p>Of course people using <a href="http://boo.codehaus.org/">boo</a> and <a href="http://www.db4o.com/">db4o</a> have a huge headstart. So what are you waiting for?</p>]]></description>
<dc:subject>boo</dc:subject>
<dc:creator>bamboo</dc:creator>
<dc:date>2007-12-20T17:19:31-03:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/bamboo/archives/001641_boo_babel.html">
<title>Boo Babel</title>
<link>http://blogs.codehaus.org/people/bamboo/archives/001641_boo_babel.html</link>
<description><![CDATA[<p>As I went through the conference memories I recovered this one conversation I had with <a href="http://blog.secondlife.com/author/babbagelinden/">Jim Purbrick</a> after the boo presentation.</p> <p>His idea would be to have boo as the language for building languages in Second Life.</p> <p><a href="http://en.wikipedia.org/wiki/Power_to_the_People_%28song%29">Niiiiice</a>.</p>]]></description>
<dc:subject>boo</dc:subject>
<dc:creator>bamboo</dc:creator>
<dc:date>2007-12-04T15:17:33-03:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/bamboo/archives/001640_back_from_the_mono_summit_07.html">
<title>Back From the Mono Summit 07</title>
<link>http://blogs.codehaus.org/people/bamboo/archives/001640_back_from_the_mono_summit_07.html</link>
<description><![CDATA[<p><img src="http://www.mono-project.com/files/4/42/Summit.png" align="right"> </p> <p>What a great experience.  <p>A chance to interact live with a <a href="http://evain.net/blog/">dear friend</a>. Free Software, Hacking, Women, Futurama, McDonalds, love spreading, Militant Atheism, Monty Python, Douglas Adams and the French Way.  <p>Had lots of interesting exchange of ideas with <a href="http://primates.ximian.com/~massi/all.html">Massi</a>, ranging from "extensible parsing through composeable PEGs with&nbsp; optimal performance" to Carlos Castañeda, Jesus Christ, meta-physics, religion and Pink Floyd. The <a href="http://en.wikipedia.org/wiki/Cryptonomicon">Cryptonomicon</a> really got me.  <p>Got to put a face on <a href="http://forum.unity3d.com/profile.php?mode=viewprofile&amp;u=3">Joachim</a> and see how really cool <a href="http://otee.dk/">Unity</a> is.  <p><a href="http://weblog.ikvm.net/">Jeroen IKVM Frijters</a> is a funny guy!  <p>On Thursday I got to <a href="http://codehaus.org/~bamboo/MonoSummit07-db4o.pdf">talk</a> about <a href="http://www.db4o.com/">db4o</a> which led me to meet a few db4o users hanging around the conference.  <blockquote> <p>Pedro Santos had an interesting question, how to monitor and control the usage of computational resources in a managed client/server application? In other words, how a sysadmin can make sure a specific client won't DOS the application?  <p>For .NET servers running on Windows there are performance counters, what about Mono servers running on Linux?</p></blockquote> <p>I've also got to spread the gospel about <a href="http://boo.codehaus.org/">boo</a> for which I got a hugely positive response.  <blockquote> <p><a href="http://ajaxwidgets.com/Blogs/thomas.bb">Thomas "Gaia" Hansen</a> seemed to really get it and so we had lots of interesting discussions on how to take over the world boo style.</p> <p><a href="http://jacksonito.blogspot.com/">Jackson</a> wants to hack on better nullable type support for boo!</p> <p><a href="http://schani.wordpress.com/">Mark</a> wants an extensible language where NullReferenceExceptions are impossible.</p> <p><a href="http://tirania.org/blog/index.html">Miguel</a> reassured me once again mcs won't be rewritten on top of the boo compiler infrastructure :)</p></blockquote> <p>The presentation material is <a href="http://boo.codehaus.org/MonoSummit2007/">here</a>.  <p>Looking forward to the next one.  ]]></description>
<dc:subject>boo</dc:subject>
<dc:creator>bamboo</dc:creator>
<dc:date>2007-12-04T09:43:44-03:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/bamboo/archives/001637_mono_summit_2007.html">
<title>Mono Summit 2007</title>
<link>http://blogs.codehaus.org/people/bamboo/archives/001637_mono_summit_2007.html</link>
<description><![CDATA[<p>
So it's official now, I'll be speaking at the <a href="http://www.mono-project.com/Mono_Summit_2007_Schedule">Mono Summit 2007</a>. <br /><br />
It will be great to see you there!<br /><br />

Many thanks to the great folks at <a href="http://www.db4o.com/">db4o</a> for sponsoring my trip.</br >
</p>]]></description>
<dc:subject>technology</dc:subject>
<dc:creator>bamboo</dc:creator>
<dc:date>2007-11-13T14:54:04-03:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/bamboo/archives/001631_mockingboo_with_meta_programming_facilities.html">
<title>MockingBoo with meta programming facilities</title>
<link>http://blogs.codehaus.org/people/bamboo/archives/001631_mockingboo_with_meta_programming_facilities.html</link>
<description><![CDATA[<p><a href="http://ayende.com/Blog/Default.aspx">Oren</a> talks about a <a href="http://ayende.com/Blog/archive/2007/10/30/Mocking-Boo.aspx">simple but interesting macro to aid with mocking</a>. I decided to see if and how the latest meta programming facilities I've been working on are actually useful. Here's the complete application, what do you think?
</p>
<pre><font color="#000000">    <font color="#006699"><strong>namespace</strong></font> Adapter

    <font color="#006699"><strong>import</strong></font> Boo.Lang.Compiler
    <font color="#006699"><strong>import</strong></font> Boo.Lang.Compiler.Ast
    <font color="#006699"><strong>import</strong></font> Boo.Lang.Compiler.Ast.Visitors
    <font color="#006699"><strong>import</strong></font> Boo.Lang.Compiler.TypeSystem
    <font color="#006699"><strong>import</strong></font> Boo.Lang.Compiler.MetaProgramming

    <font color="#006699"><strong>class</strong></font> AdapterMacro<font color="#000000"><strong>(</strong></font>AbstractAstMacro<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
        <font color="#006699"><strong>def</strong></font> Expand<font color="#000000"><strong>(</strong></font>macro <font color="#006699"><strong>as</strong></font> MacroStatement<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
            <font color="#006699"><strong>if</strong></font> macro.Arguments.Count <font color="#000000"><strong>!=</strong></font> <font color="#ff0000">1</font> <font color="#006699"><strong>or</strong></font> <font color="#006699"><strong>not</strong></font> macro.Arguments<font color="#000000"><strong>[</strong></font><font color="#ff0000">0</font><font color="#000000"><strong>]</strong></font> <font color="#006699"><strong>isa</strong></font> ReferenceExpression<font color="#000000"><strong>:</strong></font>
                <font color="#006699"><strong>raise</strong></font> <font color="#ff00cc">&quot;</font><font color="#ff00cc">adapter</font><font color="#ff00cc"> </font><font color="#ff00cc">must</font><font color="#ff00cc"> </font><font color="#ff00cc">be</font><font color="#ff00cc"> </font><font color="#ff00cc">called</font><font color="#ff00cc"> </font><font color="#ff00cc">with</font><font color="#ff00cc"> </font><font color="#ff00cc">a</font><font color="#ff00cc"> </font><font color="#ff00cc">single</font><font color="#ff00cc"> </font><font color="#ff00cc">argument</font><font color="#ff00cc">&quot;</font>

            entity <font color="#000000"><strong>=</strong></font> NameResolutionService.Resolve<font color="#000000"><strong>(</strong></font>macro.Arguments<font color="#000000"><strong>[</strong></font><font color="#ff0000">0</font><font color="#000000"><strong>]</strong></font>.ToString<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>
            <font color="#006699"><strong>raise</strong></font> <font color="#ff00cc">&quot;</font><font color="#ff00cc">adapter</font><font color="#ff00cc"> </font><font color="#ff00cc">only</font><font color="#ff00cc"> </font><font color="#ff00cc">accept</font><font color="#ff00cc"> </font><font color="#ff00cc">types</font><font color="#ff00cc">&quot;</font> <font color="#006699"><strong>unless</strong></font> entity.EntityType <font color="#000000"><strong>=</strong></font><font color="#000000"><strong>=</strong></font> EntityType.Type
            BuildType<font color="#000000"><strong>(</strong></font>macro, entity<font color="#000000"><strong>)</strong></font>

        <font color="#006699"><strong>def</strong></font> GetModule<font color="#000000"><strong>(</strong></font>node <font color="#006699"><strong>as</strong></font> Node<font color="#000000"><strong>)</strong></font> <font color="#006699"><strong>as</strong></font> Boo.Lang.Compiler.Ast.Module<font color="#000000"><strong>:</strong></font>
            <font color="#006699"><strong>return</strong></font> node.GetAncestor<font color="#000000"><strong>(</strong></font>NodeType.Module<font color="#000000"><strong>)</strong></font>

        <font color="#006699"><strong>def</strong></font> BuildType<font color="#000000"><strong>(</strong></font>macro <font color="#006699"><strong>as</strong></font> MacroStatement, type <font color="#006699"><strong>as</strong></font> IType<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
            adapterInterface <font color="#000000"><strong>=</strong></font> <font color="#000000"><strong>[</strong></font><font color="#000000"><strong>|</strong></font>
                <font color="#006699"><strong>interface</strong></font> $<font color="#000000"><strong>(</strong></font><font color="#ff00cc">&quot;</font><font color="#ff00cc">I</font><font color="#ff00cc">&quot;</font> <font color="#000000"><strong>+</strong></font> type.Name<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
                    <font color="#006699"><strong>pass</strong></font>
            <font color="#000000"><strong>|</strong></font><font color="#000000"><strong>]</strong></font>

            adapter <font color="#000000"><strong>=</strong></font> <font color="#000000"><strong>[</strong></font><font color="#000000"><strong>|</strong></font>
                <font color="#006699"><strong>class</strong></font> $<font color="#000000"><strong>(</strong></font>type.Name <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">&quot;</font><font color="#ff00cc">Adapter</font><font color="#ff00cc">&quot;</font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>(</strong></font>$adapterInterface<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>

                    theTarget <font color="#006699"><strong>as</strong></font> $<font color="#000000"><strong>(</strong></font>type.FullName<font color="#000000"><strong>)</strong></font>

                    <font color="#006699"><strong>def</strong></font> <font color="#006699"><strong>constructor</strong></font><font color="#000000"><strong>(</strong></font>target <font color="#006699"><strong>as</strong></font> $<font color="#000000"><strong>(</strong></font>type.FullName<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
                        theTarget <font color="#000000"><strong>=</strong></font> target
            <font color="#000000"><strong>|</strong></font><font color="#000000"><strong>]</strong></font>

            GetModule<font color="#000000"><strong>(</strong></font>macro<font color="#000000"><strong>)</strong></font>.Members.Add<font color="#000000"><strong>(</strong></font>adapter<font color="#000000"><strong>)</strong></font>
            GetModule<font color="#000000"><strong>(</strong></font>macro<font color="#000000"><strong>)</strong></font>.Members.Add<font color="#000000"><strong>(</strong></font>adapterInterface<font color="#000000"><strong>)</strong></font>

            <font color="#006699"><strong>for</strong></font> member <font color="#006699"><strong>in</strong></font> type.GetMembers<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
                AddMethod<font color="#000000"><strong>(</strong></font>adapter, adapterInterface,  member<font color="#000000"><strong>)</strong></font> <font color="#006699"><strong>if</strong></font> member <font color="#006699"><strong>isa</strong></font> IMethod

            BooPrinterVisitor<font color="#000000"><strong>(</strong></font>System.Console.Out<font color="#000000"><strong>)</strong></font>.Visit<font color="#000000"><strong>(</strong></font>adapterInterface<font color="#000000"><strong>)</strong></font>
            BooPrinterVisitor<font color="#000000"><strong>(</strong></font>System.Console.Out<font color="#000000"><strong>)</strong></font>.Visit<font color="#000000"><strong>(</strong></font>adapter<font color="#000000"><strong>)</strong></font>

        <font color="#006699"><strong>def</strong></font> AddMethod<font color="#000000"><strong>(</strong></font>adapter <font color="#006699"><strong>as</strong></font> ClassDefinition,
                adapterInterface <font color="#006699"><strong>as</strong></font> InterfaceDefinition,
                method <font color="#006699"><strong>as</strong></font> IMethod<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>

            <font color="#006699"><strong>if</strong></font> <font color="#006699"><strong>not</strong></font> method.IsPublic<font color="#000000"><strong>:</strong></font> <font color="#006699"><strong>return</strong></font>
            <font color="#006699"><strong>if</strong></font> method.IsStatic<font color="#000000"><strong>:</strong></font> <font color="#006699"><strong>return</strong></font>
            <font color="#006699"><strong>if</strong></font> method.ReturnType.IsByRef<font color="#000000"><strong>:</strong></font> <font color="#006699"><strong>return</strong></font>
            <font color="#006699"><strong>if</strong></font> method.ReturnType.IsArray<font color="#000000"><strong>:</strong></font> <font color="#006699"><strong>return</strong></font>

            interfaceMethod <font color="#000000"><strong>=</strong></font> <font color="#000000"><strong>[</strong></font><font color="#000000"><strong>|</strong></font>
                <font color="#006699"><strong>def</strong></font> $<font color="#000000"><strong>(</strong></font>method.Name<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font> <font color="#006699"><strong>as</strong></font> $<font color="#000000"><strong>(</strong></font>method.ReturnType.FullName<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
                    <font color="#006699"><strong>pass</strong></font>
            <font color="#000000"><strong>|</strong></font><font color="#000000"><strong>]</strong></font>

            forwarder <font color="#000000"><strong>=</strong></font> interfaceMethod.CloneNode<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>

            forwardInvocation <font color="#000000"><strong>=</strong></font> <font color="#000000"><strong>[</strong></font><font color="#000000"><strong>|</strong></font> theTarget.$<font color="#000000"><strong>(</strong></font>method.Name<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>|</strong></font><font color="#000000"><strong>]</strong></font>
            <font color="#006699"><strong>for</strong></font> param <font color="#006699"><strong>in</strong></font> method.GetParameters<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
                <font color="#006699"><strong>if</strong></font> param.IsByRef <font color="#006699"><strong>or</strong></font> param.Type.IsArray<font color="#000000"><strong>:</strong></font>
                    <font color="#006699"><strong>return</strong></font>

                forwarder.Parameters.Add<font color="#000000"><strong>(</strong></font>
                    ParameterDeclaration<font color="#000000"><strong>(</strong></font>
                        Name<font color="#000000"><strong>:</strong></font> param.Name,
                        Type<font color="#000000"><strong>:</strong></font> SimpleTypeReference<font color="#000000"><strong>(</strong></font>param.Type.FullName<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>

                interfaceMethod.Parameters.Add<font color="#000000"><strong>(</strong></font>
                    ParameterDeclaration<font color="#000000"><strong>(</strong></font>
                        Name<font color="#000000"><strong>:</strong></font> param.Name,
                        Type<font color="#000000"><strong>:</strong></font> SimpleTypeReference<font color="#000000"><strong>(</strong></font>param.Type.FullName<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>

                forwardInvocation.Arguments.Add<font color="#000000"><strong>(</strong></font>ReferenceExpression<font color="#000000"><strong>(</strong></font>param.Name<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>


            adapterInterface.Members.Add<font color="#000000"><strong>(</strong></font>interfaceMethod<font color="#000000"><strong>)</strong></font>
            adapter.Members.Add<font color="#000000"><strong>(</strong></font>forwarder<font color="#000000"><strong>)</strong></font>

            <font color="#006699"><strong>if</strong></font> method.ReturnType <font color="#000000"><strong>=</strong></font><font color="#000000"><strong>=</strong></font> TypeSystemServices.VoidType<font color="#000000"><strong>:</strong></font>
                forwarder.Body.Add<font color="#000000"><strong>(</strong></font>forwardInvocation<font color="#000000"><strong>)</strong></font>
            <font color="#006699"><strong>else</strong></font><font color="#000000"><strong>:</strong></font>
                forwarder.Body.Add<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>[</strong></font><font color="#000000"><strong>|</strong></font> <font color="#006699"><strong>return</strong></font> $forwardInvocation <font color="#000000"><strong>|</strong></font><font color="#000000"><strong>]</strong></font><font color="#000000"><strong>)</strong></font>


    code <font color="#000000"><strong>=</strong></font> <font color="#000000"><strong>[</strong></font><font color="#000000"><strong>|</strong></font>
        <font color="#006699"><strong>import</strong></font> Adapter

        adapter <font color="#009966"><strong>int</strong></font>

        <font color="#0099ff"><strong>print</strong></font> Int32Adapter<font color="#000000"><strong>(</strong></font><font color="#ff0000">42</font><font color="#000000"><strong>)</strong></font> <font color="#006699"><strong>isa</strong></font> IInt32
    <font color="#000000"><strong>|</strong></font><font color="#000000"><strong>]</strong></font>

    <font color="#006699"><strong>try</strong></font><font color="#000000"><strong>:</strong></font>
        module <font color="#000000"><strong>=</strong></font> compile<font color="#000000"><strong>(</strong></font>code, <font color="#0099ff"><strong>typeof</strong></font><font color="#000000"><strong>(</strong></font>AdapterMacro<font color="#000000"><strong>)</strong></font>.Assembly<font color="#000000"><strong>)</strong></font>
        module.EntryPoint.Invoke<font color="#000000"><strong>(</strong></font><font color="#cc00cc">null</font>, <font color="#000000"><strong>(</strong></font><font color="#cc00cc">null</font>,<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>
    <font color="#006699"><strong>except</strong></font> x <font color="#006699"><strong>as</strong></font> CompilationErrorsException<font color="#000000"><strong>:</strong></font>
        <font color="#0099ff"><strong>print</strong></font> x.Errors.ToString<font color="#000000"><strong>(</strong></font><font color="#cc00cc">true</font><font color="#000000"><strong>)</strong></font>

</font></pre>
]]></description>
<dc:subject>boo</dc:subject>
<dc:creator>bamboo</dc:creator>
<dc:date>2007-10-31T09:50:27-03:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/bamboo/archives/001629_boojay_does_eclipse.html">
<title>boojay does eclipse</title>
<link>http://blogs.codehaus.org/people/bamboo/archives/001629_boojay_does_eclipse.html</link>
<description><![CDATA[<p>
<a href="http://www.flickr.com/photos/94072001@N00/1767840956/" title="Photo Sharing"><img src="http://farm3.static.flickr.com/2059/1767840956_c8051f9b17.jpg" width="500" height="374" alt="boojay does eclipse" /></a>
<br />
Today history was made. The first eclipse plugin written in boo and compiled down to java bytecodes by boojay has come to life. The plugin is a direct translation of the the plugin described <a href="http://www.eclipse.org/articles/Article-Your%20First%20Plug-in/YourFirstPlugin.html">here</a>.
<br />
And the boo code:
<br />
<pre><font color="#000000">    <font color="#ff00cc">&quot;&quot;&quot;</font>
<font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">Hello</font><font color="#ff00cc"> </font><font color="#ff00cc">World</font><font color="#ff00cc"> </font><font color="#ff00cc">eclipse</font><font color="#ff00cc"> </font><font color="#ff00cc">plugin</font><font color="#ff00cc">.</font>

<font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">A</font><font color="#ff00cc"> </font><font color="#ff00cc">direct</font><font color="#ff00cc"> </font><font color="#ff00cc">translation</font><font color="#ff00cc"> </font><font color="#ff00cc">of</font>
<font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">http</font><font color="#ff00cc">:</font><font color="#ff00cc">/</font><font color="#ff00cc">/</font><font color="#ff00cc">www</font><font color="#ff00cc">.</font><font color="#ff00cc">eclipse</font><font color="#ff00cc">.</font><font color="#ff00cc">org</font><font color="#ff00cc">/</font><font color="#ff00cc">articles</font><font color="#ff00cc">/</font><font color="#ff00cc">Article</font><font color="#ff00cc">-</font><font color="#ff00cc">Your</font><font color="#ff00cc">%</font><font color="#ff00cc">20First</font><font color="#ff00cc">%</font><font color="#ff00cc">20Plug</font><font color="#ff00cc">-</font><font color="#ff00cc">in</font><font color="#ff00cc">/</font><font color="#ff00cc">YourFirstPlugin</font><font color="#ff00cc">.</font><font color="#ff00cc">html</font>
<font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">to</font><font color="#ff00cc"> </font><font color="#ff00cc">boo</font><font color="#ff00cc">.</font>
<font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">&quot;&quot;&quot;</font>
    <font color="#006699"><strong>namespace</strong></font> HelloWorldPlugin

    <font color="#006699"><strong>import</strong></font> org.eclipse.ui
    <font color="#006699"><strong>import</strong></font> org.eclipse.jface.action
    <font color="#006699"><strong>import</strong></font> org.eclipse.jface.dialogs
    <font color="#006699"><strong>import</strong></font> org.eclipse.jface.viewers

    <font color="#006699"><strong>class</strong></font> HelloWorldAction<font color="#000000"><strong>(</strong></font>IWorkbenchWindowActionDelegate<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>

        activeWindow <font color="#006699"><strong>as</strong></font> IWorkbenchWindow

        <font color="#006699"><strong>def</strong></font> run<font color="#000000"><strong>(</strong></font>proxyAction <font color="#006699"><strong>as</strong></font> IAction<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
            <font color="#0099ff"><strong>shell</strong></font> <font color="#000000"><strong>=</strong></font> activeWindow.getShell<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>
            MessageDialog.openInformation<font color="#000000"><strong>(</strong></font><font color="#0099ff"><strong>shell</strong></font>, <font color="#ff00cc">&quot;</font><font color="#ff00cc">Hello</font><font color="#ff00cc"> </font><font color="#ff00cc">from</font><font color="#ff00cc"> </font><font color="#ff00cc">boojay</font><font color="#ff00cc">!</font><font color="#ff00cc">&quot;</font>, <font color="#ff00cc">&quot;</font><font color="#ff00cc">Hello</font><font color="#ff00cc"> </font><font color="#ff00cc">World</font><font color="#ff00cc">!</font><font color="#ff00cc">&quot;</font><font color="#000000"><strong>)</strong></font>

        <font color="#006699"><strong>def</strong></font> init<font color="#000000"><strong>(</strong></font>window <font color="#006699"><strong>as</strong></font> IWorkbenchWindow<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
            activeWindow <font color="#000000"><strong>=</strong></font> window

        <font color="#006699"><strong>def</strong></font> dispose<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
            <font color="#006699"><strong>pass</strong></font>

        <font color="#006699"><strong>def</strong></font> selectionChanged<font color="#000000"><strong>(</strong></font>proxyAction <font color="#006699"><strong>as</strong></font> IAction, selection <font color="#006699"><strong>as</strong></font> ISelection<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
            <font color="#006699"><strong>pass</strong></font>


</font></pre>



</p>]]></description>
<dc:subject>boo</dc:subject>
<dc:creator>bamboo</dc:creator>
<dc:date>2007-10-27T00:33:14-03:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/bamboo/archives/001627_boojay_discussion_group.html">
<title>boojay discussion group</title>
<link>http://blogs.codehaus.org/people/bamboo/archives/001627_boojay_discussion_group.html</link>
<description><![CDATA[<p>
If you think it makes sense to have a JVM backend for the <a href="http://boo.codehaus.org/">boo programming language</a>, <a href="http://groups.google.com/group/boojay/">join us</a>.
</p>]]></description>
<dc:subject>boo</dc:subject>
<dc:creator>bamboo</dc:creator>
<dc:date>2007-10-25T22:08:48-03:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/bamboo/archives/001626_boo_08_is_here.html">
<title>boo 0.8 is here</title>
<link>http://blogs.codehaus.org/people/bamboo/archives/001626_boo_08_is_here.html</link>
<description><![CDATA[<p>
This release includes bug fixes, performance improvements and better meta-programming capabilities [1].
<br /><br />
Special thanks to Marcus Griep, Nick Fortune and Matt McElheny!
<br /><br />
What? - <a href="http://boo.codehaus.org/">http://boo.codehaus.org/ </a><br />
Download - <a href="http://boo.codehaus.org/Download">http://boo.codehaus.org/Download</a> <br />
Official irc channel - <a href="irc://irc.codehaus.org/boo">irc://irc.codehaus.org/boo</a> <br />
<br /><br />
Complete change log <a href="http://jira.codehaus.org/browse/BOO?report=com.atlassian.jira.plugin.system.project:changelog-panel">here</a>.
<br />
Have fun!
<br />
[1] see the 'match' and 'data' macros in the <a href="http://code.google.com/p/boo-extensions/">boo-extensions</a> project for examples]]></description>
<dc:subject>boo</dc:subject>
<dc:creator>bamboo</dc:creator>
<dc:date>2007-10-25T14:08:04-03:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/bamboo/archives/001623_introducing_boojay.html">
<title>Introducing boojay</title>
<link>http://blogs.codehaus.org/people/bamboo/archives/001623_introducing_boojay.html</link>
<description><![CDATA[<p>Consider the following simple application for a moment:<br />

<pre><font color="#000000"><font color="#006699"><strong>import</strong></font> org.eclipse.swt
<font color="#006699"><strong>import</strong></font> org.eclipse.swt.widgets

display <font color="#000000"><strong>=</strong></font> Display<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>
<font color="#0099ff"><strong>shell</strong></font> <font color="#000000"><strong>=</strong></font> Shell<font color="#000000"><strong>(</strong></font>display<font color="#000000"><strong>)</strong></font>
<font color="#0099ff"><strong>shell</strong></font>.setText<font color="#000000"><strong>(</strong></font><font color="#ff00cc">&quot;</font><font color="#ff00cc">Hello</font><font color="#ff00cc">!</font><font color="#ff00cc">&quot;</font><font color="#000000"><strong>)</strong></font>
<font color="#0099ff"><strong>shell</strong></font>.setSize<font color="#000000"><strong>(</strong></font><font color="#ff0000">200</font>, <font color="#ff0000">200</font><font color="#000000"><strong>)</strong></font>
<font color="#0099ff"><strong>shell</strong></font>.open<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>

<font color="#006699"><strong>while</strong></font> <font color="#006699"><strong>not</strong></font> <font color="#0099ff"><strong>shell</strong></font>.isDisposed<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
    <font color="#006699"><strong>if</strong></font> <font color="#006699"><strong>not</strong></font> display.readAndDispatch<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
        display.sleep<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>
        
display.dispose<font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>
</font></pre>
<p>A <a href="http://boo.codehaus.org/">boo</a> application using the <a href="http://www.eclipse.org/swt/">SWT</a> java GUI library. Thanks to <a href="http://ikvm.net/">IKVM</a> that's not only possible but very simple as well.</p>
<p />
<p>So what's the news? Well, Friday morning I was chatting with <a href="http://www.blogger.com/profile/6652942">Klaus</a> and he said to me "if you get boo to emit java bytecodes I'll do all my stuff in boo". How's that for a challenge? :)</p>
<p>Thanks again to <a href="http://ikvm.net/">IKVM</a>, <a href="http://asm.objectweb.org/">ObjectWeb ASM</a> and <a href="http://boo.codehaus.org/BooManifesto.pdf">the extensible boo pipeline architecture</a> after a weekend of relaxed hacking <a href="http://boo-extensions.googlecode.com/svn/trunk/boojay/">boojay</a> was born.</p>
</p>
<p><b>UPDATE: </b>Just in case it's not clear, the generated class files <b>DO NOT</b> require IKVM in any way and can be executed in any compliant JVM.</p>]]></description>
<dc:subject>boo</dc:subject>
<dc:creator>bamboo</dc:creator>
<dc:date>2007-10-23T20:21:29-03:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/bamboo/archives/001620_a_pattern_matching_facility_for_boo.html">
<title>A Pattern Matching facility for boo</title>
<link>http://blogs.codehaus.org/people/bamboo/archives/001620_a_pattern_matching_facility_for_boo.html</link>
<description><![CDATA[<p>I've finally took some time off this weekend to implement a simple object pattern matching facility as part of the newly created <a href="http://code.google.com/p/boo-extensions">boo-extensions</a> project.<br /><br />
Here's some <a href="http://boo-extensions.googlecode.com/svn/trunk/extensions/examples/expressions/Program.boo">code</a> using the new <a href="http://boo-extensions.googlecode.com/svn/trunk/extensions/src/Boo.PatternMatching/MatchMacro.boo">'match'</a> and <a href="http://boo-extensions.googlecode.com/svn/trunk/extensions/src/Boo.Adt/DataMacro.boo">'data' </a>macros to implement an expression evaluator:
<br />
  <pre><font color="#000000"><font color="#006699"><strong>import</strong></font> Boo.PatternMatching
<font color="#006699"><strong>import</strong></font> Boo.Adt

<font color="#006699"><strong>def</strong></font> eval<font color="#000000"><strong>(</strong></font>e <font color="#006699"><strong>as</strong></font> Expression<font color="#000000"><strong>)</strong></font> <font color="#006699"><strong>as</strong></font> <font color="#009966"><strong>int</strong></font><font color="#000000"><strong>:</strong></font>
   match e<font color="#000000"><strong>:</strong></font>
      case Const<font color="#000000"><strong>(</strong></font>value<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
        <font color="#006699"><strong>return</strong></font> value
      case Add<font color="#000000"><strong>(</strong></font>left, right<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
        <font color="#006699"><strong>return</strong></font> eval<font color="#000000"><strong>(</strong></font>left<font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>+</strong></font> eval<font color="#000000"><strong>(</strong></font>right<font color="#000000"><strong>)</strong></font>

<font color="#006699"><strong>def</strong></font> simplify<font color="#000000"><strong>(</strong></font>e <font color="#006699"><strong>as</strong></font> Expression<font color="#000000"><strong>)</strong></font> <font color="#006699"><strong>as</strong></font> Expression<font color="#000000"><strong>:</strong></font>
    match e<font color="#000000"><strong>:</strong></font>
        case Add<font color="#000000"><strong>(</strong></font>left<font color="#000000"><strong>:</strong></font> Const<font color="#000000"><strong>(</strong></font>value<font color="#000000"><strong>:</strong></font> <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>, right<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
            <font color="#006699"><strong>return</strong></font> simplify<font color="#000000"><strong>(</strong></font>right<font color="#000000"><strong>)</strong></font>
        case Add<font color="#000000"><strong>(</strong></font>left, right<font color="#000000"><strong>:</strong></font> Const<font color="#000000"><strong>(</strong></font>value<font color="#000000"><strong>:</strong></font> <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
            <font color="#006699"><strong>return</strong></font> simplify<font color="#000000"><strong>(</strong></font>left<font color="#000000"><strong>)</strong></font>
        case Add<font color="#000000"><strong>(</strong></font>left, right<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>:</strong></font>
            <font color="#006699"><strong>return</strong></font> Add<font color="#000000"><strong>(</strong></font>simplify<font color="#000000"><strong>(</strong></font>left<font color="#000000"><strong>)</strong></font>, simplify<font color="#000000"><strong>(</strong></font>right<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>
        case _<font color="#000000"><strong>:</strong></font>
            <font color="#006699"><strong>return</strong></font> _

data Expression <font color="#000000"><strong>=</strong></font> Const<font color="#000000"><strong>(</strong></font>value <font color="#006699"><strong>as</strong></font> <font color="#009966"><strong>int</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>|</strong></font> Add<font color="#000000"><strong>(</strong></font>left <font color="#006699"><strong>as</strong></font> Expression, right <font color="#006699"><strong>as</strong></font> Expression<font color="#000000"><strong>)</strong></font>

e <font color="#000000"><strong>=</strong></font> Add<font color="#000000"><strong>(</strong></font>Add<font color="#000000"><strong>(</strong></font>Const<font color="#000000"><strong>(</strong></font><font color="#ff0000">19</font><font color="#000000"><strong>)</strong></font>, Const<font color="#000000"><strong>(</strong></font><font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>, Add<font color="#000000"><strong>(</strong></font>Const<font color="#000000"><strong>(</strong></font><font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>, Const<font color="#000000"><strong>(</strong></font><font color="#ff0000">23</font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>

<font color="#0099ff"><strong>print</strong></font> simplify<font color="#000000"><strong>(</strong></font>e<font color="#000000"><strong>)</strong></font>
<font color="#0099ff"><strong>print</strong></font> eval<font color="#000000"><strong>(</strong></font>e<font color="#000000"><strong>)</strong></font>
<font color="#0099ff"><strong>print</strong></font> eval<font color="#000000"><strong>(</strong></font>simplify<font color="#000000"><strong>(</strong></font>e<font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>

</font></pre>
</p>

<p>'match' coupled with our recently acquired quasiquoting capabilities makes writing macros for boo a pleasant endeavour actually.<br /><br />
Dont believe me? Take a look at the <a href="http://boo-extensions.googlecode.com/svn/trunk/extensions/src/Boo.Adt/DataMacro.boo">data macro</a> again.</p>]]></description>
<dc:subject>boo</dc:subject>
<dc:creator>bamboo</dc:creator>
<dc:date>2007-10-16T18:22:37-03:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/bamboo/archives/001612_boo_079_is_here.html">
<title>Boo 0.7.9 is here!</title>
<link>http://blogs.codehaus.org/people/bamboo/archives/001612_boo_079_is_here.html</link>
<description><![CDATA[<p>This release includes bug fixes, improves on generic support and introduces a few <a href="http://blogs.codehaus.org/people/bamboo/archives/001593_boo_meta_methods.html">metaprogramming facilities</a> (still on early stage).</p>

<p>Many thanks to the growing boo community!</p>

<p>What? - <a href="http://boo.codehaus.org/">http://boo.codehaus.org/</a><br />
Download - <a href="http://boo.codehaus.org/Download">http://boo.codehaus.org/Download</a><br />
Official irc channel - <a href="irc://irc.codehaus.org/boo">irc://irc.codehaus.org/boo</a></p>

<p>Full change log <a href="http://jira.codehaus.org/browse/BOO?report=com.atlassian.jira.plugin.system.project:changelog-panel">here</a>.</p>

<p>Have fun!</p>]]></description>
<dc:subject>boo</dc:subject>
<dc:creator>bamboo</dc:creator>
<dc:date>2007-09-01T13:33:55-03:00</dc:date>
</item>


</rdf:RDF>
