Ast switch out

Pulled out the AST generation from the scan.js - scan function. There is also a way to set another parser than acorn. It should solve issue #155
Rename `parser` for explicitness.