Last active
December 16, 2015 05:08
-
-
Save jerluc/5381698 to your computer and use it in GitHub Desktop.
Rift Source + PEG-generated AST XML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hello { | |
// Create our simple function | |
sum(a, b) => a + b | |
// Create a function to defer the computation | |
deferredSum(a, b) => => sum(a, b) | |
// Bind the evaluation of the computation in "myThread" to variable "a" | |
a := deferredSum(10, 20) @ myThread | |
// Print out the value once it's available | |
print(a) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" ?> | |
<Source> | |
<Rift> | |
<Identifier>hello</Identifier> | |
<Block> | |
<Expression> | |
<FunctionDef> | |
<Identifier>sum</Identifier> | |
<Tuple> | |
<Identifier>a</Identifier> | |
<Identifier>b</Identifier> | |
</Tuple> | |
<ReturnValue> | |
<Expression> | |
<Operation> | |
<Identifier>a</Identifier> | |
<Operator>+</Operator> | |
<Identifier>b</Identifier> | |
</Operation> | |
</Expression> | |
</ReturnValue> | |
</FunctionDef> | |
</Expression> | |
<Expression> | |
<FunctionDef> | |
<Identifier>deferredSum</Identifier> | |
<Tuple> | |
<Identifier>a</Identifier> | |
<Identifier>b</Identifier> | |
</Tuple> | |
<ReturnValue> | |
<ReturnValue> | |
<Expression> | |
<FunctionCall> | |
<Identifier>sum</Identifier> | |
<Tuple> | |
<Expression> | |
<Identifier>a</Identifier> | |
</Expression> | |
<Expression> | |
<Identifier>b</Identifier> | |
</Expression> | |
</Tuple> | |
</FunctionCall> | |
</Expression> | |
</ReturnValue> | |
</ReturnValue> | |
</FunctionDef> | |
</Expression> | |
<Expression> | |
<Operation> | |
<Identifier>a</Identifier> | |
<Operator>:=</Operator> | |
<Aside> | |
<FunctionCall> | |
<Identifier>deferredSum</Identifier> | |
<Tuple> | |
<NumericLiteral>10</NumericLiteral> | |
<NumericLiteral>20</NumericLiteral> | |
</Tuple> | |
</FunctionCall> | |
<Expression> | |
<Identifier>myThread</Identifier> | |
</Expression> | |
</Aside> | |
</Operation> | |
</Expression> | |
<Expression> | |
<FunctionCall> | |
<Identifier>print</Identifier> | |
<Tuple> | |
<Expression> | |
<Identifier>a</Identifier> | |
</Expression> | |
</Tuple> | |
</FunctionCall> | |
</Expression> | |
</Block> | |
</Rift> | |
</Source> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment