usethesource / rascal

The implementation of the Rascal meta-programming language (including interpreter, type checker, parser generator, compiler and JVM based run-time system)
http://www.rascal-mpl.org
Other
404 stars 78 forks source link

util::REPL::startREPL does not work, or fails without a message #1385

Open jurgenvinju opened 4 years ago

jurgenvinju commented 4 years ago

the demo of the Lisra repl here, as a consequence is also broken: demo::lang::Lisra::Console

On startREPL nothing happens. Sometime the current Rascal repl freezes and sometimes it returns without effect.

jurgenvinju commented 4 years ago

@maveme I'm reading TermRepl.java, which has code which uses fields not declared in util::REPL; do you know what the state of this code is? Is there code on a branch which needs to be merged?

jurgenvinju commented 4 years ago

I really forgot what we were doing here ;-)

jurgenvinju commented 4 years ago
module util::REPL

import Message;

alias Completion
 = tuple[int offset, list[str] suggestions];

data CommandResult(list[Message] messages = [])
  = commandResult(str result)
  ;  

data REPL
  = repl(str title, str welcome, str prompt, loc history, 
         CommandResult (str line) handler,
         Completion(str line, int cursor) completor)
  | repl( 
         CommandResult (str line) handler,
         Completion(str line, int cursor) completor)         
  ;

@javaClass{org.rascalmpl.library.util.TermREPL}
@reflect
java void startREPL(REPL repl);

This is the current state, but the code uses fields like visualisation too, and there is some salix integration as well.

maveme commented 4 years ago

Indeed. That code is being defined and used by Bacatá. Currently, I'm doing some changes together with @ltbinsbe. In the coming weeks, I'll clean this up, so the Bacatá-dependent code isn't part of the standalone REPL.

maveme commented 4 years ago
import salix::App;

extend util::REPL;

data CommandResult(list[Message] messages = [])
  = salix(SalixApp[&T] salixApp)
  ; 

data REPL(SalixMultiplexer visualization = noOp())
  =  repl( 
        CommandResult (str line) handler,
        Completion(str line, int cursor) completor
      )
  | replization(
        &T (str program, &T config) newHandler,
        &T initConfig,
        CommandResult (&T old, &T prev) printer
  )
  ;

alias SalixConsumer
  = VisOutput(SalixApp[value] app, str scope);

alias SalixMultiplexer
  = tuple[SalixConsumer consumer, void() stop, loc http];

alias VisOutput = str;

This is the current state of the REPL in Bacatá