Refactor code structure to have separate parser and grammar modules
integrated lincds and fixed memory leaks