<div dir="ltr">I'd like to write a REPL for my own language which is based on Erlang. More to the point, I'd like my REPL to be able to use edlin.erl, which seems pretty tricky.<br><br>As I understand it, I need to disable input support (i.e. erl -noinput), start user_drv myself, and create my own group leader with the group module. Is this correct?<br>
<br>I tried to put together a simple Read-Print-Loop, but had problems with that as well:<br><br>-module(myshell).<br>-export([init/0, start/0, loop/0]).<br><br>init() -><br> Result = group:start(user_drv:start(), {myshell, start, []}),<br>
io:format("group:start result: ~p~n", [Result]).<br><br>start() -><br> io:format("starting shell~n"),<br> spawn(fun loop/0).<br><br>loop() -><br> Result = io:get_line('> '),<br> io:format("get_line result: ~p~n", [Result]),<br>
loop().<br><br>After compiling this, I started it with:<br><br>erl -noinput -s myshell init -s init stop<br><br>This gave me:<br><br>Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0] [kernel-poll:false]<br>
<br>group:start result: <0.29.0><br>Eshell V5.6.3 (abort with ^G)<br>1><br><br>(I get the same thing starting it with -noshell)<br><br>What am I doing wrong?<br clear="all"><br>-- <br>Tony Arcieri<br><a href="http://medioh.com">medioh.com</a><br>
</div>