Will Coleda wrote:
Nifty.

FYI, in tcl, the two prompts can be overridden via a user defined procedure. See http://www.tcl.tk/man/tcl8.5/UserCmd/tclsh.htm#M11

Be nice if this was also possible with the default tool.
yup that should be possible as long as the language can access its own compiler object. Just call

   $P0.'set_prompt'(0, ">>>")
   $P0.'set_prompt'(1, "...")

(in case of Python/Pynie)
It should overwrite the prompt in that slot.

kjs

On Feb 25, 2007, at 11:24 AM, Klaas-Jan Stol wrote:

Patrick R. Michaud wrote:
On Sun, Feb 25, 2007 at 04:39:17PM +0100, Klaas-Jan Stol wrote:

most languages that can run in interactive mode have some kind of welcome message and prompt that is printed before the user can give any input.


Yes, this is helpful.  But also one of the things we need is a way
so that we can have "additional input" -- i.e., when entering
constructs that span multiple lines, for the language to be able
to signal HLLCompiler to obtain additional lines of input.

(a possible improvement would be to have an array of prompts; many languages have 2 prompts, when a "\" or whatever is given. In Python, if one gives "\" at the end of the line, the next prompt is "...". In lua it is ">>" instead of the normal prompt ">".)

The escape character to continue on the next line should also be handled by HLLCompiler?
something like

   $P0.'joinlinechar'('\')

sets the "\" character to be the signal to HLLCompiler to keep reading from the next line.
($P0 holds the compiler object).


I think we need to go ahead and have it possible to use an
array of prompts.

ok. I've added it, but it only uses prompts[0] right now... (the main prompt). It also needs an attribute that keeps track of what prompt needs to be used (an index).

kjs


As an example, I used this in Pynie.pir, which prints nicely:

C:\parrot\languages\pynie>..\..\parrot pynie.pbc
Python 2.5 for Parrot
Type "help", "copyright", "credits" or "license" for more information.


I'm generally in favor of not making false promises.  So,
don't offer options that aren't available.  :-)

Similarly, Pynie was modeled on Python 2.3, not 2.5... but if
someone has a copy of Python's 2.5 specification (or can point me
to it on the web), we can do 2.5.

Pm





--
Will "Coke" Coleda
[EMAIL PROTECTED]




Reply via email to