// ============================================================================================================= // Type-denoter ::= int | double | boolean TypeDenoter parseTypeDenoter() { TypeDenoter typeDenoter = new TypeDenoter(CurrentToken.getSpelling()); accept(Identifier); return(typeDenoter); }
public SingleDeclaration(Identifier i, TypeDenoter t) { Identifier = i; TypeDenoter = t; inferType(t.Spelling); duplicated = false; }
// Single-Declaration ::= var V-name : Type-denoter SingleDeclaration parseSingleDeclaration() { SingleDeclaration singleDeclaration = null; // parse the identifier (the variable name) Identifier I = parseIdentifier(); // then expect a : symbol accept(Colon); // parse the variable type Denoter TypeDenoter kind = parseTypeDenoter(); singleDeclaration = new SingleDeclaration(I, kind); singleDeclaration.Type = new Type(kind); return(singleDeclaration); }
public Type(TypeDenoter T) { kind = InferType(T.Spelling).kind; }