7 Jun 2005 joolean   » (Journeyer)


So I've spent the past several weeks tooling away at a lexer / parser to use with SCSS. I wanted something small and (hopefully) portable. Guile's old (lang lex) module was looking good -- it's no longer part of the distribution, but it was small enough to just snarf into my project wholesale. Unfortunately, it depended on Tom Lord's Rx library, and having my Scheme CSS parser depend on a rather scarce library of C code was a big no-no. So I decided to rewrite the requisite parts of Rx (basically regular expression to DFA conversion code) in Scheme -- no easy task as I discovered. I got depressed, totally stressed out. My regexp->dfa parser got to the point where it could more or less convert a well-formed regexp to an S-expression representing a DFA, and you could feed strings to it and have the states change, but for some reason it just didn't work with (lang lex). My desperation led me to start my module hunt from scratch. Thanks to providence, or, I don't know, something, I came across Silex. About an hour and a half of work later, I'm parsing CSS into S-expressions and handling errors. It's a wonderful thing. Thank you, Danny Dubé!

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!