Created
January 15, 2011 12:43
-
-
Save miura1729/780886 to your computer and use it in GitHub Desktop.
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
YTL::define_macro :foo do |x| | |
if x == 0 then | |
x | |
else | |
1 | |
end | |
end | |
このmacroの本体が次のようなRubyプログラムに変換されます、。 | |
{ | x | | |
state = 0 | |
while true | |
case state | |
when 0 | |
state = 1 | |
when 1 | |
if x .==(0) then | |
state = 3 | |
else | |
state = 2 | |
end | |
when 2 | |
state = 4 | |
value = 1 | |
when 4 | |
return value | |
when 3 | |
return x | |
state = 2 | |
end | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment