[erlang-questions] The Core Erlang AST via cerl.erl and Sequence returns from functions
Eric Merritt
ericbmerritt@REDACTED
Wed Dec 21 17:36:57 CET 2011
Guys,
I am currently targeting the Erlang VM for a custom language via core
erlang as defined in cerl.erl on R15B. I have run into an interesting
issue. In a Let form (cerl:c_let) if I have a sequence of c_vars on
the Variable arguement and c_apply (on a function that returns a
c_values) in the Argument argument then the erlang compiler exits with
an 'error'. However, if I have a c_values directly as the Argument
argument the compiler will compile the form. Either I am understanding
something incorrectly or this is a bug in the cerl compiler. I am
hoping one of the folks that is knowledgeable on the subject can help
out. In short the following works:
cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)],
cerl:c_values([cerl:c_int(0), cerl:c_int(1)]), cerl:c_atom(foo))
while this does not:
<define a function that returns cerl:c_values([cerl:c_int(0),
cerl:c_int(1)])>
cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)],
cerl:c_apply(cerl:c_fname(my_fun, 0), []), cerl:c_atom(foo)).
This was typed from memory, but should be accurate. It is annoying
that all the compiler gives me is the atom 'error', not even a stack
trace. It makes things more or less impossible to decipher, it just
becomes a game of poke and prod.
In any case, thanks for your consideration,
Eric
More information about the erlang-questions
mailing list