Skip to content

Instantly share code, notes, and snippets.

@Geal
Created May 24, 2011 09:04
Show Gist options
  • Save Geal/988387 to your computer and use it in GitHub Desktop.
Save Geal/988387 to your computer and use it in GitHub Desktop.
A simple command line REPL (run it with a headless image)
OSProcess thisOSProcess stdOut
nextPutAll: 'Welcome to the simple Smalltalk REPL';
nextPut: Character lf; nextPut: $>; flush.
[ |input|
[ input := OSProcess readFromStdIn.
input size > 0 ifTrue: [
OSProcess thisOSProcess stdOut
nextPutAll: ((Compiler evaluate: input) asString;
nextPut: Character lf; nextPut: $>; flush
]
] repeat.
]forkAt: (Processor userBackgroundPriority)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment