<?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>Adztec Independent - Blog</title>
	<atom:link href="http://www.adztec-independent.de/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.adztec-independent.de</link>
	<description>Programming Ruby / JRuby / Rails / Common Lisp by Christopher Bertels</description>
	<lastBuildDate>Mon, 13 Sep 2010 22:58:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Fancy Talk @ Warpzone.ms</title>
		<link>http://www.adztec-independent.de/2010/09/fancy-talk-warpzone-ms/</link>
		<comments>http://www.adztec-independent.de/2010/09/fancy-talk-warpzone-ms/#comments</comments>
		<pubDate>Mon, 13 Sep 2010 22:58:58 +0000</pubDate>
		<dc:creator>Christopher</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[erlang]]></category>
		<category><![CDATA[fancy]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[hackerspace]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[hobbies]]></category>
		<category><![CDATA[interpreter]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[smalltalk]]></category>
		<category><![CDATA[talk]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.adztec-independent.de/?p=284</guid>
		<description><![CDATA[Hey,
I haven&#8217;t posted here in a long time. Mostly due to working on Fancy a lot. Just wanted to post a video of a talk I gave in June at warpzone.ms hackerspace in Münster (Germany).
The talk is in German, but it might be of interest to some people, so here it is:

Fancy Talk 12.06.2010 @ [...]]]></description>
			<content:encoded><![CDATA[<p>Hey,</p>
<p>I haven&#8217;t posted here in a long time. Mostly due to working on <a href="http://www.fancy-lang.org" target="_blank">Fancy</a> a lot. Just wanted to post a video of a talk I gave in June at <a href="http://www.warpzone.ms" target="_blank">warpzone.ms </a>hackerspace in Münster (Germany).</p>
<p>The talk is in German, but it might be of interest to some people, so here it is:</p>
<p><iframe src="http://player.vimeo.com/video/12537929" width="549" height="309" frameborder="0"></iframe>
<p><a href="http://vimeo.com/12537929">Fancy Talk 12.06.2010 @ Warpzone.ms</a> from <a href="http://vimeo.com/user4042217">Christopher Bertels</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adztec-independent.de/2010/09/fancy-talk-warpzone-ms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Project: The Fancy Programming Language</title>
		<link>http://www.adztec-independent.de/2010/03/new-project-the-fancy-programming-language/</link>
		<comments>http://www.adztec-independent.de/2010/03/new-project-the-fancy-programming-language/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 21:37:22 +0000</pubDate>
		<dc:creator>Christopher</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[erlang]]></category>
		<category><![CDATA[fancy]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[functional]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[hobbies]]></category>
		<category><![CDATA[interpreter]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[meta-programming]]></category>
		<category><![CDATA[parallel programming]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.adztec-independent.de/?p=278</guid>
		<description><![CDATA[Ok, I know I&#8217;m not a frequent poster. I guess, that&#8217;s just the way it is. Anyways..
I&#8217;ve been up to a lot of stuff in the past few months. Related to programming there are two projects, one of them I&#8217;m still working on (and intend to do so for the forseeable future):

generica, a small, simple [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, I know I&#8217;m not a frequent poster. I guess, that&#8217;s just the way it is. Anyways..</p>
<p>I&#8217;ve been up to a lot of stuff in the past few months. Related to programming there are two projects, one of them I&#8217;m still working on (and intend to do so for the forseeable future):</p>
<ul>
<li><a href="http://github.com/bakkdoor/generica">generica</a>, a small, simple &amp; dirty lisp-like language interpreter implemented in ANSI C.</li>
<li>and <a href="http://github.com/bakkdoor/fancy/">Fancy</a>, a new object-oriented dynamic programming language, heavily inspired by Ruby, Smalltalk and Erlang. There&#8217;s also a website up, but far from finished: <a href="http://fancy-lang.org">fancy-lang.org</a> &#8211; Check it out if you like <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
<p>So yeah, the latter project I started about 6 weeks ago but didn&#8217;t have the time to really work on it until about 3 weeks ago. Since then I&#8217;ve managed to implement quite a few features.<br />
Here&#8217;s a small overview of features working in Fancy already:</p>
<ul>
<li>Class definitions</li>
<li>Method definitions</li>
<li>String, Integer, Double, Array, Hash (Hashmap), and Block (lambda function / closure) Literals</li>
<li>Method and operator calls (<em>sending messages to objects</em>)</li>
<li>Simple loops</li>
<li>Support for closures (performance improvements are definately possible though <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> )</li>
</ul>
<p>There&#8217;s still lots of stuff missing, obviously. Mainly most of the standard library (I/O, Threading/Concurrency, Networking, etc&#8230;) will have to implemented as well as some runtime features I haven&#8217;t finished or started yet. But it&#8217;s getting along quite nicely. If anyone dares to try it out, I&#8217;d love to hear some feedback, especially hearing some opinions on the overall feel and semantics of the language would be nice. You can get the code on github (see the link above) and try to build it. Compiling instructions are in the README file. Fancy is licensed under the GNU LGPL.</p>
<p>I&#8217;m still excited to see where this is gonna go, for myself and possibly others as well. We&#8217;ll see.</p>
<p>I&#8217;ll probably post some more information on the language and its implementation some time soon. Need to go now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adztec-independent.de/2010/03/new-project-the-fancy-programming-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Screencast: Debugging with Emacs &amp; GDB</title>
		<link>http://www.adztec-independent.de/2009/11/screencast-debugging-with-emacs-gdb/</link>
		<comments>http://www.adztec-independent.de/2009/11/screencast-debugging-with-emacs-gdb/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 00:29:18 +0000</pubDate>
		<dc:creator>Christopher</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[hobbies]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[screencast]]></category>
		<category><![CDATA[stupidvm]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.adztec-independent.de/?p=265</guid>
		<description><![CDATA[Hey there.
I wish I&#8217;d be posting more recently, but haven&#8217;t really had the time to do so.
I just wanted to share with you a small screencast I created today on debugging with emacs and gdb, since I think it might be of interest to someone else as well.
You can check out the video at my [...]]]></description>
			<content:encoded><![CDATA[<p>Hey there.<br />
I wish I&#8217;d be posting more recently, but haven&#8217;t really had the time to do so.<br />
I just wanted to share with you a small screencast I created today on debugging with emacs and gdb, since I think it might be of interest to someone else as well.</p>
<p>You can check out the video at my blip.tv channel: <a href="http://bakkdoor.blip.tv/" target="_blank">http://bakkdoor.blip.tv/ </a><br />
Currently the video is being converted to flash video (.flv), so you might want to check out the .ogv video file here, if it&#8217;s not done yet: <a href="http://blip.tv/file/2804484" target="_blank">http://blip.tv/file/2804484</a></p>
<p><strong>[Update:]</strong><br />
Video is available now. You can also watch it here:<br />
<embed src="http://blip.tv/play/g7R2gayxfAA" type="application/x-shockwave-flash" width="525" height="402" allowscriptaccess="always" allowfullscreen="true"></embed></p>
<p>Anyhow, I hope you like it and I&#8217;d like to hear some feedback.</p>
<p>Btw, the programm I&#8217;m debugging in the video is <strong>stupidvm</strong>, a small &#038; stupid virtual machine I&#8217;ve started working on 2 weeks ago, written in C.<br />
You can check out the code either on <a href="http://gitorious.org/stupidvm/stupidvm/" target="_blank">gitorious</a> or <a href="http://github.com/bakkdoor/stupidvm/" target="_blank">github</a>.</p>
<p>Feedback is, as always, welcome <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
I hope you like it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adztec-independent.de/2009/11/screencast-debugging-with-emacs-gdb/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Small update &amp; Introduction of &#8216;Stackd&#8217;</title>
		<link>http://www.adztec-independent.de/2009/09/small-update-introduction-of-stackd/</link>
		<comments>http://www.adztec-independent.de/2009/09/small-update-introduction-of-stackd/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 17:41:25 +0000</pubDate>
		<dc:creator>Christopher</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.adztec-independent.de/?p=260</guid>
		<description><![CDATA[Oh wow. 3 months have passed &#8211; how time flys by!
So, what have I been up to in the past quarter year (doesn&#8217;t it sound like a lot more like this?!) ?
First of all, I did some stuff for university, as the summer semerster came to an end. I will upload a homework I wrote [...]]]></description>
			<content:encoded><![CDATA[<p>Oh wow. 3 months have passed &#8211; how time flys by!</p>
<p>So, what have I been up to in the past quarter year (doesn&#8217;t it sound like a lot more like this?!) ?</p>
<p>First of all, I did some stuff for university, as the summer semerster came to an end. I will upload a homework I wrote in computer science shortly. The topic is &#8220;software architectures&#8221; &#8211; it&#8217;s in german of course, but I suppose that some day some one speaking german might find this interesting &#8211; isn&#8217;t this what the internet is for? <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Also, I&#8217;ve had a visit from my grand parents from California over in July. And then, I&#8217;ve been working at <a href="http://www.intevation.de">Intevation GmbH</a> as an intern for the last month. Intevation is a very nice company to work at. All employees are very friendly and what I think is great as well, is that they only do free software (as in free speach).<br />
Since I&#8217;m a big fan of free software and its movement, I applied for an internship earlier this year and, well, they&#8217;ve accepted my application <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So currently, I&#8217;ve been working on some packaging related stuff for Ubuntu and Debian. I&#8217;ll probably talk more about that in another upcoming post soon. </p>
<p>Alright, let&#8217;s get to the next topic I wanted to adress here:<br />
I&#8217;ve started to work on a(nother) interpreter for a stack-based programming language I&#8217;ve called &#8220;Stackd&#8221;. It&#8217;s basically a poor &#038; small reimplementation of the <a href="http://factorcode.org">Factor programming language</a>, but still missing many features of course.<br />
If you&#8217;re interested in how it works and what it&#8217;s all about to programm in a <em>concatinative programming language</em>, as stack-based languages are often called, take a look here: <a href="http://concatenative.org">http://concatenative.org</a>. There you&#8217;ll find plenty of information, most of which will also apply for Stackd.</p>
<p>You can follow the current development progress at my git repositories here:</p>
<ul>
<li><a href="http://gitorious.org/stackd">Project page on Gitorious</a></li>
<li><a href="http://github.com/bakkdoor/stackd">And on GitHub</a></li>
</ul>
<p>I&#8217;ve started to use <a href="http://gitorious.org">Gitorious</a> next to GitHub because I like the fact that it&#8217;s free software and I want to support it in a way. Besides, it&#8217;s well thought out and I guess more people should take a look at it instead of just choosing GitHub without checking out what else is left. Of course, GitHub does have some nice features, which Gitorious is still missing &#8211; but that might change in the future.</p>
<p>I&#8217;ll probably make another post soon explaining a little more my new language. If there are any questions, feel free to contact me either on GitHub, Gitorious or via email (see <a href="http://www.adztec-independent.de/impressum/">&#8216;About me&#8217;</a> page).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adztec-independent.de/2009/09/small-update-introduction-of-stackd/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Blocktalk Rubygem</title>
		<link>http://www.adztec-independent.de/2009/06/blocktalk-rubygem/</link>
		<comments>http://www.adztec-independent.de/2009/06/blocktalk-rubygem/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 21:05:27 +0000</pubDate>
		<dc:creator>Christopher</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[blocktalk]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubygems]]></category>

		<guid isPermaLink="false">http://www.adztec-independent.de/?p=255</guid>
		<description><![CDATA[Blocktalk can now be easily installed via Rubygems:

gem sources -a http://gems.github.com (if not done yet)
sudo gem install bakkdoor-blocktalk

You can then simply run blocktalk from the shell via

blocktalk sourcefile.bt

To look at some debug information (e.g. the AST, the generated ruby code etc.) type:

blocktalk sourcefile.bt &#8211;debug
or
blocktalk sourcefile.bt &#8211;ruby (to only show the generated ruby code)

Feel free to [...]]]></description>
			<content:encoded><![CDATA[<p>Blocktalk can now be easily installed via <a href="http://rubygems.org/" target="_blank">Rubygems</a>:</p>
<blockquote><p>
<b>gem sources -a http://gems.github.com</b> (if not done yet)<br />
<b>sudo gem install bakkdoor-blocktalk</b>
</p></blockquote>
<p>You can then simply run blocktalk from the shell via</p>
<blockquote><p>
<b>blocktalk sourcefile.bt</b>
</p></blockquote>
<p>To look at some debug information (e.g. the AST, the generated ruby code etc.) type:</p>
<blockquote><p>
<b>blocktalk sourcefile.bt &#8211;debug</b><br />
or<br />
<b>blocktalk sourcefile.bt &#8211;ruby</b> (to only show the generated ruby code)
</p></blockquote>
<p>Feel free to play around with it, check out the examples in the examples folder, if you want to get a start.<br />
Would love to hear some feedback from anyone who&#8217;s interested, since this is my first attempt to language design <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.adztec-independent.de/2009/06/blocktalk-rubygem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blocktalk version 0.1 released</title>
		<link>http://www.adztec-independent.de/2009/06/blocktalk-version-01-released/</link>
		<comments>http://www.adztec-independent.de/2009/06/blocktalk-version-01-released/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 01:47:31 +0000</pubDate>
		<dc:creator>Christopher</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[blocktalk]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[hobbies]]></category>
		<category><![CDATA[interpreter]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.adztec-independent.de/?p=253</guid>
		<description><![CDATA[I just released version 0.1 of Blocktalk at Github.
I&#8217;ve added quite some features in the past few days and got all of my main problems fixed and the most important features working.
One thing that was on that list until today was chained method calls.
Up to this point, the only way to chain method calls was [...]]]></description>
			<content:encoded><![CDATA[<p>I just released <a href="http://github.com/bakkdoor/blocktalk/downloads">version 0.1 of Blocktalk at Github</a>.<br />
I&#8217;ve added quite some features in the past few days and got all of my main problems fixed and the most important features working.<br />
One thing that was on that list until today was chained method calls.<br />
Up to this point, the only way to chain method calls was to surround each method call with parentheses, like this:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.adztec-independent.de/wp-content/plugins/wp-codebox/wp-codebox.php?p=253&amp;download=parens.bt">parens.bt</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2534"><td class="code" id="p253code4"><pre class="smalltalk" style="font-family:monospace;">str <span style="color: #000066; font-weight:bold;">=</span> <span style="">&#40;</span><span style="color: #007f00; font-style: italic;">&quot;Hello, world!&quot;</span> upcase<span style="">&#41;</span> gsub: <span style="color: #007f00; font-style: italic;">&quot;,&quot;</span> with: <span style="color: #007f00; font-style: italic;">&quot;:&quot;</span></pre></td></tr></table></div>

<p>Now you can do something like this:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.adztec-independent.de/wp-content/plugins/wp-codebox/wp-codebox.php?p=253&amp;download=no-parens.bt">no-parens.bt</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2535"><td class="code" id="p253code5"><pre class="smalltalk" style="font-family:monospace;">str <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #007f00; font-style: italic;">&quot;Hello, world!&quot;</span> upcase gsub: <span style="color: #007f00; font-style: italic;">&quot;,&quot;</span> with: <span style="color: #007f00; font-style: italic;">&quot;:&quot;</span></pre></td></tr></table></div>

<p>Which is equivalent to this ruby code:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.adztec-independent.de/wp-content/plugins/wp-codebox/wp-codebox.php?p=253&amp;download=no-parens.rb">no-parens.rb</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2536"><td class="code" id="p253code6"><pre class="ruby" style="font-family:monospace;">str = <span style="color:#996600;">&quot;Hello, world!&quot;</span>.<span style="color:#9900CC;">upcase</span>.<span style="color:#CC0066; font-weight:bold;">gsub</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;,&quot;</span>, <span style="color:#996600;">&quot;:&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div>

<p>Much nicer, if you ask me. Of course you can chain as many methods as you want, even with each method taking a codeblock, if you want to (as it is possible in ruby as well).<br />
So now that I&#8217;ve got the most important things done, I&#8217;ll try to focus a little more on refactoring, working on the standard library (adding more classes &#038; methods) and thinking about some more unique, new features for the language <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.adztec-independent.de/2009/06/blocktalk-version-01-released/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Blocktalk code available @ Github</title>
		<link>http://www.adztec-independent.de/2009/06/blocktalk-code-available-github/</link>
		<comments>http://www.adztec-independent.de/2009/06/blocktalk-code-available-github/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 01:38:56 +0000</pubDate>
		<dc:creator>Christopher</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[blocktalk]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[hobbies]]></category>
		<category><![CDATA[interpreter]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.adztec-independent.de/?p=250</guid>
		<description><![CDATA[I just released the code for my Blocktalk interpreter at Github.
Feel free to clone my repository, create patches or file in some bugs, if you dare to  
]]></description>
			<content:encoded><![CDATA[<p>I just released the code for my Blocktalk interpreter <a href="http://github.com/bakkdoor/blocktalk/" target="_blank"><strong>at Github</strong></a>.<br />
Feel free to clone my repository, create patches or file in some bugs, if you dare to <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.adztec-independent.de/2009/06/blocktalk-code-available-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blocktalk: A simple portscanner</title>
		<link>http://www.adztec-independent.de/2009/06/blocktalk-a-simple-portscanner/</link>
		<comments>http://www.adztec-independent.de/2009/06/blocktalk-a-simple-portscanner/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 00:14:36 +0000</pubDate>
		<dc:creator>Christopher</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[blocktalk]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[hobbies]]></category>
		<category><![CDATA[interpreter]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.adztec-independent.de/?p=242</guid>
		<description><![CDATA[Here&#8217;s a little blocktalk script, that shows the latest working feature I&#8217;ve added to my Blocktalk interpreter: Exception handling  
Basically, it&#8217;s just a simple portscanner.

?Download portscan.btSystem require: &#34;socket&#34;
&#160;
host = &#34;localhost&#34;
&#160;
&#40;ARGV at: 0&#41; if &#123;
  host = &#40;ARGV at: 0&#41;
&#125;
&#160;
open_ports = &#91;&#93;
&#160;
1 upto: 1024 do &#124;port&#124;
  Thread new &#123;
    try&#123;
 [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a little blocktalk script, that shows the latest working feature I&#8217;ve added to my Blocktalk interpreter: Exception handling <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Basically, it&#8217;s just a simple portscanner.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.adztec-independent.de/wp-content/plugins/wp-codebox/wp-codebox.php?p=242&amp;download=portscan.bt">portscan.bt</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2428"><td class="code" id="p242code8"><pre class="smalltalk" style="font-family:monospace;"><span style="color: #0000ff;">System</span> require: <span style="color: #007f00; font-style: italic;">&quot;socket&quot;</span>
&nbsp;
host <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #007f00; font-style: italic;">&quot;localhost&quot;</span>
&nbsp;
<span style="">&#40;</span><span style="color: #0000ff;">ARGV</span> at: <span style="color: #00007f;">0</span><span style="">&#41;</span> if <span style="">&#123;</span>
  host <span style="color: #000066; font-weight:bold;">=</span> <span style="">&#40;</span><span style="color: #0000ff;">ARGV</span> at: <span style="color: #00007f;">0</span><span style="">&#41;</span>
<span style="">&#125;</span>
&nbsp;
open_ports <span style="color: #000066; font-weight:bold;">=</span> <span style="">&#91;</span><span style="">&#93;</span>
&nbsp;
1 upto: <span style="color: #00007f;">1024</span> do |<span style="color: #00007f;">port</span>|
  <span style="color: #0000ff;">Thread</span> new <span style="">&#123;</span>
    try<span style="">&#123;</span>
      t <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #0000ff;">TCPSocket</span> new: <span style="color: #00007f;">host</span> port: <span style="color: #00007f;">port</span>
      open_ports &lt;&lt; port
&nbsp;
      s <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #0000ff;">Socket</span> getnameinfo: <span style="">&#91;</span><span style="color: #007f00; font-style: italic;">&quot;AF_INET&quot;</span>, <span style="color: #00007f;">port</span>, <span style="color: #00007f;">host</span><span style="">&#93;</span>
      <span style="color: #0000ff;">Console</span> puts: <span style="">&#40;</span><span style="color: #007f00; font-style: italic;">&quot;\nPort #{port} (#{s[1]})&quot;</span> + <span style="color: #007f00; font-style: italic;">&quot; is open.&quot;</span><span style="">&#41;</span>
&nbsp;
      catch<span style="">&#123;</span>
        <span style="color: #0000ff;">Console</span> print: <span style="color: #007f00; font-style: italic;">&quot;.&quot;</span>
      <span style="">&#125;</span>
&nbsp;
      ensure<span style="">&#123;</span>
        t if <span style="">&#123;</span> t close <span style="">&#125;</span>
      <span style="">&#125;</span>
    <span style="">&#125;</span>
  <span style="">&#125;</span>
end
&nbsp;
<span style="color: #0000ff;">Console</span> puts
<span style="color: #0000ff;">Console</span> puts: <span style="color: #007f00; font-style: italic;">&quot;Open ports on #{host} are:&quot;</span>
<span style="color: #0000ff;">Console</span> puts: <span style="">&#40;</span><span style="color: #00007f;">open_ports</span> join: <span style="color: #007f00; font-style: italic;">&quot;, &quot;</span><span style="">&#41;</span></pre></td></tr></table></div>

<p>So yeah, this is actually working. Now I&#8217;ve basically have most of the language features done that I had in mind first. Next to come are probably some performance optimizations as well as some more unique features, I still have to come up with. We&#8217;ll see <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p><b>Update:</b><br />
I&#8217;ve added Threading to the code, this speeds up the process a little <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.adztec-independent.de/2009/06/blocktalk-a-simple-portscanner/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Blocktalk: Dealing with classes &amp; modules</title>
		<link>http://www.adztec-independent.de/2009/06/blocktalk-dealing-with-classes-modules/</link>
		<comments>http://www.adztec-independent.de/2009/06/blocktalk-dealing-with-classes-modules/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 02:45:47 +0000</pubDate>
		<dc:creator>Christopher</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[blocktalk]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[interpreter]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[meta-programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.adztec-independent.de/?p=232</guid>
		<description><![CDATA[Alright. I&#8217;ve renamed my language again: Blocktalk is what I&#8217;ve settled on (finally I hope).
I think it resembles a little more the Smalltalk heritage, although most implementation related concepts come from Ruby though. Oh well, I like the name better, so that&#8217;s why i chose to name it that way.
Current progress:
Class &#038; module definitions work [...]]]></description>
			<content:encoded><![CDATA[<p>Alright. I&#8217;ve renamed my language again: <b>Blocktalk</b> is what I&#8217;ve settled on (finally I hope).<br />
I think it resembles a little more the Smalltalk heritage, although most implementation related concepts come from Ruby though. Oh well, I like the name better, so that&#8217;s why i chose to name it that way.</p>
<p><b>Current progress:</b><br />
Class &#038; module definitions work correctly now, meaning that it now fully supports nearly all concepts that you find in Ruby. The main difference is, that in contrast to Ruby, Blocktalk does not have any real Keywords predefined, except for just a few including:</p>
<ul>
<li><b>def</b> (for indicating method definitions)</li>
<li><b>do</b> &#038; <b>end</b> (for codeblocks)</li>
<li><b>self</b> (the same as in Ruby &#038; Smalltalk: reference to the current object)</li>
<li><b>return</b> (explicitly returning from withing the middle of a method)</li>
<li><b>yield</b> (same as in ruby: yielding to a given implicit block)</li>
<li>Some <b>literal syntax</b> (not real Keywords, but somehow belongs into this category) for <b>Arrays, Hashes, Codeblocks, Integers, Floats, Strings, Symbols, Characters</b> and of course <b>Assignment</b></li>
</ul>
<p>That&#8217;s pretty much it, regarding predefined keywords in the language itself. Everything else relies on expressions like message passing (a.k.a. method calling) to objects, assignments and arithmetic. Even defining new modules or classes is done by sending a message to the Class or Module class-object (very similar to how it&#8217;s done in Smalltalk and how you can also do it in Ruby).</p>
<p>Here&#8217;s a small example of defining a class and a module:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.adztec-independent.de/wp-content/plugins/wp-codebox/wp-codebox.php?p=232&amp;download=class-example.bt">class-example.bt</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p23210"><td class="code" id="p232code10"><pre class="smalltalk" style="font-family:monospace;"><span style="color: #0000ff;">Module</span> &gt;&gt; :<span style="color: #0000ff;">ModuleA</span> do
  def method_a <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #00007f;">do</span>
    <span style="color: #0000ff;">Console</span> puts: <span style="color: #007f00; font-style: italic;">&quot;in ModuleA#method_a!&quot;</span>
  end
end
&nbsp;
&nbsp;
<span style="color: #0000ff;">Module</span> &gt;&gt; :<span style="color: #0000ff;">ModuleB</span> do
  def method_b <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #00007f;">do</span>
    <span style="color: #0000ff;">Console</span> puts: <span style="color: #007f00; font-style: italic;">&quot;in ModuleB#method_b!&quot;</span>
  end
end
&nbsp;
<span style="color: #0000ff;">Class</span> &gt;&gt; :<span style="color: #0000ff;">Place</span> do
  def <span/<span style="color: #00007f;">1</span>/><span style="color: #7f007f;">self</span></span> from_city <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #00007f;">do</span> |<span style="color: #00007f;">city_name</span>|
    <span style="color: #000066; font-weight:bold;">#</span> should do something useful here ...
    <span style="color: #0000ff;">Place</span> new
  end
&nbsp;
  def coordinates <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #00007f;">do</span>
    <span style="color: #000066; font-weight:bold;">#</span> do some calculation here...
    <span style="color: #00007f;">return</span> <span style="">&#40;</span><span style="color: #0000ff;">Kernel</span> rand<span style="">&#41;</span>
  end
end
&nbsp;
<span style="color: #0000ff;">Class</span> &gt;&gt; :<span style="color: #0000ff;">Person</span> do
  <span/<span style="color: #00007f;">1</span>/><span style="color: #7f007f;">self</span></span> mixin: <span style="">&#91;</span><span style="color: #0000ff;">ModuleA</span>, <span style="color: #0000ff;">ModuleB</span><span style="">&#93;</span>
&nbsp;
  <span style="color: #000066; font-weight:bold;">#</span> constructor with named params
  def initialize <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #00007f;">do</span> |name age: <span style="color: #00007f;">age</span> city: <span style="color: #00007f;">city</span>|
    @name <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #00007f;">name</span>
    @age <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #00007f;">age</span>
    @city <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #00007f;">city</span>
  end
&nbsp;
  def go_to <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #00007f;">do</span> |place with: <span style="color: #00007f;">vehicle</span>|
    <span style="">&#40;</span><span style="">&#40;</span><span style="color: #00007f;">place</span> is_a?: <span style="color: #0000ff;">Place</span><span style="">&#41;</span> and: <span style="">&#40;</span><span style="">&#40;</span><span/<span style="color: #00007f;">1</span>/><span style="color: #7f007f;">self</span></span> distance_to: <span style="color: #00007f;">place</span><span style="">&#41;</span> &lt; 10.<span style="color: #00007f;">5</span><span style="">&#41;</span><span style="">&#41;</span> if_<span style="color: #7f007f;">true</span> <span style="">&#123;</span>
      vehicle take: <span/<span style="color: #00007f;">1</span>/><span style="color: #7f007f;">self</span></span> to: <span style="color: #00007f;">place</span>
    <span style="">&#125;</span>
  end
&nbsp;
  def place <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #00007f;">do</span>
    <span style="color: #0000ff;">Place</span> from_city: @city
  end
&nbsp;
  def distance_to <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #00007f;">do</span> |<span style="color: #00007f;">place</span>|
    <span style="">&#40;</span><span style="color: #00007f;">place</span> is_a?: <span style="color: #0000ff;">Place</span><span style="">&#41;</span> if_<span style="color: #7f007f;">true</span>: <span style="">&#123;</span>
      dist <span style="color: #000066; font-weight:bold;">=</span> <span style="">&#40;</span><span style="">&#40;</span><span/<span style="color: #00007f;">1</span>/><span style="color: #7f007f;">self</span></span> place<span style="">&#41;</span> coordinates<span style="">&#41;</span> - <span style="">&#40;</span><span style="color: #00007f;">place</span> coordinates<span style="">&#41;</span>
      dist abs
    <span style="">&#125;</span> if_<span style="color: #7f007f;">false</span>: <span style="">&#123;</span>
      0.<span style="color: #00007f;">0</span>
    <span style="">&#125;</span>
  end
end
&nbsp;
chris <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #0000ff;">Person</span> new: <span style="color: #007f00; font-style: italic;">&quot;Christopher Bertels&quot;</span> age: <span style="color: #00007f;">22</span> city: <span style="color: #007f00; font-style: italic;">&quot;Osnabrück&quot;</span>
city <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #0000ff;">Place</span> from_city: <span style="color: #007f00; font-style: italic;">&quot;Berlin&quot;</span>
&nbsp;
<span style="color: #0000ff;">Console</span> puts: <span style="color: #007f00; font-style: italic;">&quot;Distance from chris to city:&quot;</span>
<span style="color: #0000ff;">Console</span> puts: <span style="">&#40;</span><span style="color: #00007f;">chris</span> distance_to: <span style="color: #00007f;">city</span><span style="">&#41;</span>
&nbsp;
<span style="color: #000066; font-weight:bold;">#</span> <span style="color: #0000ff;">Person</span> mixed in <span style="color: #0000ff;">ModuleA</span> &amp; <span style="color: #0000ff;">ModuleB</span>:
<span style="color: #00007f;">chris</span> method_a
chris method_b</pre></td></tr></table></div>

<p>I&#8217;m still tweaking a little here and there, but I think most of the standard language features are working now. Now I&#8217;ll try to come up with some more unique things. I do have a few ideas already, but I still need to see, if they really work out nice. Let&#8217;s see <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.adztec-independent.de/2009/06/blocktalk-dealing-with-classes-modules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blockd: Mixing Ruby &amp; Smalltalk</title>
		<link>http://www.adztec-independent.de/2009/05/blockd-mixing-ruby-smalltalk/</link>
		<comments>http://www.adztec-independent.de/2009/05/blockd-mixing-ruby-smalltalk/#comments</comments>
		<pubDate>Fri, 29 May 2009 17:42:18 +0000</pubDate>
		<dc:creator>Christopher</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[blocktalk]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[functional]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[hobbies]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.adztec-independent.de/?p=216</guid>
		<description><![CDATA[My new simple language, blockd, that I&#8217;ve mentioned in my last blog post is progressing quite nicely.
Since my last post a few days ago, I&#8217;ve worked on it quite a bit and I&#8217;ve got a first simple interpreter for it working.
For now, the interpreter is able to understand &#038; execute methodcalls on objects, anonymous methods [...]]]></description>
			<content:encoded><![CDATA[<p>My new simple language, <b>blockd</b>, that I&#8217;ve mentioned in my last blog post is progressing quite nicely.<br />
Since my last post a few days ago, I&#8217;ve worked on it quite a bit and I&#8217;ve got a first simple interpreter for it working.</p>
<p>For now, the interpreter is able to understand &#038; execute methodcalls on objects, anonymous methods (blocks &#038; procs in ruby) and some other minor stuff.</p>
<p>Heres a small example, that actually works now:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.adztec-independent.de/wp-content/plugins/wp-codebox/wp-codebox.php?p=216&amp;download=first_test.blk">first_test.blk</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p21613"><td class="code" id="p216code13"><pre class="smalltalk" style="font-family:monospace;">y <span style="color: #000066; font-weight:bold;">=</span> <span style="">&#123;</span> |<span style="color: #00007f;">x</span>|
  <span style="color: #0000ff;">Console</span> puts: <span style="color: #00007f;">x</span>
  <span style="color: #0000ff;">Console</span> puts: <span style="">&#40;</span><span style="color: #00007f;">x</span> * <span style="color: #00007f;">x</span><span style="">&#41;</span>
<span style="">&#125;</span>
y call: <span style="color: #00007f;">10</span>
&nbsp;
m <span style="color: #000066; font-weight:bold;">=</span> <span style="">&#123;</span> |<span style="color: #00007f;">x y</span>|
  <span style="color: #0000ff;">Console</span> puts: <span style="">&#40;</span><span style="">&#40;</span><span style="color: #00007f;">x</span> upcase<span style="">&#41;</span> * <span style="color: #00007f;">y</span><span style="">&#41;</span>
<span style="">&#125;</span>
m call: <span style="color: #007f00; font-style: italic;">&quot;cool &quot;</span> y: <span style="color: #00007f;">10</span>
&nbsp;
square <span style="color: #000066; font-weight:bold;">=</span> <span style="">&#123;</span> |<span style="color: #00007f;">y</span>|
  y * <span style="color: #00007f;">y</span>
<span style="">&#125;</span>
cubic <span style="color: #000066; font-weight:bold;">=</span> <span style="">&#123;</span>|<span style="color: #00007f;">x</span>| <span style="">&#40;</span><span style="color: #00007f;">x</span> * <span style="color: #00007f;">x</span><span style="">&#41;</span> * <span style="color: #00007f;">x</span><span style="">&#125;</span>
&nbsp;
<span style="color: #7f0000;">3</span> times do |<span style="color: #00007f;">i</span>|
  <span style="color: #0000ff;">Console</span> puts: <span style="color: #00007f;">i</span>
end
&nbsp;
foo <span style="color: #000066; font-weight:bold;">=</span> <span style="">&#123;</span>
  <span style="color: #7f0000;">3</span> times <span style="">&#123;</span> |<span style="color: #00007f;">i</span>| <span style="color: #0000ff;">Console</span> puts: <span style="">&#40;</span><span style="color: #00007f;">square</span> call: <span style="color: #00007f;">i</span><span style="">&#41;</span> <span style="">&#125;</span>
<span style="">&#125;</span>
&nbsp;
<span style="color: #0000ff;">Console</span> puts: <span style="color: #007f00; font-style: italic;">&quot;--&quot;</span>
&nbsp;
foo call
&nbsp;
<span style="color: #7f0000;">10</span> times &amp;foo</pre></td></tr></table></div>

<p>This basically is equivalent to the following ruby code:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.adztec-independent.de/wp-content/plugins/wp-codebox/wp-codebox.php?p=216&amp;download=first_test.rb">first_test.rb</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p21614"><td class="code" id="p216code14"><pre class="ruby" style="font-family:monospace;">y = <span style="color:#CC0066; font-weight:bold;">Proc</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>x<span style="color:#006600; font-weight:bold;">|</span> Console.<span style="color:#CC0066; font-weight:bold;">puts</span><span style="color:#006600; font-weight:bold;">&#40;</span>x<span style="color:#006600; font-weight:bold;">&#41;</span>;Console.<span style="color:#CC0066; font-weight:bold;">puts</span><span style="color:#006600; font-weight:bold;">&#40;</span>x.<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#40;</span>x<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
y.<span style="color:#9900CC;">call</span><span style="color:#006600; font-weight:bold;">&#40;</span>10<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
m = <span style="color:#CC0066; font-weight:bold;">Proc</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>x,y<span style="color:#006600; font-weight:bold;">|</span> Console.<span style="color:#CC0066; font-weight:bold;">puts</span><span style="color:#006600; font-weight:bold;">&#40;</span>x.<span style="color:#9900CC;">upcase</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#40;</span>y<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
m.<span style="color:#9900CC;">call</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;cool &quot;</span>, 10<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
square = <span style="color:#CC0066; font-weight:bold;">Proc</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>y<span style="color:#006600; font-weight:bold;">|</span> y.<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#40;</span>y<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
cubic = <span style="color:#CC0066; font-weight:bold;">Proc</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>x<span style="color:#006600; font-weight:bold;">|</span> x.<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#40;</span>x<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#40;</span>x<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
3.<span style="color:#9900CC;">times</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&amp;</span>Proc.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>i<span style="color:#006600; font-weight:bold;">|</span> Console.<span style="color:#CC0066; font-weight:bold;">puts</span><span style="color:#006600; font-weight:bold;">&#40;</span>i<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
foo = <span style="color:#CC0066; font-weight:bold;">Proc</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#123;</span>3.<span style="color:#9900CC;">times</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&amp;</span>Proc.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>i<span style="color:#006600; font-weight:bold;">|</span> Console.<span style="color:#CC0066; font-weight:bold;">puts</span><span style="color:#006600; font-weight:bold;">&#40;</span>square.<span style="color:#9900CC;">call</span><span style="color:#006600; font-weight:bold;">&#40;</span>i<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
Console.<span style="color:#CC0066; font-weight:bold;">puts</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;--&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
foo.<span style="color:#9900CC;">call</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
10.<span style="color:#9900CC;">times</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&amp;</span>foo<span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div>

<p>Now, to make this clear: The ruby code above is what the current interpreter actually executes. The way I&#8217;ve implemented it for now (and for simplicity only &#8211; just to get something working first) is, that it simply parses the blockd code and <i>translates</i> it into equivalent ruby code, which then gets executed via <i>eval</i> in ruby.<br />
Now I know, this isn&#8217;t the best way to do it, for several reasons:<br />
Normally, an interpreter executes the code it gets fed directly, expression for expression, as this is also the case for ruby. If you have an syntax error within the code that is evaluated, the interpreter usually notices this only at the moment it reaches that part of the code and tries to evaluate it. This isn&#8217;t the case for the current interpreter I wrote here. The reason I chose to do it this way, was that I wanted to get something working as possible. I do want to change it though later on, so that each expression gets executed on the fly, once it is parsed.</p>
<p>So for now, i evaluate the parsetree, and each expression node gets turned into a string of equivalent ruby code, that then gets saved in a global list (within a class called <i>Evaluator</i>). When the parser has done it&#8217;s job and all the values (strings of ruby code) of all expression nodes have been accumulated, i simply run ruby&#8217;s <i>eval</i> on it and at that point do the actual evaluation (and possibly get semantic errors here &#8211; like missing variables etc.).</p>
<p>I still need to implement some stuff regarding classes  &#038; modules, but I&#8217;m quite happy for now, since it wasn&#8217;t so hard as I had expected before. Once I have everything working, I&#8217;ll start to actually rewrite the parser in a way, that it evaluates &#038; executes code on the fly, expression per expression and not all of them at once at the end. This should also improve performance, which is obviously another downside of my current approach, since I have to wait for all expressions being parsed &#038; evaluated to appropriate ruby code first, before even beginning the actual evaluation process&#8230; </p>
<p>For anyone, who is interested, here is a simple benchmark of the code above:</p>
<p>The <b>blockd version</b> (executed with my current interpreter):</p>
<blockquote><p>
real	0m0.264s<br />
user	0m0.184s<br />
sys	0m0.072s
</p></blockquote>
<p>The <b>ruby version</b> of the equivalent code (generated by my parser):</p>
<blockquote><p>
real	0m0.021s<br />
user	0m0.008s<br />
sys	0m0.008s
</p></blockquote>
<p>As you can see, there&#8217;s quite a performance overhead. Although not really noticeable by a viewer, the numbers tell the story. So I expect quite an improvement in performance, once I&#8217;ll start rewriting the interpreter in the way I&#8217;ve mentioned above. Still cool though, if you ask me <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.adztec-independent.de/2009/05/blockd-mixing-ruby-smalltalk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
