Skip to content

Instantly share code, notes, and snippets.

@joseoliv joseoliv/Rpn.cyan
Created Jun 24, 2019

Embed
What would you like to do?
rpn
package metaobjectTest
@doc{*
Annotation 'rpn' takes an expression in Reverse Polish Notation (RPN)
in the attached DSL and evaluates it at compile-time. The annotation
is an expression of type Int. Only positive integer numbers are allowed
in the RPN expression.
This is a demonstration metaobject.
*}
object Rpn
func run {
let value = @rpn{* 1 2 3 * + *};
assert value = 7;
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.