Created
October 28, 2010 15:00
-
-
Save vic/651509 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| def foo: x baz: y = 22 { | |
| x + y | |
| } |
This file contains hidden or 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
| vic@jwm:/vic/hk/fancy-lang$ rbx rbx/compiler.rb vic/def.fy -B | |
| #<Fancy::AST::ExpressionList:0x66 @line=1 @expressions=[#<Fancy::AST::ExpressionList:0x6a @line=4 @expressions=[#<Fancy::AST::MethodDef:0x6e @line=3 @name=:"foo:baz:" @arguments=#<Fancy::AST::MethodArgs:0x70 @optional=[] @required=[:x, :y] @line=3 @defaults=nil @names=[:x, :y] @splat=nil @block_arg=nil> @body=#<Fancy::AST::ExpressionList:0x78 @line=3 @expressions=[#<Fancy::AST::MessageSend:0x7c @message_name=#<Fancy::AST::Identifier:0x7e @identifier="+" @line=2> @message_args=#<Fancy::AST::MessageArgs:0x82 @args=[#<Fancy::AST::Identifier:0x86 @identifier="y" @line=2>] @line=2> @line=2 @receiver=#<Fancy::AST::Identifier:0x8c @identifier="x" @line=2>>]>>]>]> | |
| ============= :__script__ ============== | |
| Arguments: 0 required, 0 total | |
| Locals: 0 | |
| Stack size: 5 | |
| Lines to IP: 1: 0--1, 4: 0--1, 3: 0-15 | |
| 0000: push_rubinius | |
| 0001: push_literal :"foo:baz:" | |
| 0003: push_literal #<Rubinius::CompiledMethod foo:baz: file=vic/def.fy> | |
| 0005: push_scope | |
| 0006: push_variables | |
| 0007: send_stack :method_visibility, 0 | |
| 0010: send_stack :add_defn_method, 4 | |
| 0013: pop | |
| 0014: push_true | |
| 0015: ret | |
| ---------------------------------------- | |
| ============= :"foo:baz:" ============== | |
| Arguments: 2 required, 2 total | |
| Locals: 2: x, y | |
| Stack size: 4 | |
| Lines to IP: 3: 0--1, 2: 0-7 | |
| 0000: push_local 0 # x | |
| 0002: push_local 1 # y | |
| 0004: send_stack :":+", 1 | |
| 0007: ret | |
| ---------------------------------------- | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment