Closed LFLCH closed 6 months ago
The ast file and the other files related (grammar.ts, module.ts) are now located in the folder src/language/representation
.
The folder that contains the automatically generated files from the grammar file src/language/generated
is not used anymore in imports.
So far we did not use the accept method of the visitor design pattern in the child classes of the visitor (i.e interpreterVisitor) It was because we had to use the children AST classes, written in the visitor.ts file, but those classes had a problem dealing with the "Abstract" AST nodes ("Expression", "RobotSymbol" and "Statement"). It was impossible to extend them, given that they are not generated as Interfaces from the current grammar.
In these modifications, we provide a modified version of the ast.ts file, that represents those abstract nodes as Interfaces. It allow to correctly use the visitor design pattern in its child classes, and so, have a better code.
The best solution is still to modify the grammar, but given the remaining time, I think it is an acceptable solution. It only requires to use a slightly modified version of the ast.ts file.