Closed ptar124 closed 2 years ago
You don't need to use pointers in the parser. You can either return a dynamically allocated variable (so using new
), or you need to copy the objects. Copying the objects is just much less efficient, but it should be fine to use either, as long as all your types are correct. (If your AST consists of pointers, then your parser should also return pointers)
In lab 2, pointers are used to make new variables. what other situations are there in the coursework might we need to do the same?