fix tools/{parse,compile}.js
fix 'env is undefined' for attributes
fix 'index is undefined'