Created
June 24, 2019 07:26
-
-
Save joseoliv/f10dbcffc00b4443e97ba4e5e3cf2d64 to your computer and use it in GitHub Desktop.
rpn
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
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