Each class will be represented by a colored box. Each box will be made of 3 separated parts (see example on the right side):
+ will represent a public attribute or method, # will represent a protected attribute or method, - will represent a private attribute or method. Associations between classes will be symbolized by a straight line with possibly an association name on it. The cardinalities will be displayed at each side of the association. When an association is in fact an aggregation link, then a white diamond will be displayed, while a black diamond will be displayed in the case of a composition (very strong aggregation) link. Children classes will be connected to their parent classes (generalization) by straight arrows. |
|
root ::= ( class | association | comment )+
class ::= "$" class_name ( ":" class_parentclass )? "{" ( "+" public_attribute | "#" protected_attribute | "-" private_attribute )* ( "+" public_method | "#" protected_method | "-" private_method )* "}" class_name ::= string class_parentclass ::= string public_attribute ::= attribute protected_attribute ::= attribute private_attribute ::= attribute attribute ::= attribute_name ( ":" attribute_type )? attribute_name ::= string attribute_type ::= possible_types public_method ::= method protected_method ::= method private_method ::= method method ::= "@" method_name "(" ( method_parameters )? ")" ( ":" method_return_type )? method_name ::= string method_parameters ::= method_parameter ( "," method_parameter )* method_parameter ::= parameter_name ( ":" method_parameter_type )? parameter_name ::= string method_parameter_type ::= possible_types method_return_type ::= possible_types
association ::= "& {" class_name1 ( "(" | ")" )? "-" class_name2 ( "#" cardinality ){0, 2} ( "~" association_name )? "}" class_name1 ::= string class_name2 ::= string association_name ::= string
comment ::= "/*" string "*/"
string ::= [ a-zA-Z0-9_ ]+ possible_types ::= ( "int" | "string" | ... )+ cardinality ::= ( "0..1" | "0..*" | "1" | "1..*" )+
$ myClass:myAncestor { + myPublicAttribute1 + myPublicAttribute2: int -@ myPrivateMethod1 (myParam1: string, myParam2): string } & { myClassCompany - myClassPerson #0..* #1 ~ employs }
Parser | ||||||||||||||||||||||||||
|
aClass | ||||||||||||||||||||||||||||||||||||||
- className: string - parentClassName: string - setOfPublicAttributes: array - setOfProtectedAttributes: array - setOfPrivateAttributes: array - setOfPublicMethods: array - setOfProtectedMethods: array - setOfPrivateMethods: array |
||||||||||||||||||||||||||||||||||||||
|
anAssociation | ||
- className1: string - className2: string - cardinality12: string - cardinality21: string - associationType: string - associationName: string |
||
|
aUMLDiagram | ||||||||||
- setOfClasses: array of aClass - setOfAssociations: array of anAssociation |
||||||||||
|
validator | ||||||||||
|
aGraphViz | ||||||||
- nodes: array - edges: array |
||||||||
|
|
$ myClass { + myAttr: string } $ myClass1: myClass { # myAttr1: int - myAttr2 } $ myClass2: myClass { +@ myMethod1(myParam1: string, myParam2) -@ myMethod2(): string } $ myClass3 { + myAttr: string #@ myMethod3() } $ myClass4 { - myAttr4 -@ myMethod4() } $ myClass5 { - myAttr5: array } & { myClass3 (- myClass2 #0..* #0..1 ~isMadeOf } & { myClass3 - myClass3 #0..* #0..1 ~uses } & { myClass2 )- myClass4 #0..* #0..1 ~has } |