More articles tagged 'tutorial'

Simple charts in Ruby using SVG::Graph

One thing that comes up time and time again when I mess around with a system, is quickly looking at frequencies of various things - for example disk usage by sub-directory, or referrer entries in my Apache access log.  Like this:

# cat /var/log/httpd/access_log | cut -d' ' -f11 | grep ...

Just added a github repository for my compiler series

If you're following my compiler series you can now find a github repository here. For now I've just added the code published so far, but when I reach the end of the already written material I'll start making more fine grained commits.
Fork away :)


Writing a compiler in Ruby bottom up - step 13

It's been a few months, and apart from my side step into parser land I haven't had much time to keep posting this series, in part because of work, and part because of repeated illness that after being poked and prodded and x-rayed and being subjected to ultrasound (no, I'm not ...

Writing a compiler in Ruby bottom up - step 12

At this point it's worth looking briefly at what is required to implement something more "serious" without a lot of excessive pain. It's really quite easy:

  1. We really want variable length arguments
  2. We want primitives that allow us to create and access arrays. Lets call them "array" and "index", ...

Writing a compiler in Ruby bottom up - step 11

It's been a long time, and but I finally have a little bit of time again, and it's time to continue.

At this point the next step is some re-factoring. As it stands the compiler is very tightly tied to x86, and before it gets bigger it's worth starting to redress ...

Writing a compiler in Ruby bottom up - step 10

Uh, yeah. So much for posting the next part in a few days. I think I'll stop trying to second guess when I'll next have time (but sine I'm going off to Norway for vacation for a week, it's a safe bet the next part won't show up until later than ...

Writing a compiler in Ruby bottom up - step 9

As we've seen, 'while' can be implemented fairly easily in terms of a quite basic language. We could streamline it even more by reducing the verbiage needed to pass anonymous functions or by adding a Lisp style macro facility, but there are complications, so I'm biting the bullet and adding a built in "while" construct for now.

Writing a compiler in Ruby bottom up - step 8

Last time we looked at an improved way of handling loops etc. using anonymous functions. But most of that is relatively limited if there's no way of modifying variables. Sure, you can get away with recursion and not allow mutation or even other side effects at all. It might satisfy some ...