Search in sources :

Example 21 with StatementNode

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

the class FatalError method StatementSequence.

void StatementSequence(List<StatementNode> body) {
    StatementNode statement = Statement();
    body.add(statement);
    while (la.kind == 8) {
        Get();
        statement = Statement();
        body.add(statement);
    }
}
Also used : StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Example 22 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(44);
    ExpressionNode condition = Expression();
    Expect(38);
    StatementNode loopBody = Statement();
    statement = factory.createWhileLoop(condition, loopBody);
    factory.finishLoop();
    return statement;
}
Also used : StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Example 23 with StatementNode

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

the class FatalError method WithStatement.

StatementNode WithStatement() {
    StatementNode statement;
    Expect(37);
    List<String> recordIdentifiers = IdentifiersList();
    LexicalScope initialScope = factory.getScope();
    List<FrameSlot> recordSlots = factory.stepIntoRecordsScope(recordIdentifiers);
    Expect(38);
    StatementNode innerStatement = Statement();
    factory.setScope(initialScope);
    statement = factory.createWithStatement(recordSlots, innerStatement);
    return statement;
}
Also used : FrameSlot(com.oracle.truffle.api.frame.FrameSlot) StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Example 24 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(4)) {
        statement = factory.createSubroutineCall(identifierToken, new ArrayList<>());
    } else if (la.kind == 6) {
        statement = SubroutineCall(identifierToken);
    } else if (StartOf(5)) {
        statement = Assignment(identifierToken);
    } else
        SynErr(75);
    return statement;
}
Also used : ArrayList(java.util.ArrayList) StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Example 25 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(45);
    ExpressionNode condition = Expression();
    Expect(46);
    StatementNode thenStatement = Statement();
    StatementNode elseStatement = null;
    if (la.kind == 36) {
        Get();
        elseStatement = Statement();
    }
    statement = factory.createIfStatement(condition, thenStatement, elseStatement);
    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