Search in sources :

Example 11 with StatementNode

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

the class FatalError method ForLoop.

StatementNode ForLoop() {
    StatementNode statement;
    factory.startLoop();
    Expect(41);
    boolean ascending = true;
    Expect(1);
    Token variableToken = t;
    Expect(37);
    ExpressionNode startValue = Expression();
    if (la.kind == 42) {
        Get();
        ascending = true;
    } else if (la.kind == 43) {
        Get();
        ascending = false;
    } else
        SynErr(81);
    ExpressionNode finalValue = Expression();
    Expect(40);
    StatementNode loopBody = Statement();
    statement = factory.createForLoop(ascending, variableToken, startValue, finalValue, loopBody);
    factory.finishLoop();
    return statement;
}
Also used : StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Example 12 with StatementNode

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

the class FatalError method MainFunction.

void MainFunction() {
    factory.startMainFunction();
    StatementNode blockNode = Block();
    mainNode = factory.finishMainFunction(blockNode);
    Expect(34);
}
Also used : StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Example 13 with StatementNode

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

the class FatalError method Assignment.

StatementNode Assignment(Token identifierToken) {
    StatementNode assignment;
    AssignmentData assignmentData;
    assignment = null;
    if (isReturnVariable(identifierToken)) {
        Expect(37);
        ExpressionNode value = Expression();
        assignment = factory.createSimpleAssignment(identifierToken, value);
    } else if (StartOf(7)) {
        assignmentData = AssignmentRoute(identifierToken);
        Expect(37);
        ExpressionNode value = Expression();
        assignment = factory.finishAssignmentNode(assignmentData, value);
    } else
        SynErr(83);
    return assignment;
}
Also used : StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Example 14 with StatementNode

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

the class FatalError method CaseList.

CaseStatementData CaseList() {
    CaseStatementData data;
    data = new CaseStatementData();
    ExpressionNode caseConstant = Expression();
    data.indexNodes.add(caseConstant);
    Expect(25);
    StatementNode caseStatement = Statement();
    data.statementNodes.add(caseStatement);
    while (!caseEnds()) {
        Expect(8);
        caseConstant = Expression();
        data.indexNodes.add(caseConstant);
        Expect(25);
        caseStatement = Statement();
        data.statementNodes.add(caseStatement);
    }
    if (la.kind == 8) {
        Get();
    }
    if (la.kind == 38) {
        Get();
        data.elseNode = Statement();
    }
    if (la.kind == 8) {
        Get();
    }
    return data;
}
Also used : StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Example 15 with StatementNode

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

the class FatalError method GotoStatement.

StatementNode GotoStatement() {
    StatementNode statement;
    Expect(49);
    Expect(3);
    statement = factory.createGotoStatement(t);
    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