Tue Jan 16 10:10:44 CET 2001
On Mon, 15 Jan 2001, Vlad Dumitrescu wrote:
> I have been playing a lot with code, erl_parse, beam_lib and the
> likes, and things go pretty well. There is one thing that I can't do
> and I'd like to: obtain an abstract form for a function, compile it
> and run it. Obtaining isn't a problem now, but trying to compile it
> fails miserabily...
> Is it the right abstract form format that is returned from
> beam_lib:chunks(abstract_form) that can be fed into compile:forms?
The result from beam_lib:chunks(File, [abstract_code]) is indeed (at least
currently) on basically the same format as that returned from erl_parse.
(It has been expanded by the compiler, so you won't find records or
function imports in that code. Look in sys_pre_expand for details.)
It could be fed into compile:forms, but you'd have to modify it a bit
- add a module declaration form at the top of the list:
- remove the auto-generated code for "module_info" functions:
but keep in mind that the compiler only accepts complete modules as input,
even if you use compile:forms.
Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.)
E-mail: Richard.Carlsson@REDACTED WWW: http://www.csd.uu.se/~richardc/
More information about the erlang-questions