[erlang-questions] Writing my own REPL

Tony Arcieri <>
Fri Sep 26 06:01:51 CEST 2008

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.

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?

I tried to put together a simple Read-Print-Loop, but had problems with that
as well:

-export([init/0, start/0, loop/0]).

init() ->
  Result = group:start(user_drv:start(), {myshell, start, []}),
  io:format("group:start result: ~p~n", [Result]).

start() ->
  io:format("starting shell~n"),
  spawn(fun loop/0).

loop() ->
  Result = io:get_line('> '),
  io:format("get_line result: ~p~n", [Result]),

After compiling this, I started it with:

erl -noinput -s myshell init -s init stop

This gave me:

Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0]

group:start result: <0.29.0>
Eshell V5.6.3  (abort with ^G)

(I get the same thing starting it with -noshell)

What am I doing wrong?

Tony Arcieri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080925/ea6d559d/attachment.html>

More information about the erlang-questions mailing list