On Thu, Jun 4, 2009 at 5:35 PM, Dan Cross<cro...@gmail.com> wrote: > For my final project in the compilers course I took, I had this idea > to take structural regular expressions and use them to match patterns > against the parse trees generated by a compiler frontend. The intent > was to be able to detect "unsafe" code at compile time via pattern > matching; I then implemented a small awk-like language that contained > syntax for doing the matching and a few primitives for doing things > like printing compiler errors or warnings (hooking into the facilities > provided by the compiler). We linked it into lcc; it was kind of > neat. You could define a 'program' that the compiler interpreted as > it compiled a source file that could contain a library of additional > errors and warnings that were specific to your problem domain (for > instance, I wrote code to detect calls to 'gets' and error out).
Oh, in the interest of being honest, not that it's relevant to 9fans but just to show that I do have a conscience, I should mention that I did this project with two other students, though I feel it fair to say that I did the bulk of the technical work. - Dan C.