Jun 172008
 

Last updated: 2008-06-17

Trying to do play around with some static analysis? Here a review of software that helps to create an abstract syntax tree for C:

  • styx, a scanner and parser software that says it is easier to use than lex/yacc (with some small limitations). It is supposed to automatically generate an abstract syntax tree.
    Problem: I was unable to find any grammars for it except the ones on the download page (they do have a grammar for php there), and the documentation about writing one is not really complete.
  • elsa/elkhound, generates an abstract syntax tree for C++, but lacks documentation for how to write a context sensitive analysis that can process the tree. It is complicated without documentation, because meta programming is used for the ast.
  • olmar is an ocaml wrapper for elsa and adds a nice program to generate graphs of the AST. This would be my option if I had been able to use ocaml.
  • Open C++ core, the core of the Open C++ project, which introduces aspect oriented / meta object programming to C++. Almost no documentation exists though.
  • oink is a Collaboration of C++ Static Analysis Tools, which sounds like a nice middle-ware (it uses elsa as a backend). It lists as one of its goals extensible for ease in adding backends, yet I could not find much information about how to actually do that.

elsa seems to be the standard tool for the task, but understanding its internals was too complicated for my small project, so I ended up printing the AST as XML and reading that back in from my program.

Jun 142008
 

Are you trying to boot Windows from a second hard drive, but it just hangs and nothing happens?

Windows apparently only really supports booting from the first hard drive, but grub can trick Windows by remapping drives:

title Windows
        rootnoverify (hd1,0)
        map (hd0) (hd1)
        map (hd1) (hd0)
        chainloader +1

Source: http://www.weiqigao.com/blog/2004/01/14/windows_on_the_second_hard_drive_linux_on_the_first.html