How to write a linter?

Posted by jbdavid on Stack Overflow See other posts from Stack Overflow or by jbdavid
Published on 2008-09-16T09:26:08Z Indexed on 2010/04/04 5:03 UTC
Read the original article Hit count: 410

In my day job I, and others on my team write a lot of hardware models in Verilog-AMS, a language supported primarily by commercial vendors and a few opensource simulator projects. One thing that would make supporting each others code more helpful would be a LINTER that would check our code for common problems and assist with enforcing a shared code formatting style. I of course want to be able to add my own rules and, after I prove their utility to myself, promote them to the rest of the team.. I don't mind doing the work that has to be done, but of course also want to leverage the work of other existing projects.

Does having the allowed language syntax in a yacc or bison format give me a leg up? or should I just suck each language statement into a perl string, and use pattern matching to find the things I don't like?

(most syntax and compilation errors are easily caught by the commercial tools.. but we have some of our own extentions.)

© Stack Overflow or respective owner

Related posts about coding-style

Related posts about verilog