Skip to content

Instantly share code, notes, and snippets.

@WayneCui
Created December 24, 2013 16:29
Show Gist options
  • Save WayneCui/8115340 to your computer and use it in GitHub Desktop.
Save WayneCui/8115340 to your computer and use it in GitHub Desktop.
圣诞树
REBOL []
dialect: [ 3 space 1 asterisk 3 space lf
2 space 3 asterisk 2 space lf
1 space 2 asterisk 1 star 1 asterisk lf
1 star 1 asterisk 1 star 3 asterisk lf
2 space 3 asterisk 2 space lf
1 space 2 asterisk 1 star 1 asterisk 1 space lf
7 asterisk lf
3 space 1 bar 3 space lf
]
result: copy []
rule: [ some [ set i integer! 'space ( append/dup result space i ) |
set i integer! 'asterisk ( append/dup result "*" i ) |
set i integer! 'star ( append/dup result "☆" i ) |
set i integer! 'bar ( append/dup result "||" i) |
'lf ( append result lf ) | skip
]
]
parse dialect rule
print result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment