Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package metaobjectTest
Annotation 'grammarMethod' takes an attached DSL that is a regular
expression with the regular operators (+, *, ?, |) and message
keywords like 'name:', 'at:', and 'with:'. This is huge metaobject.
Read more about in the text "The Cyan Language Metaobject Protocol".
object GrammarMethod
func run {
GrammarMethod name: "Kandinsky"
at: "Garden"
with: "Matisse"
name: "Frida"
with: "Picasso"
with: "Mondrian"
name: "Leonardo";
(name: String (at: String)? (with: String)* )+
func meet: Array<Tuple<String,
Union<some, String, none, Any>, Array<String>>> p {
for t in p {
Out print: "name is " ++ t f1;
type t f2
case String some {
Out print: " place is " ++ some
case Any none {
for name in t f3 {
Out print: " with " ++ name
"" println;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment