rewrting grammar and AST builder(not compiled ok)