It seems JScript was a bit ahead of its time, in much the same sense that Lisp was. More accurately ECMAScript was, the standard on which Microsoft's implementation was based.
In 3 lines of code, here is a REPL that compiles and works. It is written in JScript.NET itself (jsc.exe):
import System;
while (true)
print(eval(Console.ReadLine()));
A more robust version can be written in roughly 50 lines of code:
import System;
import System.Text;
function read()
{
var program = new StringBuilder();
while (true)
{
Console.Write("{0}{0} ", program.Length == 0 ? ">" : ".");
var line = Console.ReadLine();
if (line != "")
{
if (program.Length == 0 && line.StartsWith("!q"))
break;
else
program.AppendLine(line);
}
else if (program.Length != 0)
{
break;
}
}
return program.ToString();
}
function evalprint(program)
{
try
{
var o = eval(program);
Console.WriteLine("=> {0}", o);
}
catch (e)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.Error.WriteLine(e.ToString());
Console.ResetColor();
}
}
while (true)
{
var program = read();
if (program == "") break;
evalprint(program);
}
It's just a matter of time before C# and the world at large embrace the power of eval().