erlang的abstract_code代码

在看了霸爷的[url=http://blog.yufeng.info/archives/76]erlang的abstract code[/url]之后,自己动手实验了一下,效果如下:

[liufan@liufan abstract_code]$ erl -s hello -s erlang halt
Erlang R16B01 (erts-5.10.2) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

"hello world"
[liufan@liufan abstract_code]$ cat hello.erl
-module(hello).

-export([start/0]).

start() ->
io:format("~p~n", ["hello world"]).
[liufan@liufan abstract_code]$ erlc +debug_info hello.erl
[liufan@liufan abstract_code]$ erl
Erlang R16B01 (erts-5.10.2) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10.2 (abort with ^G)
1> rp(beam_lib:chunks(hello, [abstract_code])).
{ok,{hello,
[{abstract_code,
{raw_abstract_v1,
[{attribute,1,file,{"hello.erl",1}},
{attribute,1,module,hello},
{attribute,3,export,[{start,0}]},
{function,5,start,0,
[{clause,5,[],[],
[{call,6,
{remote,6,{atom,6,io},{atom,6,format}},
[{string,6,"~p~n"},
{cons,6,
{string,6,"hello world"},
{nil,6}}]}]}]},
{eof,7}]}}]}}
ok
2>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值