At 16:39 25/02/2007 +0100, Klaas-Jan Stol wrote:
hi,
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.
For example, Python prints:
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)]
on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>>
and another well-known language being implemented for Parrot, Lua:
Lua 5.1.1 Copyright (C) 1994-2006 Lua.org, PUC-Rio
>
Attached is a patch that extends HLLCompiler with 2 attributes:
commandline_message, and commandline_prompt
commandline_banner could be a better name than commandline_message.
François.
The first can be set to set the message to be shown when the interactive
mode is entered. The second one is the prompt to be printed before the
user can give 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 ">".)
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.
>>>
(although the "help" etc. commands are not implemented).
I don't know if this feature is desired, but it was not too much work, and
it makes languages look more like the real thing.
regards,
klaas-jan