More articles tagged 'ruby'

A simple Operator Precedence parser

Consider this an "interlude" of sorts in my series on writing a compiler, since the parser that will be presented in one of the future parts of that series depends significantly on an operator precedence parser to cut down on the amount of code.

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 ...

TraceViz: Visualizing traceroute output with graphivz

Update: Belorussian translation.

At Edgeio we had a fairly complicated network setup, and at one point I quickly hacked together a Ruby script to merge the paths generated by multiple traceroute runs together into directed graphs, showing the routing from a few selected host in our environment to all ...

Writing a compiler in Ruby bottom up - step 7

I've combined two of the planned parts this time, what was in the list from last time as parts 7 and 8.

Making use of lambda / call

We can implement loops using recursion "manually", but adding lambda's now should make it possible to create a slightly cleaner version by actually ...

Giant balls of typeless source files

Cedric posted this entry about an article by Steve Yegge called Dynamic languages strike back (it's slightly interesting, but nothing really new if you already like dynamic languages, though the section on trace trees is wel worth a read). Most of Cedric's comments were unremarkable, but this ...