March 29, 2008

I've got your back.

wow_lvl_45_war.gif

March 26, 2008

@twitter feature request?

twitter_daily_digest.gif

March 22, 2008

You know Flash?

whats_flash.gif

March 21, 2008

The New Me

February 25, 2008

C++ and Spirit

So I've been busy doing taxes, getting over my cold, and refreshing my C++. As part of the C++ refreshing I was using Antlr and some STL libraries. While looking at the STL libs I also went to look at Boost, only to find Spirit, a C++ recursive descent parser. I haven't looked at it much, but I'm going to re-do the first couple examples using it, and compare them to the Antlr versions. It may be better suited for what I'm doing since Antlr 3 doesn't have a (working?) C++ output. I know already that if I switch, I'm going to miss AntlrWorks. ;-)

February 12, 2008

Antl3 actions in C

I started working with rule actions in Antlr 3 + C (A3C). In section 3.2 of the book Terence adds an action to load a stored value from a recognized ID. I decided to keep it simple and just print out some information for that recognized ID. My action grammar:

atom returns [int value]

    :    INT
    |    ID
        {
        printf("Position: \%d\nToken Index: \%d\nText: \%s\n", $ID.pos, $ID.index, $ID.text->chars);
        }
    |    '(' expr ')'

As you can see, the rule for atom is looking for ID which is defined as ('a'..'z'|'A'..'Z')+. When it finds this alphabetic string it's going to print out the position of where it appeared on the line, its index and the value of the token (the matched text).

The action token ID.text is very similar to the Java equivalent, the difference being that it is a struct and to get to the characters you have to use the struct's chars variable. You can find the struct defined in antlr3string.h.

There are a couple of other properties that you can use off of the token variables. Other than .text, you can use: (this is mostly for my own reference). ;-)

  • type
  • line
  • pos
  • channel
  • index
  • tree
TTFN!
 

February 11, 2008

Y! Q2/07 Hack Day

Today Yahoo! released the AS3 version of their maps API. They also released the hack that Jon and I worked on back in Q2. Check it out, and if you don't have Flash9 and refuse to upgrade, you can try spinning and flicking your iPhone to simulate it*. You almost get the same effect.

*You assume full responsibility for any damages done to your iPhone.