Search in sources :

Example 16 with TypeDescriptor

use of cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor in project TrufflePascal by Aspect26.

the class IdentifiersTable method addBuiltinTypes.

protected void addBuiltinTypes() {
    typeDescriptors.put("integer", IntDescriptor.getInstance());
    typeDescriptors.put("shortint", IntDescriptor.getInstance());
    typeDescriptors.put("longint", LongDescriptor.getInstance());
    typeDescriptors.put("int64", LongDescriptor.getInstance());
    typeDescriptors.put("byte", IntDescriptor.getInstance());
    typeDescriptors.put("single", RealDescriptor.getInstance());
    typeDescriptors.put("real", RealDescriptor.getInstance());
    typeDescriptors.put("boolean", BooleanDescriptor.getInstance());
    typeDescriptors.put("char", CharDescriptor.getInstance());
    for (Map.Entry<String, TypeDescriptor> typeEntry : typeDescriptors.entrySet()) {
        identifiersMap.put(typeEntry.getKey(), new TypeTypeDescriptor(typeEntry.getValue()));
    }
}
Also used : TypeDescriptor(cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor) TypeTypeDescriptor(cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeTypeDescriptor) TypeTypeDescriptor(cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeTypeDescriptor) HashMap(java.util.HashMap) Map(java.util.Map)

Example 17 with TypeDescriptor

use of cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor in project TrufflePascal by Aspect26.

the class FatalError method VariableLineDeclaration.

void VariableLineDeclaration() {
    List<String> identifiers = IdentifiersList();
    Expect(25);
    TypeDescriptor typeDescriptor = Type();
    factory.registerVariables(identifiers, typeDescriptor);
}
Also used : TypeDescriptor(cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor)

Example 18 with TypeDescriptor

use of cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor in project TrufflePascal by Aspect26.

the class FatalError method RecordFieldList.

TypeDescriptor RecordFieldList() {
    TypeDescriptor typeDescriptor;
    if (la.kind == 1) {
        RecordFixedPart();
        if (recordVariantPartStarts()) {
            Expect(8);
            RecordVariantPart();
        }
    } else if (la.kind == 23) {
        RecordVariantPart();
    } else if (la.kind == 7 || la.kind == 8 || la.kind == 21) {
    } else
        SynErr(67);
    if (la.kind == 8) {
        Get();
    }
    typeDescriptor = factory.createRecordType();
    return typeDescriptor;
}
Also used : TypeDescriptor(cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor)

Example 19 with TypeDescriptor

use of cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor in project TrufflePascal by Aspect26.

the class FatalError method VariableLineDeclaration.

void VariableLineDeclaration() {
    List<String> identifiers = IdentifiersList();
    Expect(24);
    TypeDescriptor typeDescriptor = Type();
    factory.registerVariables(identifiers, typeDescriptor);
}
Also used : TypeDescriptor(cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor)

Example 20 with TypeDescriptor

use of cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor in project TrufflePascal by Aspect26.

the class FatalError method RecordType.

TypeDescriptor RecordType() {
    TypeDescriptor typeDescriptor;
    Expect(20);
    factory.startRecord();
    typeDescriptor = RecordFieldList();
    Expect(21);
    factory.finishRecord();
    return typeDescriptor;
}
Also used : TypeDescriptor(cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor)

Aggregations

TypeDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor)50 LexicalException (cz.cuni.mff.d3s.trupple.parser.exceptions.LexicalException)9 FrameSlot (com.oracle.truffle.api.frame.FrameSlot)7 TypeTypeDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeTypeDescriptor)6 OrdinalDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.complex.OrdinalDescriptor)5 ArrayList (java.util.ArrayList)4 ArrayDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.compound.ArrayDescriptor)3 EnumTypeDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.compound.EnumTypeDescriptor)3 RecordDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.compound.RecordDescriptor)3 ReturnTypeDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.subroutine.ReturnTypeDescriptor)3 PointerDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.complex.PointerDescriptor)2 ReferenceDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.complex.ReferenceDescriptor)2 ConstantDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.constant.ConstantDescriptor)2 SubroutineDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.subroutine.SubroutineDescriptor)2 List (java.util.List)2 StatementNode (cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)1 BinaryArgumentPrimitiveTypes (cz.cuni.mff.d3s.trupple.language.nodes.utils.BinaryArgumentPrimitiveTypes)1 PascalSubroutine (cz.cuni.mff.d3s.trupple.language.runtime.customvalues.PascalSubroutine)1 UnknownIdentifierException (cz.cuni.mff.d3s.trupple.parser.exceptions.UnknownIdentifierException)1 SetDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.compound.SetDescriptor)1