       1:entity ::=
       2:    #ignore(JAVA)
       3:    [entityDeclaration]*
       4:    #empty
       5:    => {
       6:        traceLine("\nPARSE COMPLETE AND VALID\n");
       7:    }
       8:;
       9:
      10:
      11:entityDeclaration ::=
      12:    IDENT: "entity"
      13:    IDENT: eName
      14:    => {
      15:        insert project.entities[eName].name = eName;
      16:    }
      17:    entityBody(project.entities[eName]);
      18:
      19:
      20:entityBody(entity : node) ::=
      21:    '('
      22:    [field(entity) | list(entity) | parent(entity)]*
      23:    ')'
      24:;
      25:
      26:
      27:field(entity : node) ::=
      28:    IDENT: "field" ':'
      29:    IDENT: fName
      30:        => local field;
      31:        => {
      32:            insert entity.fields[fName].name = fName;
      33:            ref field = entity.fields[fName];
      34:        }
      35:    [integer(field) | string(field)]+
      36:;
      37:
      38:integer(field : node) ::=
      39:    IDENT: "int"
      40:        => {
      41:            insert field.type.name = "int";
      42:        }
      43:;
      44:
      45:string(field : node) ::=
      46:    IDENT: "string"
      47:    NUM: length
      48:    => {
      49:        insert field.type.name = "String";
      50:        insert field.type.length = length;
      51:    }
      52:;
      53:
      54:
      55:list(entity : node) ::=
      56:    IDENT: "list" ':'
      57:    IDENT: role
      58:        => {
      59:            insert entity.lists[role].role = role;
      60:        }
      61:    IDENT: relatedTo
      62:        => {
      63:            insert entity.lists[role].relatedType = relatedTo;
      64:        }
      65:;
      66:
      67:
      68:parent(entity : node) ::=
      69:    IDENT: "parent" ':'
      70:    IDENT: role
      71:        => {
      72:            insert entity.parents[role].role = role;
      73:        }
      74:    IDENT: relatedTo
      75:        => {
      76:            insert entity.parents[role].relatedType = relatedTo;
      77:        }
      78:;
      79:
      80:
      81:IDENT ::= #!ignore ['a'..'z'|'A'..'Z'] ['a'..'z'|'A'..'Z'|'0'..'9']*;
      82:
      83:NUM ::= #!ignore ['0'..'9']+;