Assemblyscript: [Feature request] Add REPL

Created on 29 Jun 2019  ·  3Comments  ·  Source: AssemblyScript/assemblyscript

It will be nice to have REPL with history and minimal environment. I guess we could reuse some urils from node.js like "repl" module:

const Repl  = require('repl');

const repl = Repl.start({
  prompt: 'assemblyscript> ',
  useColors: true,
  ignoreUndefined: true
});

repl.on('line', line => {
   line = line.trim();
   // try compile assemblyscript for this line here
});
question stale

All 3 comments

Since we are talking about a static compiler here that cannot evaluate an additional line ad-hoc, it looks like the only way this can be done is to keep a complete history of the input (discarding invalid input) and recompile everything with a new line added, including any variable assignments, function calls etc. This might work somehow, but I wonder if it's a good match due to compile time delay.

I guess it possible. For example Rust has some unofficial crates for this. Like evcxr_repl and runner. Also see RFC proposal.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

emil14 picture emil14  ·  3Comments

jarble picture jarble  ·  3Comments

DanielMazurkiewicz picture DanielMazurkiewicz  ·  4Comments

blooddy picture blooddy  ·  3Comments

dcodeIO picture dcodeIO  ·  4Comments