1. Euphoria Interpreter?
I am very interested in using interpreters such as Lisp or Basic. I wonder if
Euphoria has an interpreter "Shell"? Such that I can run a program, say eush and
start to type Euphoria commands and get the answer immediately. e.g.,
>> sequence s
>> s = { 1, 2, 3 }
>> print(1, s[2])
2
>>
Something like that. Thanks!
Bryan
2. Re: Euphoria Interpreter?
Bryan So wrote:
>
> I am very interested in using interpreters such as Lisp or Basic. I wonder
> if Euphoria has an interpreter "Shell"? Such that I can run a program, say
> eush and start to type Euphoria commands and get the answer immediately.
> e.g.,
>
> >> sequence s
> >> s = { 1, 2, 3 }
> >> print(1, s[2])
> 2
> >>
>
> Something like that. Thanks!
>
> Bryan
I think there might be a Euphoria in Euphoria interpreter in the archives, but
no, there is not immediate mode/shell mode with the standard Euphoria
interpreter.
One could probably be made with the public domain source code, though.
--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.
3. Re: Euphoria Interpreter?
I did find a "Interactive Euphoria Interpreter" by Roderick Jackson
in the archives, that sounds like what you are after.
HTH
4. Re: Euphoria Interpreter?
Hi Bryan,
There is no command shell distributed with euphoria and as far as I know no one
written one.
here a 5 cents fast done command interpreter.(At that price there is obviously
many limitations ;)
-- name: eush5c.exw
-- 5 cents euphoria command shell
-- usage: exwc.exe eush5c.exw.
sequence InputLine, buffer
constant TempFile="euShTemp.exw"
buffer = {"-- 'euphoria 5 cents command shell' generated file\n","without
warning\n"}
atom hFile
object void
while 1 do
puts(1,"\neush>")
InputLine = gets(0)
if InputLine[1] = '?' or (match("print(1,",InputLine)=1) or
(match("printf(1,",InputLine)) or
(match("puts(1,",InputLine)=1) then
puts(1,'\n')
hFile = open(TempFile,"w")
for i = 1 to length(buffer) do
puts(hFile,buffer[i])
end for
puts(hFile,InputLine)
close(hFile)
void = system_exec("exwc.exe "&TempFile,0)
elsif equal(InputLine, "!quit\n") then -- quit shell
abort(0)
elsif equal(InputLine,"!flush\n") then -- flush command buffer
buffer = buffer[1..2]
else
buffer = append(buffer,InputLine)
end if
end while
regards,
Jacques Deschênes
5. Re: Euphoria Interpreter?
Thanks all for digging up the reference and for thinking about this problem.
I'll look into it further!
Thanks again.
Bryan
jacques deschênes wrote:
>
>
> Hi Bryan,
>
> There is no command shell distributed with euphoria and as far as I know no
> one written one.
>
> here a 5 cents fast done command interpreter.(At that price there is obviously
> many limitations ;)
> }}}
<eucode>
> -- name: eush5c.exw
> -- 5 cents euphoria command shell
> -- usage: exwc.exe eush5c.exw.
>
> sequence InputLine, buffer
> constant TempFile="euShTemp.exw"
> buffer = {"-- 'euphoria 5 cents command shell' generated file\n","without
> warning\n"}
> atom hFile
> object void
>
> while 1 do
> puts(1,"\neush>")
> InputLine = gets(0)
> if InputLine[1] = '?' or (match("print(1,",InputLine)=1) or
> (match("printf(1,",InputLine))
> or
> (match("puts(1,",InputLine)=1) then
> puts(1,'\n')
> hFile = open(TempFile,"w")
> for i = 1 to length(buffer) do
> puts(hFile,buffer[i])
> end for
> puts(hFile,InputLine)
> close(hFile)
> void = system_exec("exwc.exe "&TempFile,0)
> elsif equal(InputLine, "!quit\n") then -- quit shell
> abort(0)
> elsif equal(InputLine,"!flush\n") then -- flush command buffer
> buffer = buffer[1..2]
> else
> buffer = append(buffer,InputLine)
> end if
> end while
>
> </eucode>
{{{
>
> regards,
> Jacques Deschênes