Search in sources :

Example 11 with SLExpressionNode

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

the class FatalError method Expression.

SLExpressionNode Expression() {
    SLExpressionNode result;
    result = LogicTerm();
    while (la.kind == 18) {
        Get();
        Token op = t;
        SLExpressionNode right = LogicTerm();
        result = factory.createBinary(op, result, right);
    }
    return result;
}
Also used : SLExpressionNode(com.oracle.truffle.sl.nodes.SLExpressionNode)

Example 12 with SLExpressionNode

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

the class FatalError method Term.

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

Example 13 with SLExpressionNode

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

the class FatalError method MemberExpression.

SLExpressionNode MemberExpression(SLExpressionNode r, SLExpressionNode assignmentReceiver, SLExpressionNode assignmentName) {
    SLExpressionNode result;
    result = null;
    SLExpressionNode receiver = r;
    SLExpressionNode nestedAssignmentName = null;
    if (la.kind == 5) {
        Get();
        List<SLExpressionNode> parameters = new ArrayList<>();
        SLExpressionNode parameter;
        if (receiver == null) {
            receiver = factory.createRead(assignmentName);
        }
        if (StartOf(2)) {
            parameter = Expression();
            parameters.add(parameter);
            while (la.kind == 6) {
                Get();
                parameter = Expression();
                parameters.add(parameter);
            }
        }
        Expect(7);
        Token finalToken = t;
        result = factory.createCall(receiver, parameters, finalToken);
    } else if (la.kind == 30) {
        Get();
        SLExpressionNode value = Expression();
        if (assignmentName == null) {
            SemErr("invalid assignment target");
        } else if (assignmentReceiver == null) {
            result = factory.createAssignment(assignmentName, value);
        } else {
            result = factory.createWriteProperty(assignmentReceiver, assignmentName, value);
        }
    } else if (la.kind == 31) {
        Get();
        if (receiver == null) {
            receiver = factory.createRead(assignmentName);
        }
        Expect(1);
        nestedAssignmentName = factory.createStringLiteral(t, false);
        result = factory.createReadProperty(receiver, nestedAssignmentName);
    } else if (la.kind == 32) {
        Get();
        if (receiver == null) {
            receiver = factory.createRead(assignmentName);
        }
        nestedAssignmentName = Expression();
        result = factory.createReadProperty(receiver, nestedAssignmentName);
        Expect(33);
    } else
        SynErr(38);
    if (StartOf(4)) {
        result = MemberExpression(result, receiver, nestedAssignmentName);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) SLExpressionNode(com.oracle.truffle.sl.nodes.SLExpressionNode)

Example 14 with SLExpressionNode

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

the class FatalError method LogicTerm.

SLExpressionNode LogicTerm() {
    SLExpressionNode result;
    result = LogicFactor();
    while (la.kind == 19) {
        Get();
        Token op = t;
        SLExpressionNode right = LogicFactor();
        result = factory.createBinary(op, result, right);
    }
    return result;
}
Also used : SLExpressionNode(com.oracle.truffle.sl.nodes.SLExpressionNode)

Example 15 with SLExpressionNode

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

the class FatalError method WhileStatement.

SLStatementNode WhileStatement() {
    SLStatementNode result;
    Expect(14);
    Token whileToken = t;
    Expect(5);
    SLExpressionNode condition = Expression();
    Expect(7);
    SLStatementNode body = Block(true);
    result = factory.createWhile(whileToken, condition, body);
    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