Hi all,
I try to make sense of Petit Java and the discussions around it, because it makes sense to have a similar architecture for Petit Delphi. The Delphi syntax contains 141 rules, versus 137 rules in java. So we compare pretty closely. But when I try to read the petit java code, I notice some odd things, so maybe someone can tell me why things are as they are.
I thought AST meant we have an Abstract Syntax Tree. A syntax tree, that only contains the information needed. The way we do it on the Delphi side, is that only when we have a purpose for a certain AST Node we create it. On the detail level, we do not have many AST nodes yet, since we only generate FAMIX to the method level. And the number of AST nodes is growing fast. Why does the AST needs to stick to the java grammar as closely as possible?
When I look at the AST Node and at the places where they are created, they more look like grammar nodes than syntax nodes. I have a node called MethodDeclarationNode. But it is created in the rule "methodNotConstructorDeclaration" and when I look at the rule "methodDeclaration" I would expect to have 2 subclasses: a ConstructorDeclarationNode and a MethodNotConstructorDeclarationNode … but instead I have a subclass InterfaceMethodDeclarationNode. I thought FAMIX was meant for this and that is why we convert our AST into FAMIX as well …
In PetitJava there is a visitor for the AST. I do not see how this visitor helps. The AST is changing faster than the implementors of the visitor, not only because we are evolving Petit Java, but also because Java itself also evolves and will make changes to the language in the future. I see only a few possible implementors of this visitor.
And maybe some of the Petit Java developers want to take a look at the Petit Delphi code. Because I am sure we did things good and also some stupid things, so please help us find the stupid things and copy the good things! I know I try to copy the good ideas from petit java.
Regards, Diego