[erlang-questions] This *SHOULD* be simple... compile a string to assembler.

Vlad Dumitrescu <>
Fri Jul 23 09:33:19 CEST 2010


On Fri, Jul 23, 2010 at 09:28, Vlad Dumitrescu <> wrote:
> On Fri, Jul 23, 2010 at 09:15, Michael Richter <> wrote:
>> 1> {ok, Tokens, _} = erl_scan:string("a () -> 42.").
>> 2> {ok, AbsForm} = erl_parse:parse_form(Tokens).
>> 4> {ok, Tokens2, _} =
>> erl_scan:string("-module(null).\n-compile(export_all).\na () -> 42.").
>> 5> {ok, AbsForm} = erl_parse:parse_form(Tokens2).
>
> On line 5 you are matching against the old AbsForm... Use AbsForm2
> instead, or "f(AbsForm)".

Ok, this doesn't address your main problem, of course... I answered
too fast, sorry.

It's not a big deal to write a parse_forms that folds a list of
tokens, parsing one form at a time. Of course that should be part of
erl_parse -- now that you solved the problem maybe you could send a
patch?

regards,
Vlad


More information about the erlang-questions mailing list