Adding macro definitions and variable generation.

TODO: handle neighbors