C'Dent - An Acmeist Adventure

| | Comments (0) | TrackBacks (0)
I saw Ingy talk at the Portland Perl Mongers last night, and he introduced his C'Dent "programming language". It is not actually a new language, since it defines no new syntax. It is actually the union of a subset of the input languages it supports (currently Python, Javascript, Perl 6 and YAML) plus a "data model" for how represent and convert between them.

Given a module in the C'dent subset of a supported input language, it can export to one of the current output languages, which are the input languages, plus Perl 5, Python 3, Java, Ruby and PHP.

There are obviously many issues that will be interesting to address, such as dealing with concurrency and differences in object models, but I think the philosophy of the project is awesome: Acmeism :

Acmeism is the belief that language naturally tends to divide people and ideas, but that technology can overcome this tendency. People who create technology that is not limited to a particular language are known as Acmeists.

We have plans to add Parrot Intermediate Representation (PIR) as an output and maybe an input language at the PDX Hackathon tonight. Come on by! PDX Hackathon has always been an Acmeist gathering, and it has been said that "Beer is our Bytecode."

Sedtris - Tetris Written In Sed

| | Comments (1) | TrackBacks (0)

Need I say more? Sedtris.


Find Files Who Have No Lines Matching a Regex

| | Comments (1) | TrackBacks (0)
I found myself in the situation of having a bunch of files and I needed to find out which one's did not include a certain header file. This turned out to be a great place for short-circuiting with grep.

for i in files/*; do grep PATTERN $i >>/dev/null || echo $i; done

Grep returns false when it cannot find a match, which triggers the echo of the filename to STDOUT. The PATTERN can be any valid regular expression for your system's flavor of grep. This can save tons of time if you have dozens/hundreds of files and only a few are missing something. To edit these files in vim, it is nothing more than:

vim `for i in files/*; do grep PATTERN $i >>/dev/null || echo $i; done`

Happy Hacking!
Clicky Web Analytics Screw you, spammers! 42