[ { "Label": "equal", "Input": "a = b == 5", "AST": { "Type": "Block", "Range": { "Start": 0, "End": 10 }, "Stmts": [ { "Type": "AssignmentStatement", "Range": { "Start": 0, "End": 10 }, "Vars": [ { "Type": "Identifier", "Range": { "Start": 0, "End": 1 }, "Literal": "a" } ], "Exps": [ { "Type": "InfixExpression", "Range": { "Start": 4, "End": 10 }, "Left": { "Type": "Identifier", "Range": { "Start": 4, "End": 5 }, "Literal": "b" }, "Operator": "equal", "Right": { "Type": "NumberLiteral", "Range": { "Start": 9, "End": 10 }, "Literal": "5", "Value": 5 } } ] } ] } }, { "Label": "addition", "Input": "a = b + 5", "AST": { "Type": "Block", "Range": { "Start": 0, "End": 9 }, "Stmts": [ { "Type": "AssignmentStatement", "Range": { "Start": 0, "End": 9 }, "Vars": [ { "Type": "Identifier", "Range": { "Start": 0, "End": 1 }, "Literal": "a" } ], "Exps": [ { "Type": "InfixExpression", "Range": { "Start": 4, "End": 9 }, "Left": { "Type": "Identifier", "Range": { "Start": 4, "End": 5 }, "Literal": "b" }, "Operator": "plus", "Right": { "Type": "NumberLiteral", "Range": { "Start": 8, "End": 9 }, "Literal": "5", "Value": 5 } } ] } ] } }, { "Label": "left_associative", "Input": "a = 2 + 2 + 2", "AST": { "Type": "Block", "Range": { "Start": 0, "End": 13 }, "Stmts": [ { "Type": "AssignmentStatement", "Range": { "Start": 0, "End": 13 }, "Vars": [ { "Type": "Identifier", "Range": { "Start": 0, "End": 1 }, "Literal": "a" } ], "Exps": [ { "Type": "InfixExpression", "Range": { "Start": 4, "End": 13 }, "Left": { "Type": "InfixExpression", "Range": { "Start": 4, "End": 9 }, "Left": { "Type": "NumberLiteral", "Range": { "Start": 4, "End": 5 }, "Literal": "2", "Value": 2 }, "Operator": "plus", "Right": { "Type": "NumberLiteral", "Range": { "Start": 8, "End": 9 }, "Literal": "2", "Value": 2 } }, "Operator": "plus", "Right": { "Type": "NumberLiteral", "Range": { "Start": 12, "End": 13 }, "Literal": "2", "Value": 2 } } ] } ] } }, { "Label": "right_associative", "Input": "a = 'foo'..'bar'..'baz'", "AST": { "Type": "Block", "Range": { "Start": 0, "End": 23 }, "Stmts": [ { "Type": "AssignmentStatement", "Range": { "Start": 0, "End": 23 }, "Vars": [ { "Type": "Identifier", "Range": { "Start": 0, "End": 1 }, "Literal": "a" } ], "Exps": [ { "Type": "InfixExpression", "Range": { "Start": 4, "End": 23 }, "Left": { "Type": "StringLiteral", "Range": { "Start": 4, "End": 9 }, "Literal": "'foo'" }, "Operator": "concat", "Right": { "Type": "InfixExpression", "Range": { "Start": 11, "End": 23 }, "Left": { "Type": "StringLiteral", "Range": { "Start": 11, "End": 16 }, "Literal": "'bar'" }, "Operator": "concat", "Right": { "Type": "StringLiteral", "Range": { "Start": 18, "End": 23 }, "Literal": "'baz'" } } } ] } ] } }, { "Label": "all_precedences", "Input": "a = 1 + 2 - 3 * -4 / 5 % 6 ^ 7 .. 8", "AST": { "Type": "Block", "Range": { "Start": 0, "End": 35 }, "Stmts": [ { "Type": "AssignmentStatement", "Range": { "Start": 0, "End": 35 }, "Vars": [ { "Type": "Identifier", "Range": { "Start": 0, "End": 1 }, "Literal": "a" } ], "Exps": [ { "Type": "InfixExpression", "Range": { "Start": 4, "End": 35 }, "Left": { "Type": "InfixExpression", "Range": { "Start": 4, "End": 30 }, "Left": { "Type": "InfixExpression", "Range": { "Start": 4, "End": 9 }, "Left": { "Type": "NumberLiteral", "Range": { "Start": 4, "End": 5 }, "Literal": "1", "Value": 1 }, "Operator": "plus", "Right": { "Type": "NumberLiteral", "Range": { "Start": 8, "End": 9 }, "Literal": "2", "Value": 2 } }, "Operator": "minus", "Right": { "Type": "InfixExpression", "Range": { "Start": 12, "End": 30 }, "Left": { "Type": "InfixExpression", "Range": { "Start": 12, "End": 22 }, "Left": { "Type": "InfixExpression", "Range": { "Start": 12, "End": 18 }, "Left": { "Type": "NumberLiteral", "Range": { "Start": 12, "End": 13 }, "Literal": "3", "Value": 3 }, "Operator": "mul", "Right": { "Type": "PrefixExpression", "Range": { "Start": 16, "End": 18 }, "Operator": "minus", "Right": { "Type": "NumberLiteral", "Range": { "Start": 17, "End": 18 }, "Literal": "4", "Value": 4 } } }, "Operator": "slash", "Right": { "Type": "NumberLiteral", "Range": { "Start": 21, "End": 22 }, "Literal": "5", "Value": 5 } }, "Operator": "mod", "Right": { "Type": "InfixExpression", "Range": { "Start": 25, "End": 30 }, "Left": { "Type": "NumberLiteral", "Range": { "Start": 25, "End": 26 }, "Literal": "6", "Value": 6 }, "Operator": "pow", "Right": { "Type": "NumberLiteral", "Range": { "Start": 29, "End": 30 }, "Literal": "7", "Value": 7 } } } }, "Operator": "concat", "Right": { "Type": "NumberLiteral", "Range": { "Start": 34, "End": 35 }, "Literal": "8", "Value": 8 } } ] } ] } } ]