Permalink
Browse files

Implement **

  • Loading branch information...
1 parent 982a9bd commit a54c889e20c27321cfb4b05ff68c5d23c3d705a8 Tony Arcieri committed Oct 28, 2009
Showing with 7 additions and 0 deletions.
  1. +1 −0 src/compiler/reia_bytecode.erl
  2. +6 −0 src/compiler/reia_r2e.erl
@@ -22,6 +22,7 @@ load(Bin) ->
% Compiled evaluation of a parsed Reia file
compile(Filename, Expressions) ->
+ io:format("Output Code: ~p~n", [Expressions]),
{ok, _Module, Bin} = compile_expressions(Filename, Expressions),
Module = #reia_module{filename=Filename, base_module=Bin},
{ok, term_to_binary(Module)}.
@@ -17,5 +17,11 @@ transform(Exprs = #float{}) -> Exprs;
transform(#unary_op{line=Line, type=Type, val=Val}) ->
{op, Line, Type, transform(Val)};
+transform(#binary_op{line=Line, type='**', val1=Val1, val2=Val2}) ->
+ {call, Line,
+ {remote, Line, {atom, Line, math}, {atom, Line, pow}},
+ [transform(Val1), transform(Val2)]
+ };
+
transform(#binary_op{line=Line, type=Type, val1=Val1, val2=Val2}) ->
{op, Line, Type, transform(Val1), transform(Val2)}.

0 comments on commit a54c889

Please sign in to comment.