fix deps build
hoist grammar and function declarations (unless local function)