|
|
|
|
|
by chriswarbo
2350 days ago
|
|
I once needed to get some complex data out of a very restricted interface (syntax trees from a compiler plugin, where the only communication channel was stderr). The AST nodes provided a generic-programming interface, so I made a dead simple tree traversal which spat out the node type followed by each child, wrapped in a pair of parentheses to disambiguate structure. Since these dumps turn out to be s-expressions, it seemed like a good idea to do further processing using a Lisp. I picked Racket (a Scheme) and it was great: parsing was a no-op, and the language made recursing through the structure and pattern-matching on the contents really simple. The only downside was that I wrote a lot of "contracts" (dynamically-checked types), since I'm more comfortable in statically-typed languages (Haskell, StandardML, etc.). Turns out that Racket contracts are REALLY slow, so I ended up using a macro to discard them unless we were running the test suite :( |
|