<?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 &#187; meta-programming</title>
	<atom:link href="http://www.adztec-independent.de/tag/meta-programming/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>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>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="p2322"><td class="code" id="p232code2"><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>Parser generation with Ruby</title>
		<link>http://www.adztec-independent.de/2009/05/parser-generation-with-ruby/</link>
		<comments>http://www.adztec-independent.de/2009/05/parser-generation-with-ruby/#comments</comments>
		<pubDate>Wed, 27 May 2009 00:12:25 +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[meta-programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.adztec-independent.de/?p=201</guid>
		<description><![CDATA[I&#8217;ve started to play a little with Treetop, a parser generator library for Ruby.
Why? you might ask. While I&#8217;ve been dreaming of my own programming languages and designing them for quite some time now, I never really managed to actually get beyond the design-phase. I&#8217;ve come up with several language designs in the past, each [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started to play a little with <a href="http://treetop.rubyforge.org">Treetop</a>, a parser generator library for Ruby.<br />
Why? you might ask. While I&#8217;ve been dreaming of my own programming languages and designing them for quite some time now, I never really managed to actually get beyond the design-phase. I&#8217;ve come up with several language designs in the past, each time getting closer to something that I think really could work (which doesn&#8217;t mean, that it actually could be useful or &#8216;good&#8217; &#8211; if that even makes sense).<br />
While I&#8217;ve been looking at many different languages in the past, I&#8217;ve found the dynamic, object-oriented and functional  high-level languages to be most interesting &#038; fun to work with. Naturally, after working with Ruby alot, I&#8217;ve started looking a little bit at Smalltalk and how it differs to Ruby.</p>
<p>Inspired by what Smalltalk and Ruby have to give, I started designing my own language, heavily influenced by those two great, very dynamic, truly object-oriented programming languages and came up with a quite simple language named <b>blockd</b>.</p>
<p>The name is based upon the main principle of the language: Everything is an object, and in the end, all code is defined within blocks &#8211; that are ruby / smalltalk like blocks. Naming these blocks is done via simple assignment. So instead of having a huge amount of keywords, the language itself is pretty simple, because all we really need is a way to describe assignments, instantiate objects and easily create blocks to pass to methods or use in an assignment.</p>
<p>So in contrast to Ruby, where there are procs, lambdas and blocks, blockd only knows blocks, which basically behave like Smalltalk like blocks &#8211; they simply are anonymous procedures / blocks of code (or functions, if you want to call them that &#8211; although not pure as in Haskell).</p>
<p>The syntax is a mix of Ruby&#8217;s and Smalltalk&#8217;s with some minor tweaks I thought would be cool (or not? I don&#8217;t know <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ).<br />
To give you an example of how the language looks, here is a small snippet of some sample code, that actually doesn&#8217;t work yet but might do so in the future <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </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=201&amp;download=sample.blk">sample.blk</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2014"><td class="code" id="p201code4"><pre class="lisp" style="font-family:monospace;"># this is just for demonstration
# there probably won't be the need to require the console module from the
# standard library every time you want to print something to the screen <span style="color: #808080; font-style: italic;">;)</span>
System require<span style="color: #66cc66;">:</span> <span style="color: #ff0000;">&quot;console&quot;</span>
&nbsp;
# we support ruby-style blocks with <span style="color: #b1b100;">do</span> <span style="color: #66cc66;">...</span> end <span style="color: #b1b100;">and</span> curly braces <span style="color: #66cc66;">&#123;</span> <span style="color: #66cc66;">...</span> <span style="color: #66cc66;">&#125;</span>
File open<span style="color: #66cc66;">:</span> <span style="color: #ff0000;">&quot;test.txt&quot;</span> mode<span style="color: #66cc66;">:</span> <span style="color: #ff0000;">&quot;w&quot;</span> <span style="color: #b1b100;">do</span> <span style="color: #66cc66;">|</span>f<span style="color: #66cc66;">|</span>
  f puts<span style="color: #66cc66;">:</span> <span style="color: #ff0000;">&quot;what's up, dog?!&quot;</span>
  f puts<span style="color: #66cc66;">:</span> <span style="color: #ff0000;">&quot;crazy shit, yo!&quot;</span>
  f puts<span style="color: #66cc66;">:</span> <span style="color: #ff0000;">&quot;hahaha!!&quot;</span>
end
&nbsp;
10 to<span style="color: #66cc66;">:</span> 0 <span style="color: #b1b100;">do</span> <span style="color: #66cc66;">|</span>i<span style="color: #66cc66;">|</span>
  Console puts<span style="color: #66cc66;">:</span> <span style="color: #555;">i</span>
end
&nbsp;
i <span style="color: #66cc66;">=</span> 0
<span style="color: #66cc66;">&#40;</span>i <span style="color: #66cc66;">&lt;</span> 10<span style="color: #66cc66;">&#41;</span> while_true<span style="color: #66cc66;">:</span> <span style="color: #b1b100;">do</span> <span style="color: #66cc66;">|</span>i<span style="color: #66cc66;">|</span>
  Console puts<span style="color: #66cc66;">:</span> <span style="color: #555;">i</span>
  i incr
end
&nbsp;
numbers <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>1<span style="color: #66cc66;">,</span>2<span style="color: #66cc66;">,</span>3<span style="color: #66cc66;">,</span>4<span style="color: #66cc66;">,</span>5<span style="color: #66cc66;">&#93;</span> select<span style="color: #66cc66;">:</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">|</span>i<span style="color: #66cc66;">|</span> i <span style="color: #66cc66;">&lt;</span> 3<span style="color: #66cc66;">&#125;</span>
numbers each<span style="color: #66cc66;">:</span> <span style="color: #b1b100;">do</span> <span style="color: #66cc66;">|</span>i<span style="color: #66cc66;">|</span>
  puts i
end
&nbsp;
<span style="color: #66cc66;">&#40;</span>1 <span style="color: #66cc66;">..</span> 100<span style="color: #66cc66;">&#41;</span> each<span style="color: #66cc66;">:</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">|</span>i<span style="color: #66cc66;">|</span> Console puts<span style="color: #66cc66;">:</span> <span style="color: #555;">i</span><span style="color: #66cc66;">&#125;</span>
&nbsp;
squares <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span>1 <span style="color: #66cc66;">..</span> 100<span style="color: #66cc66;">&#41;</span> collect<span style="color: #66cc66;">:</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">|</span>i<span style="color: #66cc66;">|</span> i<span style="color: #66cc66;"> * </span>i<span style="color: #66cc66;">&#125;</span>
&nbsp;
# define a square method
square <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #66cc66;">|</span>x<span style="color: #66cc66;">|</span>
  x<span style="color: #66cc66;"> * </span>x
<span style="color: #66cc66;">&#125;</span>
&nbsp;
# <span style="color: #b1b100;">or</span> like this<span style="color: #66cc66;">:</span>
<span style="color: #b1b100;">abs</span> <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #66cc66;">|</span>num<span style="color: #66cc66;">|</span>
  <span style="color: #66cc66;">&#40;</span>num <span style="color: #66cc66;">&gt;</span> 0<span style="color: #66cc66;">&#41;</span> if_true <span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">return</span> num
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  num<span style="color: #66cc66;"> * </span>-<span style="color: #cc66cc;">1</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>I&#8217;m still tweaking the syntax and haven&#8217;t decided upon all things completely yet, but I guess I&#8217;ve found the pretty basic &#8220;feel&#8221; of it.</p>
<p>While I haven&#8217;t shown you any code that defines a class or modules, it still does show a little of the languages syntax.  I&#8217;ve started the parser today and it successfully parses the code above, meaning, that since the syntax isn&#8217;t too complicated, I expect to be able to parse all the remaining stuff (classes &#038; modules and some minor other things) pretty soon. I then intend to start writing the actual implementation &#8211; an interpreter written in Ruby. While I could come up with my own runtime, class library etc, I want to make use of the Ruby infrastructure as much as possible. For one reason, it makes it easier to actually implement something useful, on the other hand, since the language is very close to Ruby&#8217;s object model and semantics, I hope I can use most of Ruby&#8217;s code directly. This also would mean, that the interpreter could also run on other Ruby implementations like JRuby, IronRuby etc. And maybe, some day, it could also run natively compiled with the Ruby compiler I&#8217;ve been working on recently as well &#8211; but that&#8217;s still far into the future, since the compiler isn&#8217;t finished yet.</p>
<p>I guess that&#8217;s it for now. More to come soon <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/parser-generation-with-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lisp Screencast 01: Macros</title>
		<link>http://www.adztec-independent.de/2009/01/lisp-screencast-01-macros/</link>
		<comments>http://www.adztec-independent.de/2009/01/lisp-screencast-01-macros/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 03:04:25 +0000</pubDate>
		<dc:creator>Christopher</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Lisp Screencast]]></category>
		<category><![CDATA[common lisp]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[macros]]></category>
		<category><![CDATA[meta-programming]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[screencast]]></category>

		<guid isPermaLink="false">http://www.adztec-independent.de/?p=115</guid>
		<description><![CDATA[I&#8217;ll post some stuff and pictures of the congress soon, but I wanted to make another post first.
I&#8217;ve been programming Lisp for a little while now and always have been looking for some video tutorials (or screencasts) about Common Lisp or Lisp  programming in general but haven&#8217;t found so many.
Also doing some Ruby stuff, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll post some stuff and pictures of the congress soon, but I wanted to make another post first.</p>
<p>I&#8217;ve been programming Lisp for a little while now and always have been looking for some video tutorials (or screencasts) about Common Lisp or Lisp  programming in general but haven&#8217;t found so many.<br />
Also doing some Ruby stuff, I always enjoyed the huge amount of videos online and thought that there should be more Lisp related screencasts as well.</p>
<p>So, I thought about starting my own. And here it is <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>You can download the Quicktime file here: <a href="http://www.adztec-independent.de/wp-content/screencast/Lisp%20Screencast%20-%2001%20-%20Macros.mov">Lisp Screencast #01: Macros</a></p>
<p>Or also watch it on my <a href="http://bakkdoor.blip.tv/" target="_blank">Blip.tv channel</a>:</p>
<p><object width="500" height="500" data="http://blip.tv/play/gq855LcRktwZ" type="application/x-shockwave-flash"><param name="src" value="http://blip.tv/play/gq855LcRktwZ" /><param name="allowfullscreen" value="true" /></object></p>
<p>Any comments? Feel free to send me a mail or post a comment here.</p>
<p>I&#8217;ll try to make this a regular thing for the future. Any topic suggestions are also welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adztec-independent.de/2009/01/lisp-screencast-01-macros/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.adztec-independent.de/wp-content/screencast/Lisp%20Screencast%20-%2001%20-%20Macros.mov" length="56134847" type="video/quicktime" />
		</item>
		<item>
		<title>Language creation</title>
		<link>http://www.adztec-independent.de/2008/12/language-creation/</link>
		<comments>http://www.adztec-independent.de/2008/12/language-creation/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 21:41:38 +0000</pubDate>
		<dc:creator>Christopher</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[functional]]></category>
		<category><![CDATA[hobbies]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[lisp]]></category>
		<category><![CDATA[meta-programming]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.adztec-independent.de/?p=76</guid>
		<description><![CDATA[ 

I recently started thinking about creating a programming language from scratch, but obviously heavily inspired by existing programming languages out there.
I don&#8217;t have anything concrete yet but these are the main principles I came up with for the language:

Somewhat functional (but not purely functional). So side-effects should be more or less easily possible within non side-effecting [...]]]></description>
			<content:encoded><![CDATA[<p> </p>
<div>
<p>I recently started thinking about creating a programming language from scratch, but obviously heavily inspired by existing programming languages out there.</p>
<p>I don&#8217;t have anything concrete yet but these are the main principles I came up with for the language:</p>
<ul>
<li>Somewhat functional (but not purely functional). So side-effects should be more or less easily possible within non side-effecting code. Mainly for reasons regarding the process of actually building the compiler / interpreter and that it should be a dynamic language. Especially the last point makes it pretty obvious that since there is no static typechecking, making  it purely functional would be kind of hard to realise (although possible i guess). </li>
<li>Garbage-collected / automatic memory management. Kind of makes sense with a functional language and who really wants another assembly-like, low-level language?</li>
<li>An easy way to extend the language in itself (as in Lisp, for example, with macros or some similar meta-programming capability).</li>
<li>Dynamically typed (like Lisp or Ruby for example)</li>
<li>Small, in the sense that the language itself should not be bloated and most of the value of it shouldn&#8217;t be part of the language itself, but implemented in it. By that I don&#8217;t only mean the standard library, where this usually is the case already, but also those things, often considered part of the language (or &#8220;built-in&#8221;) in other languages. Haskell is a good example of operators and data types not being tied completely into the language, but rather implemented in it. A good example is the Boolean data type, which is merely defined in Haskell itself (and if it hadn&#8217;t been, it would be trivial to come up with your own). This works because Haskell uses some very nice pattern matching with its algebraic datatypes and I could imagine something similar for my language.</li>
</ul>
<p>That are my main concerns this far. Obviously theres still much to decide, mainly syntax and semantics. Compelling are Haskell&#8217;s typesystem with its really powerful, yet simple datatypes and pattern matching. On the other hand there&#8217;s Lisp with its macros and Ruby with its also powerful meta-programming mechanisms.</p>
<p>Let&#8217;s see, where this will go <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
]]></content:encoded>
			<wfw:commentRss>http://www.adztec-independent.de/2008/12/language-creation/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Lisp macros part 2</title>
		<link>http://www.adztec-independent.de/2008/11/lisp-macros-part-2/</link>
		<comments>http://www.adztec-independent.de/2008/11/lisp-macros-part-2/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 15:56:36 +0000</pubDate>
		<dc:creator>Christopher</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[common lisp]]></category>
		<category><![CDATA[macros]]></category>
		<category><![CDATA[meta-programming]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.adztec-independent.de/?p=36</guid>
		<description><![CDATA[I&#8217;ve been playing a little more with macros and came up with a foreach-loop, similar to those used in Java or C#.
It basically does the same as the predefined dolist-macro, but oh well  
foreach macro

?View Code LISP1
2
3
4
5
6
7
8
9
10
;; foreach-loop, similar to those in Java or C#
;; example: (foreach (x '(1 2 3))
;;       [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing a little more with macros and came up with a foreach-loop, similar to those used in Java or C#.</p>
<p>It basically does the same as the predefined dolist-macro, but oh well <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>foreach macro</strong></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="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p36code7'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p367"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p36code7"><pre class="lisp" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">;; foreach-loop, similar to those in Java or C#</span>
<span style="color: #808080; font-style: italic;">;; example: (foreach (x '(1 2 3))</span>
<span style="color: #808080; font-style: italic;">;;                               (print x))</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defmacro</span> foreach <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>var <span style="color: #b1b100;">list</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&amp;</span>body body<span style="color: #66cc66;">&#41;</span>
  `<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">,</span>var <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> <span style="color: #66cc66;">,</span><span style="color: #b1b100;">list</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>rest <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cdr</span> <span style="color: #66cc66;">,</span><span style="color: #b1b100;">list</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">,</span>var
	<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">progn</span>
	  <span style="color: #66cc66;">,</span>@body
	  <span style="color: #66cc66;">&#40;</span>foreach <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">,</span>var rest<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">,</span>@body<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #b1b100;">nil</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>I&#8217;ve also come up with my own file-handling macro, similar to the predefined with-open-file:</p>
<p><strong>with-file macro</strong></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="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p36code8'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p368"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p36code8"><pre class="lisp" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">;; can be used like with-open-file macro</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defmacro</span> with-file <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>filestream-var filename <span style="color: #66cc66;">&amp;</span>optional <span style="color: #66cc66;">&amp;</span>key <span style="color: #66cc66;">&#40;</span>if-exists <span style="color: #b1b100;">nil</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>direction <span style="color: #66cc66;">:</span><span style="color: #555;">input</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&amp;</span>body body<span style="color: #66cc66;">&#41;</span>
  `<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">,</span>filestream-var <span style="color: #66cc66;">&#40;</span>open <span style="color: #66cc66;">,</span>filename <span style="color: #66cc66;">:</span><span style="color: #555;">direction</span> <span style="color: #66cc66;">,</span>direction <span style="color: #66cc66;">:</span><span style="color: #555;">if-exists</span> <span style="color: #66cc66;">,</span>if-exists<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">,</span>@body
    <span style="color: #66cc66;">&#40;</span>close <span style="color: #66cc66;">,</span>filestream-var<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>At first macros seemed to be something complicated, but once I&#8217;ve started reimplementing some of the standard macros and also making up my own custom ones, it really got much clearer to me how they work and why they are so important. Especially the with-file macro gives you an idea of whats possible with macros. Abstracting away the pattern of opening a file, doing something and then closing it again is just really nice, since you won&#8217;t ever forget to close it again, if you stick with using the macro.</p>
<p>I&#8217;ll try to come up with some more soon. <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Next big thing on my agenda is some file in- and output as well as CLOS, the powerful Common Lisps Object System.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adztec-independent.de/2008/11/lisp-macros-part-2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Creating standard control structures in common lisp</title>
		<link>http://www.adztec-independent.de/2008/11/creating-standard-control-structures-in-common-lisp/</link>
		<comments>http://www.adztec-independent.de/2008/11/creating-standard-control-structures-in-common-lisp/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 16:59:14 +0000</pubDate>
		<dc:creator>Christopher</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[common lisp]]></category>
		<category><![CDATA[macros]]></category>
		<category><![CDATA[meta-programming]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.adztec-independent.de/?p=29</guid>
		<description><![CDATA[I&#8217;ve been playing around with (and also learning) common lisp recently and found its macro system very intriguing. So I started to implement some standard imperative control structures that closely resemble those found in most imperative mainstream programming languages like Java or C.
Here&#8217;s what I&#8217;ve done so far:
while macro:

?View Code LISP1
2
3
4
5
6
7
8
;; example:
;; (defparameter x 0)
;; [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around with (and also learning) common lisp recently and found its macro system very intriguing. So I started to implement some standard imperative control structures that closely resemble those found in most imperative mainstream programming languages like Java or C.</p>
<p>Here&#8217;s what I&#8217;ve done so far:</p>
<p><strong>while macro:</strong></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="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p29code12'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2912"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p29code12"><pre class="lisp" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">;; example:</span>
<span style="color: #808080; font-style: italic;">;; (defparameter x 0)</span>
<span style="color: #808080; font-style: italic;">;; (while (&lt; x 10) (print x) (incf x)) ;; output numbers 0 - 9.</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defmacro</span> while <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cond</span> <span style="color: #66cc66;">&amp;</span>body body<span style="color: #66cc66;">&#41;</span>
  `<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">,</span><span style="color: #b1b100;">cond</span> 
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">progn</span> <span style="color: #66cc66;">,</span>@body 
	   <span style="color: #66cc66;">&#40;</span>while <span style="color: #66cc66;">,</span><span style="color: #b1b100;">cond</span> <span style="color: #66cc66;">,</span>@body<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">nil</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p><strong>until macro</strong></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="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p29code13'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2913"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p29code13"><pre class="lisp" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">;; example: (until (= x 10) (print x) (incf x))</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defmacro</span> until <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cond</span> <span style="color: #66cc66;">&amp;</span>body body<span style="color: #66cc66;">&#41;</span>
  `<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">not</span> <span style="color: #66cc66;">,</span><span style="color: #b1b100;">cond</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">progn</span> <span style="color: #66cc66;">,</span>@body
	   <span style="color: #66cc66;">&#40;</span>until <span style="color: #66cc66;">,</span><span style="color: #b1b100;">cond</span> <span style="color: #66cc66;">,</span>@body<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">nil</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p><strong>for macro</strong></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="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p29code14'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2914"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p29code14"><pre class="lisp" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">;; example:</span>
<span style="color: #808080; font-style: italic;">;; (for ((i 0) (&lt; i 10) (incf i))</span>
<span style="color: #808080; font-style: italic;">;;      (print i))</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defmacro</span> for <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>var init-<span style="color: #b1b100;">value</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">cond</span> step-block<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&amp;</span>body body<span style="color: #66cc66;">&#41;</span>
  `<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">do</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">,</span>var <span style="color: #66cc66;">,</span>init-<span style="color: #b1b100;">value</span> <span style="color: #66cc66;">,</span>step-block<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">not</span> <span style="color: #66cc66;">,</span><span style="color: #b1b100;">cond</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">,</span>@body<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>I started this yesterday and I&#8217;ll try to come up with some more. Lets see what else i can come up with <img src='http://www.adztec-independent.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
Not that this is particularly useful or anything since you really don&#8217;t <em>need</em> them, but it&#8217;s still a nice way to learn the language and especially how macros work. I&#8217;ll just keep it as a little exercise to myself in order to get to know common lisp in greater detail. <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/2008/11/creating-standard-control-structures-in-common-lisp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

