Search in sources :

Example 1 with SLExpressionNode

use of com.oracle.truffle.sl.nodes.SLExpressionNode in project graal by oracle.

the class FatalError method Arithmetic.

SLExpressionNode Arithmetic() {
    SLExpressionNode result;
    result = Term();
    while (la.kind == 26 || la.kind == 27) {
        if (la.kind == 26) {
            Get();
        } else {
            Get();
        }
        Token op = t;
        SLExpressionNode right = Term();
        result = factory.createBinary(op, result, right);
    }
    return result;
}
Also used : SLExpressionNode(com.oracle.truffle.sl.nodes.SLExpressionNode)

Example 2 with SLExpressionNode

use of com.oracle.truffle.sl.nodes.SLExpressionNode in project graal by oracle.

the class FatalError method ReturnStatement.

SLStatementNode ReturnStatement() {
    SLStatementNode result;
    Expect(17);
    Token returnToken = t;
    SLExpressionNode value = null;
    if (StartOf(2)) {
        value = Expression();
    }
    result = factory.createReturn(returnToken, value);
    Expect(11);
    return result;
}
Also used : SLExpressionNode(com.oracle.truffle.sl.nodes.SLExpressionNode) SLStatementNode(com.oracle.truffle.sl.nodes.SLStatementNode)

Example 3 with SLExpressionNode

use of com.oracle.truffle.sl.nodes.SLExpressionNode in project graal by oracle.

the class FatalError method LogicFactor.

SLExpressionNode LogicFactor() {
    SLExpressionNode result;
    result = Arithmetic();
    if (StartOf(3)) {
        switch(la.kind) {
            case 20:
                {
                    Get();
                    break;
                }
            case 21:
                {
                    Get();
                    break;
                }
            case 22:
                {
                    Get();
                    break;
                }
            case 23:
                {
                    Get();
                    break;
                }
            case 24:
                {
                    Get();
                    break;
                }
            case 25:
                {
                    Get();
                    break;
                }
        }
        Token op = t;
        SLExpressionNode right = Arithmetic();
        result = factory.createBinary(op, result, right);
    }
    return result;
}
Also used : SLExpressionNode(com.oracle.truffle.sl.nodes.SLExpressionNode)

Example 4 with SLExpressionNode

use of com.oracle.truffle.sl.nodes.SLExpressionNode in project graal by oracle.

the class FatalError method Factor.

SLExpressionNode Factor() {
    SLExpressionNode result;
    result = null;
    if (la.kind == 1) {
        Get();
        SLExpressionNode assignmentName = factory.createStringLiteral(t, false);
        if (StartOf(4)) {
            result = MemberExpression(null, null, assignmentName);
        } else if (StartOf(5)) {
            result = factory.createRead(assignmentName);
        } else
            SynErr(36);
    } else if (la.kind == 2) {
        Get();
        result = factory.createStringLiteral(t, true);
    } else if (la.kind == 3) {
        Get();
        result = factory.createNumericLiteral(t);
    } else if (la.kind == 5) {
        Get();
        int start = t.charPos;
        result = Expression();
        SLExpressionNode expr = result;
        Expect(7);
        int length = (t.charPos + t.val.length()) - start;
        result = factory.createParenExpression(expr, start, length);
    } else
        SynErr(37);
    return result;
}
Also used : SLExpressionNode(com.oracle.truffle.sl.nodes.SLExpressionNode)

Example 5 with SLExpressionNode

use of com.oracle.truffle.sl.nodes.SLExpressionNode in project graal by oracle.

the class FatalError method IfStatement.

SLStatementNode IfStatement(boolean inLoop) {
    SLStatementNode result;
    Expect(15);
    Token ifToken = t;
    Expect(5);
    SLExpressionNode condition = Expression();
    Expect(7);
    SLStatementNode thenPart = Block(inLoop);
    SLStatementNode elsePart = null;
    if (la.kind == 16) {
        Get();
        elsePart = Block(inLoop);
    }
    result = factory.createIf(ifToken, condition, thenPart, elsePart);
    return result;
}
Also used : SLExpressionNode(com.oracle.truffle.sl.nodes.SLExpressionNode) SLStatementNode(com.oracle.truffle.sl.nodes.SLStatementNode)

Aggregations

SLExpressionNode (com.oracle.truffle.sl.nodes.SLExpressionNode)19 SLStatementNode (com.oracle.truffle.sl.nodes.SLStatementNode)3 FrameSlot (com.oracle.truffle.api.frame.FrameSlot)2 SLStringLiteralNode (com.oracle.truffle.sl.nodes.expression.SLStringLiteralNode)2 SLReadArgumentNode (com.oracle.truffle.sl.nodes.local.SLReadArgumentNode)2 FrameDescriptor (com.oracle.truffle.api.frame.FrameDescriptor)1 SLBuiltinNode (com.oracle.truffle.sl.builtins.SLBuiltinNode)1 SLBinaryNode (com.oracle.truffle.sl.nodes.SLBinaryNode)1 SLRootNode (com.oracle.truffle.sl.nodes.SLRootNode)1 SLInvokeNode (com.oracle.truffle.sl.nodes.call.SLInvokeNode)1 SLBigIntegerLiteralNode (com.oracle.truffle.sl.nodes.expression.SLBigIntegerLiteralNode)1 SLFunctionLiteralNode (com.oracle.truffle.sl.nodes.expression.SLFunctionLiteralNode)1 SLLogicalAndNode (com.oracle.truffle.sl.nodes.expression.SLLogicalAndNode)1 SLLogicalOrNode (com.oracle.truffle.sl.nodes.expression.SLLogicalOrNode)1 SLLongLiteralNode (com.oracle.truffle.sl.nodes.expression.SLLongLiteralNode)1 BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1