Search in sources :

Example 16 with StatementNode

use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.

the class UnitLexicalScope method createInitializationBlock.

@Override
BlockNode createInitializationBlock() {
    VirtualFrame unitFrame = PascalLanguage.INSTANCE.createUnitFrame(this.getName(), this.getFrameDescriptor());
    List<StatementNode> initializationNodes = this.generateInitializationNodes(unitFrame);
    initializationNodes.addAll(this.scopeInitializationNodes);
    return new BlockNode(initializationNodes.toArray(new StatementNode[initializationNodes.size()]));
}
Also used : VirtualFrame(com.oracle.truffle.api.frame.VirtualFrame) BlockNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.BlockNode) StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Example 17 with StatementNode

use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.

the class FatalError method IdentifierBeginningStatement.

StatementNode IdentifierBeginningStatement() {
    StatementNode statement;
    statement = null;
    Expect(1);
    Token identifierToken = t;
    if (StartOf(6)) {
        statement = factory.createSubroutineCall(identifierToken, new ArrayList<>());
    } else if (la.kind == 6) {
        statement = SubroutineCall(identifierToken);
    } else if (StartOf(7)) {
        statement = Assignment(identifierToken);
    } else
        SynErr(82);
    return statement;
}
Also used : ArrayList(java.util.ArrayList) StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Example 18 with StatementNode

use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.

the class FatalError method Block.

StatementNode Block() {
    StatementNode blockNode;
    Expect(35);
    List<StatementNode> bodyNodes = new ArrayList<>();
    if (StartOf(5)) {
        StatementSequence(bodyNodes);
    }
    Expect(22);
    blockNode = factory.createBlockNode(bodyNodes, this.extendedGotoSupport);
    return blockNode;
}
Also used : ArrayList(java.util.ArrayList) StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Example 19 with StatementNode

use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.

the class FatalError method IfStatement.

StatementNode IfStatement() {
    StatementNode statement;
    Expect(47);
    ExpressionNode condition = Expression();
    Expect(48);
    StatementNode thenStatement = Statement();
    StatementNode elseStatement = null;
    if (la.kind == 38) {
        Get();
        elseStatement = Statement();
    }
    statement = factory.createIfStatement(condition, thenStatement, elseStatement);
    return statement;
}
Also used : StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Example 20 with StatementNode

use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.

the class FatalError method WhileLoop.

StatementNode WhileLoop() {
    StatementNode statement;
    factory.startLoop();
    Expect(46);
    ExpressionNode condition = Expression();
    Expect(40);
    StatementNode loopBody = Statement();
    statement = factory.createWhileLoop(condition, loopBody);
    factory.finishLoop();
    return statement;
}
Also used : StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Aggregations

StatementNode (cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)30 ArrayList (java.util.ArrayList)6 FrameSlot (com.oracle.truffle.api.frame.FrameSlot)2 VirtualFrame (com.oracle.truffle.api.frame.VirtualFrame)1 BlockNode (cz.cuni.mff.d3s.trupple.language.nodes.statement.BlockNode)1 TypeDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor)1 EnumTypeDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.compound.EnumTypeDescriptor)1 ReturnTypeDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.subroutine.ReturnTypeDescriptor)1