Stoppt die Vorratsdatenspeicherung! Jetzt klicken &handeln! Willst du auch an der Aktion teilnehmen? Hier findest du alle relevanten Infos
  und Materialien:

Skip to content


Fancy Talk @ Warpzone.ms

Hey,

I haven’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 @ Warpzone.ms from Christopher Bertels on Vimeo.

Posted in General. Tagged with , , , , , , , , , , , , , , .

New Project: The Fancy Programming Language

Ok, I know I’m not a frequent poster. I guess, that’s just the way it is. Anyways..

I’ve been up to a lot of stuff in the past few months. Related to programming there are two projects, one of them I’m still working on (and intend to do so for the forseeable future):

  • generica, a small, simple & dirty lisp-like language interpreter implemented in ANSI C.
  • and Fancy, a new object-oriented dynamic programming language, heavily inspired by Ruby, Smalltalk and Erlang. There’s also a website up, but far from finished: fancy-lang.org – Check it out if you like :)

So yeah, the latter project I started about 6 weeks ago but didn’t have the time to really work on it until about 3 weeks ago. Since then I’ve managed to implement quite a few features.
Here’s a small overview of features working in Fancy already:

  • Class definitions
  • Method definitions
  • String, Integer, Double, Array, Hash (Hashmap), and Block (lambda function / closure) Literals
  • Method and operator calls (sending messages to objects)
  • Simple loops
  • Support for closures (performance improvements are definately possible though ;) )

There’s still lots of stuff missing, obviously. Mainly most of the standard library (I/O, Threading/Concurrency, Networking, etc…) will have to implemented as well as some runtime features I haven’t finished or started yet. But it’s getting along quite nicely. If anyone dares to try it out, I’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.

I’m still excited to see where this is gonna go, for myself and possibly others as well. We’ll see.

I’ll probably post some more information on the language and its implementation some time soon. Need to go now.

Posted in General. Tagged with , , , , , , , , , , , , , .

Screencast: Debugging with Emacs & GDB

Hey there.
I wish I’d be posting more recently, but haven’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 blip.tv channel: http://bakkdoor.blip.tv/
Currently the video is being converted to flash video (.flv), so you might want to check out the .ogv video file here, if it’s not done yet: http://blip.tv/file/2804484

[Update:]
Video is available now. You can also watch it here:

Anyhow, I hope you like it and I’d like to hear some feedback.

Btw, the programm I’m debugging in the video is stupidvm, a small & stupid virtual machine I’ve started working on 2 weeks ago, written in C.
You can check out the code either on gitorious or github.

Feedback is, as always, welcome :)
I hope you like it.

Posted in General. Tagged with , , , , , , , , , , , .

Small update & Introduction of ‘Stackd’

Oh wow. 3 months have passed – how time flys by!

So, what have I been up to in the past quarter year (doesn’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 in computer science shortly. The topic is “software architectures” – it’s in german of course, but I suppose that some day some one speaking german might find this interesting – isn’t this what the internet is for? ;)

Also, I’ve had a visit from my grand parents from California over in July. And then, I’ve been working at Intevation GmbH 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).
Since I’m a big fan of free software and its movement, I applied for an internship earlier this year and, well, they’ve accepted my application :)

So currently, I’ve been working on some packaging related stuff for Ubuntu and Debian. I’ll probably talk more about that in another upcoming post soon.

Alright, let’s get to the next topic I wanted to adress here:
I’ve started to work on a(nother) interpreter for a stack-based programming language I’ve called “Stackd”. It’s basically a poor & small reimplementation of the Factor programming language, but still missing many features of course.
If you’re interested in how it works and what it’s all about to programm in a concatinative programming language, as stack-based languages are often called, take a look here: http://concatenative.org. There you’ll find plenty of information, most of which will also apply for Stackd.

You can follow the current development progress at my git repositories here:

I’ve started to use Gitorious next to GitHub because I like the fact that it’s free software and I want to support it in a way. Besides, it’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 – but that might change in the future.

I’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 ‘About me’ page).

Posted in General.

Blocktalk Rubygem

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 –debug
or
blocktalk sourcefile.bt –ruby (to only show the generated ruby code)

Feel free to play around with it, check out the examples in the examples folder, if you want to get a start.
Would love to hear some feedback from anyone who’s interested, since this is my first attempt to language design :)

Posted in General. Tagged with , , , , , , , .

Blocktalk version 0.1 released

I just released version 0.1 of Blocktalk at Github.
I’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 to surround each method call with parentheses, like this:

?Download parens.bt
str = ("Hello, world!" upcase) gsub: "," with: ":"

Now you can do something like this:

?Download no-parens.bt
str = "Hello, world!" upcase gsub: "," with: ":"

Which is equivalent to this ruby code:

?Download no-parens.rb
str = "Hello, world!".upcase.gsub(",", ":")

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).
So now that I’ve got the most important things done, I’ll try to focus a little more on refactoring, working on the standard library (adding more classes & methods) and thinking about some more unique, new features for the language :)

Posted in General. Tagged with , , , , , , , , .

Blocktalk code available @ Github

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 ;)

Posted in General. Tagged with , , , , , , , , .

Blocktalk: A simple portscanner

Here’s a little blocktalk script, that shows the latest working feature I’ve added to my Blocktalk interpreter: Exception handling :)

Basically, it’s just a simple portscanner.

?Download portscan.bt
System require: "socket"
 
host = "localhost"
 
(ARGV at: 0) if {
  host = (ARGV at: 0)
}
 
open_ports = []
 
1 upto: 1024 do |port|
  Thread new {
    try{
      t = TCPSocket new: host port: port
      open_ports << port
 
      s = Socket getnameinfo: ["AF_INET", port, host]
      Console puts: ("\nPort #{port} (#{s[1]})" + " is open.")
 
      catch{
        Console print: "."
      }
 
      ensure{
        t if { t close }
      }
    }
  }
end
 
Console puts
Console puts: "Open ports on #{host} are:"
Console puts: (open_ports join: ", ")

So yeah, this is actually working. Now I’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’ll see :)

Update:
I’ve added Threading to the code, this speeds up the process a little ;)

Posted in General. Tagged with , , , , , , , , .

Blocktalk: Dealing with classes & modules

Alright. I’ve renamed my language again: Blocktalk is what I’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’s why i chose to name it that way.

Current progress:
Class & 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:

  • def (for indicating method definitions)
  • do & end (for codeblocks)
  • self (the same as in Ruby & Smalltalk: reference to the current object)
  • return (explicitly returning from withing the middle of a method)
  • yield (same as in ruby: yielding to a given implicit block)
  • Some literal syntax (not real Keywords, but somehow belongs into this category) for Arrays, Hashes, Codeblocks, Integers, Floats, Strings, Symbols, Characters and of course Assignment

That’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’s done in Smalltalk and how you can also do it in Ruby).

Here’s a small example of defining a class and a module:

Module >> :ModuleA do
  def method_a = do
    Console puts: "in ModuleA#method_a!"
  end
end
 
 
Module >> :ModuleB do
  def method_b = do
    Console puts: "in ModuleB#method_b!"
  end
end
 
Class >> :Place do
  def 1/>self from_city = do |city_name|
    # should do something useful here ...
    Place new
  end
 
  def coordinates = do
    # do some calculation here...
    return (Kernel rand)
  end
end
 
Class >> :Person do
  1/>self mixin: [ModuleA, ModuleB]
 
  # constructor with named params
  def initialize = do |name age: age city: city|
    @name = name
    @age = age
    @city = city
  end
 
  def go_to = do |place with: vehicle|
    ((place is_a?: Place) and: ((1/>self distance_to: place) < 10.5)) if_true {
      vehicle take: 1/>self to: place
    }
  end
 
  def place = do
    Place from_city: @city
  end
 
  def distance_to = do |place|
    (place is_a?: Place) if_true: {
      dist = ((1/>self place) coordinates) - (place coordinates)
      dist abs
    } if_false: {
      0.0
    }
  end
end
 
chris = Person new: "Christopher Bertels" age: 22 city: "Osnabrück"
city = Place from_city: "Berlin"
 
Console puts: "Distance from chris to city:"
Console puts: (chris distance_to: city)
 
# Person mixed in ModuleA & ModuleB:
chris method_a
chris method_b

I’m still tweaking a little here and there, but I think most of the standard language features are working now. Now I’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’s see ;)

Posted in General. Tagged with , , , , , , , .

Blockd: Mixing Ruby & Smalltalk

My new simple language, blockd, that I’ve mentioned in my last blog post is progressing quite nicely.
Since my last post a few days ago, I’ve worked on it quite a bit and I’ve got a first simple interpreter for it working.

For now, the interpreter is able to understand & execute methodcalls on objects, anonymous methods (blocks & procs in ruby) and some other minor stuff.

Heres a small example, that actually works now:

y = { |x|
  Console puts: x
  Console puts: (x * x)
}
y call: 10
 
m = { |x y|
  Console puts: ((x upcase) * y)
}
m call: "cool " y: 10
 
square = { |y|
  y * y
}
cubic = {|x| (x * x) * x}
 
3 times do |i|
  Console puts: i
end
 
foo = {
  3 times { |i| Console puts: (square call: i) }
}
 
Console puts: "--"
 
foo call
 
10 times &foo

This basically is equivalent to the following ruby code:

y = Proc.new{|x| Console.puts(x);Console.puts(x.*(x))}
y.call(10)
 
m = Proc.new{|x,y| Console.puts(x.upcase().*(y))}
m.call("cool ", 10)
 
square = Proc.new{|y| y.*(y)}
cubic = Proc.new{|x| x.*(x).*(x)}
 
3.times(&Proc.new{|i| Console.puts(i)})
 
foo = Proc.new{3.times(&Proc.new{|i| Console.puts(square.call(i))})}
 
Console.puts("--")
 
foo.call()
 
10.times(&foo)

Now, to make this clear: The ruby code above is what the current interpreter actually executes. The way I’ve implemented it for now (and for simplicity only – just to get something working first) is, that it simply parses the blockd code and translates it into equivalent ruby code, which then gets executed via eval in ruby.
Now I know, this isn’t the best way to do it, for several reasons:
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’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.

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 Evaluator). When the parser has done it’s job and all the values (strings of ruby code) of all expression nodes have been accumulated, i simply run ruby’s eval on it and at that point do the actual evaluation (and possibly get semantic errors here – like missing variables etc.).

I still need to implement some stuff regarding classes & modules, but I’m quite happy for now, since it wasn’t so hard as I had expected before. Once I have everything working, I’ll start to actually rewrite the parser in a way, that it evaluates & 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 & evaluated to appropriate ruby code first, before even beginning the actual evaluation process…

For anyone, who is interested, here is a simple benchmark of the code above:

The blockd version (executed with my current interpreter):

real 0m0.264s
user 0m0.184s
sys 0m0.072s

The ruby version of the equivalent code (generated by my parser):

real 0m0.021s
user 0m0.008s
sys 0m0.008s

As you can see, there’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’ll start rewriting the interpreter in the way I’ve mentioned above. Still cool though, if you ask me :)

Posted in General. Tagged with , , , , , , , , .


Ihr Browser versucht gerade eine Seite aus dem sogenannten Internet auszudrucken. Das Internet ist ein weltweites Netzwerk von Computern, das den Menschen ganz neue Möglichkeiten der Kommunikation bietet.

Da Politiker im Regelfall von neuen Dingen nichts verstehen, halten wir es für notwendig, sie davor zu schützen. Dies ist im beidseitigen Interesse, da unnötige Angstzustände bei Ihnen verhindert werden, ebenso wie es uns vor profilierungs- und machtsüchtigen Politikern schützt.

Sollten Sie der Meinung sein, dass Sie diese Internetseite dennoch sehen sollten, so können Sie jederzeit durch normalen Gebrauch eines Internetbrowsers darauf zugreifen. Dazu sind aber minimale Computerkenntnisse erforderlich. Sollten Sie diese nicht haben, vergessen Sie einfach dieses Internet und lassen uns in Ruhe.

Die Umgehung dieser Ausdrucksperre ist nach §95a UrhG verboten.

Mehr Informationen unter www.politiker-stopp.de.