On 9 December 2017 at 07:04, cheshirecatalyst <dekathe...@gmail.com> wrote:

> I've recently picked up pharo, and am writing a small interpreter for a
> trivial language the details of which are unimportant. However I am looking
> for the simplest way to avoid having to use playground and Transcript to do
> something like
>
> | reader eval |
> reader := MyReader from: 'some stuff in my DSL'.
> eval := MyEvaluator from: reader.
> Transcript show: eval evaluate.
>
> I'm tired of having to change 'some stuff in my DSL' to a new expression
> and run it in playground.
>
> I don't really care which is easier, a Morphic with an input box at the
> bottom to put my expressions in with output up top, or a something like
> CommandShellTranscript (which i have looked at but is too complex for me to
> figure out how to get the desired result from).
>
> Basically I want to be able to use my DSL outside of playground, but still
> in image.
>


A while ago I had success embedding the old Workspace into an application.
Start with...

Workspace subclass: #MyWorkspace
instanceVariableNames: ''
classVariableNames: ''
package: 'Tool-Workspace'

MyWorkspace >> whenTextAccepted: anAnnouncement
"MyWorkspace open"
self inform: anAnnouncement text

MyWorkspace >> createTextView
| v |
v := super createTextView.
v beForPlainText.
^v.


cheers -ben

Reply via email to