splitted compile.js

Took matches() out and moved to separate module