Tony,
I am at the point where some of the builtins parse correctly (boolean, tuple, range, numeric, object)
I have not yet checked whether they are generating the right parse tree, but it is good enough to fool the rest of the compiler into accepting the output anyway.
However, when I get to
module.re, despite completing the parse, I get the following error:
----------Parse finished : Result--------
[{module,8,'Module',
[{function,9,
{identifier,9,class},
[],
{var,1,'_'},
[{module_name,9,'Module'}]},
{function,11,call,
[{var,11,fake_self},{atom,11,to_s},{var,11,args},{var,11,block}],
{var,11,'_'},
[{match,12,
{tuple,12,[{atom,12,reia_module},{var,12,name}]},
{var,12,fake_self}},
{'case',13,
{native_call,13,code,ensure_loaded,[{var,13,name}]},
[{clause,14,
[{tuple,14,[{atom,14,module},{var,14,name}]}],
[{remote_call,15,{var,15,name},to_string,[],{nil,1}}]},
{clause,16,
[{var,16,'_'}],
[{throw,17,'NameError',
{dstring,17,
[{string,17,"undefined module "},{var,17,name}]}},
{atom,18,error}]}]}]},
{function,22,call,
[{var,22,fake_self},{atom,22,inspect},{var,22,args},{var,22,block}],
{var,22,'_'},
[{remote_call,23,{var,23,fake_self},to_s,[],{nil,1}}]},
{function,26,call,
[{var,26,fake_self},{var,26,method},{var,26,args},{var,26,block}],
{var,26,'_'},
[{match,27,
{tuple,27,[{atom,27,reia_module},{var,27,name}]},
{var,27,fake_self}},
{native_call,28,erlang,apply,
[{var,28,name},
{var,28,method},
{cons,28,
{var,28,args},
{cons,28,{var,28,block},{empty,28}}}]}]}]}]
----------- End of Parse Result ---------
.:none: internal error in lint_module;
crash reason: {function_clause,
[{erl_internal,bif,
[{identifier,
[{line,{'src/builtins/
module.re',9}}],
class},
2]},
{erl_lint,'-bif_clashes/2-lc$^0/1-0-',1},
{erl_lint,bif_clashes,2},
{erl_lint,forms,2},
{erl_lint,module,3},
{compile,lint_module,1},
{compile,'-internal_comp/4-anonymous-1-',2},
{compile,fold_comp,3}]}
{"init terminating in do_boot",{{badmatch,error},[{reia_bytecode,compile_submodule,3},{reia_bytecode,'-compile_submodules/3-lc$^0/1-0-',3},{reia_bytecode,compile_expressions,3},{reia_bytecode,compile,3},{reia_internal,compile,2},{init,start_it,1},{init,start_em,1}]}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
rake aborted!
Command failed with status (1): [bin/reiac -o ebin/module.reb src/builtins/...]
The complaint sems to be about the definition of the 'class' method on line 9, but submitting a much simplified version of this module to the reia parser ("module Module \n def class; Module; end \n end".parse()) gives the following parse tree:
[(:module,1,:Module,[(:function,2,:class,[],(:var,1,:_),[(:module_name,2,:Module)])])]
which looks to me like the first few lines of my parse tree.
Any thoughts?
As I mentioned, I have not compared the output from the parse of the whole module with the standard compiler (an automated way to do that may be a good next tool to build) so I guess that would be my next step, but wondered if you had any insights (read 'shortcuts') ((*really* read 'ways of saving me work')).
Cheers,
g