swp-uebersetzerbau-ss13 / common

Shared files between teams.
1 stars 0 forks source link

Attributes in ASTNode #31

Closed EdwarDDay closed 11 years ago

EdwarDDay commented 11 years ago

Attirbutes for the semantic analyser should be saved in ASTNodes. This way the visualizer could show the attributes.

void setAttributeValue(Attribute attribute,String value);

String getAttributeValue(Attribute attribute);

And a Attribute interface is needed:

public interface Attribute{

    /*
    * return name of Attribute for visualizer
    */
    String getName();
}

Because of the short time to the next milestone this should be implemented after MS2.

selphiron commented 11 years ago

Which attributes do you mean? You can find attributes in the subclass (e.g.(DeclarationNodeJb) ast).getType())

EdwarDDay commented 11 years ago

There is no DeclarationNodeJb interface in the common repository. This is a javabite class. But we need something for the visualization. Therefore the attributes need to be in the ASTNode interface.

selphiron commented 11 years ago

DeclarationNodeJB is the implementation of DeclarationNode (Interface). You just need the Interface of DeclarationNode

EdwarDDay commented 11 years ago

No, I mean attributes of the SDD, like 'canBreak' if an ASTNode is in a loop or 'type' from the childrenNodes of an assignment.

EdwarDDay commented 11 years ago

The changes in the ASTNode will be added tomorrow (21.06.).

Tkrauss commented 11 years ago

In my opinion, this is not quite necessary. We AST has been developed with a ( volitional) limited scope and is almost perfect for this purpose. If you need it unconditional for the next MS3, i'm okay with changing it. But imho, if MS2 was possible with this design, why should we change the approach now? I don't see the big difference in MS3.

EdwarDDay commented 11 years ago

We have the advantage of attributes in the ASTNodes, which can be displayed in the AST-Visualisation. This could be very helpful to the students.

Tkrauss commented 11 years ago

Ah okay, i didn't get you right... You mean it's a pure non-functional behavior? Thus the parsing, semantic analysis etc. will not depend on anything that is defined as an attribute? Well, in that case, i agree. ... just a little remark ... maybe it's more handy to use a object as attribute value?

EdwarDDay commented 11 years ago

Yeah, we can use Object. I only wanted a new Interface, because I don't like the toString() method as user output. But we have only three weeks, so Objects are fine.