Newbie questions about Pliant

Newbie questions about Pliant

My opinion about Pliant, at first glance

My opinion about Pliant, also some initial problems
Message posted by maybe Gabor Naray on 2001/01/21 04:53:15
I found Pliant on the internet, with luck, and it's cool. I have been planning
to design and implement such compiler, and now i see there is one and almost
knows what it should, that's Pliant. In the future i will spend more time with
it, so you will probably hear from me.
Amongst the excellent features, i found two big problems though. First, the
tutorial (is it The Documentation?) is not too detailed. It's a good test
if the reader is programmer, because as an end-user i couldn't understand
much of it, luckily i am programmer. Besides the documentation is not too
detailed, it's not enough precise. For example i tried to create a for loop
with Float typed variable, and didn't understand why it failed to compile.
Finally i found the corresponding code (in startup.c, see second comment),
and i saw it can be only Int (or such). It happened because it wasn't explained
what type the variable can be.
Second, i peeked into startup.c, which seems to contain compilation method
of basic statements (like for). I saw that when the parsing (i would call
compiling) of a statement fails, it returns without any error message.
Now, i agree with someone who wrote that compiler error messages are kinda
worthless, but here is its reason. For example, if compiling for statement
fails because variable is not Int type, it could return a message that Variable
must be Int type. In general, at every place where compiling fails it should
return (optionally of course) a message that explains the reason of error.

Ok, i could split this into more notes, sorry, next time when i get more
familiar with pliant, i will do it.
Message posted by hubert.tonneau on 2001/01/21 12:11:54

First, the tutorial (is it The Documentation?) is not too detailed.

I'm very awared about this, and I must admit we started several tutorials during the past year, with none of them getting behond a few pages.
As a result, I'm now trying to start the idea of a Pliant journal where we could publish articles regularly, and this would become the material for a tutorial when enough has been written, and only merging is still required.

In general, at every place where compiling fails it should return (optionally of course) a message that explains the reason of error.

It does (there is room in the expression to store the error message before returning), but the problem is the other way round: which is the good error message.
Imagine that 'for' is defined for 'Int'. Then, you add code for defining it for 'Float'. Now, somebody tries to use it for 'Complex'.
So, the 'Int' definition could record an error message 'I am expecting an Int', and the other definition could record an error message 'I am expecting a Float'. Which should be displayed ?
The real problem is that in order to be meaningfull, the error message generator should be awared about all definitions. And it does not fit with Pliant extraordinary extendability because in Pliant a new definition may come at any point, about any existing keyword or data type, and even a new definition may be substituted to an older one, in all, or only some special cases. Just try to sort this out ... I could not.

Message posted by pom on 2001/01/21 14:07:37
In case a compilation fully fails, as the process will stop, we can be a bit dirty
and maybe optionaly retry the compilation and display all the tries for the
faulty expression and all the reasons why they aborted ?
Message posted by maybe Gabor Naray on 2001/01/23 01:00:14
About the documentation (which is The Pliant Language Specification). I meant
there is the description of for statement, for example, but it doesn't contain
what type it can be. Since it's the documentation of PDEE, and the type must be
Int in PDEE, this fact should be written there. That's whay i meant the
documentation was not enough detailed, in other word not enough precise.

About compiler error messages. I see your point, however Pom's suggestion is a
good idea. Let's examine the example of compiling for statement again. Let's
assume that there are 3 types that are allowed as loopvariable type, each one
in different compilation method (the one with Int type in PDEE). Also let's
assume that, the 3 types are Int, Float, and Mytype. Now, if i try to set its
type to String, every compilation method should return an errormessage, saying
that type should be Int/Float/Mytype (and/or using negative logic: type can't
be String). These messages should be displayed, probably with the modulename
that produced the message, so we would know which method in which module didn't
compile the for statement. Now fixing the type, i change it to Float. In this
case two compilation methods will produce error messages , but there is a big
difference, because one is accepted the for statement. So the compiler accepts
the compilation, and drops the error messages, and keeps the OK status.
Following this logic, if more compilation methods accepted the statement, a
warning message can be displayed because the situation is ambiguous.
Message posted by pom on 2001/01/23 01:19:06
It is actually a bit more difficult: when a meta is tried, it may decide it is not the good one to call. In such a case, there is no error and the meta silently returns. When a meta sets an error, it means that the meta asserts it is the good one and that there is some error in the data it was given to it.

In order to get more "precise" errors, there should be some way of asking the metas why they do not feel concerned. The trouble is that it would be a drastic loss of performance to ask it everytime as tries and backtracks are quite frequent and normal.

If we find a solution, the error messages would probably, for the "for", looks like:

cannot compile for (? ? ?) module ...
tried meta for (module ...): argument 1 doesn't cast to Int
tried meta for (module ...): argument 1 doesn't cast to Float
tried function for (module ...): bad number of arguments
Message posted by maybe Gabor Naray on 2001/01/23 04:20:53
Getting closer and closer to the final solution. Since i am newbie to Pliant,
i can suggest ideas only in general, but now i see the compiling process better
and better as you describe it. What i see in pliant/language/basic/control.c is
the for_meta function returns silently if something doesn't fit the for
statement. What i meant was adding "possible" error messages, in case when meta
decides it is not the good one to call (telling the compiler why it's not the
good one). This message must be distinguishable from the real error message (
when the meta asserts it is the good one, with errors in the statement). Here
more policy can be accepted, for example finding the first meta what returns
either real error or compiled status (that is when statement is handled),
another policy could be trying to compile the statement with corresponding
metas, then deciding how it went (this takes more time of course). In either
case, if none of the metas handled the compilation of statement, the "possible"
error messages could be displayed as Pom wrote. (I don't know how the
compilation is implemented in ambiguous cases, but it happens when more metas
handled the statement. This fits only the second policy, and also requires
another modification, so the metas could decide, which one should compile the
statement finally.)
It's probably time consumptive task to add "possible" error messages, since
at the moment there is none, and there are many many case as i saw. However
this would be a feature which isn't in Pliant yet, and new features usually
need time to be implemented.
Message posted by maybe Hubert Tonneau on 2001/01/23 07:26:38
Two points:
  • There is already an 'error_message' field in each 'Expression' that is dedicated to receive the error message when the function fails to compile. Also, I currently use it one to store obvious errors (when the meta knows that it has been misused) which is rare.
    I understand that having a small set of functions to check the number of arguments and arguments type that would fill the error message could help if we build the huge all cases error message at the end.
  • There is already a very sophisticated machanism for deciding what to do when several definitions apply. Roughly speeking, if one is obviously better (it casts less or no more on all arguments), it will selected, else the expression will be declared ambigious. Moreover, it his possible to declare some definitions as strong or weak to prevent such things.
Message posted by nspies on 2001/02/08 23:48:28
I just got Pliant a few days ago and think it's fascinating. I may work on
re-writing the documentation, as it is maddeningly mangled - BUT, your English
is FAR better than my [insert your language here]!

The instructions for starting HTTP server are not quite right, until I figured
out you have to leave off 'configure' at the end of the commands given (at least
on Linux).

I got the impression that you could use the web browser interface to interact
with the language(?) Even if this is false, I haven't discovered how to
start an interactive Piant shell in an xterm. [It runs with a message,
and immediately exits.] At least some of this information should be in a 
plain text README, so as to enable people to gain the first toehold, as it were.

Once I am able to try some examples interactively, I'll work on the 
documentation, if only to learn more quickly...
Message posted by maybe Hubert Tonneau on 2001/02/09 01:26:48

I got the impression that you could use the web browser interface to interact with the language(?)

Yes, that is the recommended way to first play with Pliant. Just select the 'The Pliant interpreter' link in the home page when you are logged with administrator password.

There used to be a text mode interface for the interpreter, but it was not as convienient as the web interface is when you want to try a more than one line program.

A better step by step explaination of how to go from 'the Pliant archive file is downloaded on your hard disk' to 'the HTTP server is running and properly configured for basic operations' would probably be a major improvement.

Message posted by nspies on 2001/02/09 23:29:19
OK, I got Pliant to talk to me with an xterm, and have been able to type in
some examples.

Even though I have started Pliant's server as root, AND start Netscape as
root, the page link you mention does not show up on the main menu.

I looked at the source, and commented out the test for 'administrator', and
tried to reload, but could not get Netscape to show the changed page...

What would I have to type into Netscape's 'Location' combo box after:


to bring up the interpreter page?

In other respects, the installation seems to be proper - and I haven't moved
around files...

Message posted by maybe Hubert Tonneau on 2001/02/10 01:14:18
First, start Pliant HTTP server using the following command (you don't need
to be 'root'):
  pliant module /pliant/protocol/http/server.pli command 'http_server port 8080 configure'
you will be asked to provide an administrator user and password in the terminal,
then, connect to it though your favorite browser at URL
and you will be asked to enter the user and password again,
and finally select
  The Pliant interpreter
  Some Pliant services
section of the home page.
Message posted by nspies on 2001/02/10 17:21:31
Here is the result of trying your commands:

ns11@beta:~ > pliant module /pliant/protocol/http/server.pli command 'http_server port 8080 configure'
Failed to compile http_server   ('port'  ?  'configure')
  compile <command line> 1 1
  compile <command line> 1 1
  compile <command line> 1 1
  parse <command line> 2 1
  module <command line>
processor stack content is:
error_report +44
error_renotify (ErrorID Address Str) +41
. compile (Expression) +121
  <command line> 1 1
. execute (Expression) +21
  <command line> 1 1
. execute (ParserContext) +40
parser_filter_execute +232
pliant internal parse_one_token function (ParserContext) +358
compile_text (List Module) +230
pliant internal startup function +2478


pliant module /pliant/protocol/http/server.pli command 'http_server port 8080'

results in:

HTTP server is running on TCP port 8080.

...which I can connect to without problem with Netscape.

Also, unrelated to the previous, I tried MS Internet Explorer (to see if it
would avoid the blank screens with messages that appear on this site every time
you push a button). IE doesn't seem to know how to interpret the site at all,
and just produces an error message. (IE 5.5)
Message posted by maybe Hubert Tonneau on 2001/02/10 18:49:55
I bet the problem is that you are running an old version of Pliant.

Just try:
  pliant module /pliant/language/context.pli command 'console pliant_root_path eol'

The first should report you that you are running release 56,
and the second you tel you where Pliant tree is on your disk.
Message posted by naasking on 2001/02/10 19:30:01
Are you installing in the /pliant directory? I discovered that installing in that default directory was the simplest way to get pliant up and running. Did you create a symlink in your PATH that linked to /pliant/binary/pliant-debugx.exe or did you actually include the /pliant/binary directory in your PATH? I don't think symlinks will work(at least they didn't for me) because of pliant's custom filesystem layout. If you're installing in a different directory then you have to run:

$ (insert install directory)/pliant/pliant/install/install

script to rebuild all of the binaries and to create the appropriate data directories/files. After I did all this, everything ran as I expected it should.

Here was my procedure for installing and running pliant from my home directory:

smagi@Whacker:~$ tar zxvpf pliant-56.tgz
smagi@Whacker:~$ ./pliant/pliant/install
Pliant path is /home/smagi/pliant/
precompiling Pliant (debugging level 0)
this computer name is Whacker in domain (none)
security path is file:/home/smagi/pliant_security/
data path is file:/home/smagi/pliant_data/
memory used: 2679 Kb consumed: 3332 Kb maximum: 3332 Kb
precompiling Pliant (debugging level 1)
memory used: 4055 Kb consumed: 4740 Kb maximum: 4740 Kb
precompiling Pliant (debugging level 2)
memory used: 5261 Kb consumed: 6020 Kb maximum: 6020 Kb
physical memory available is: 126656 Kb

Free peoples is even more important than free softwares.
I'd really like to make the world just a little bit better for my children,
I mean more friendly, and I believe that helping the Tibet get free is
an obvious way to start with.
You can get more informations at
smagi@Whacker:~$ export PATH=$PATH:/home/smagi/pliant/binary
smagi@Whacker:~$ pliant-debug0.exe module /pliant/protocol/http/server.pli command 'http_server port 8080 configure'
Please enter administrator user id: *
And now the administrator password: *
HTTP server is running on TCP port 8080.

Replace the *'s with whatever you wish. I just performed the procedure right now so I know it works. I'm running Debian but I think it should work on any UNIX system.

Hope that helps!
Message posted by nspies on 2001/02/11 03:33:03
Before I read your kind responses, I re-installed Pliant (on Linux) in / instead
of /usr/local/, and then it worked as advertized!

Now, I'd like to get it running on my cruddy Windows machine too, because I seem
to get a much faster web connection more often from my ISP with Windows than
with Linux. (It could be a setup problem, or perhaps <paranoia on> my ISP is
running a M$ web server that just won't treat Linux as well as Windoze <paranoia off>.

Anyway, it's nice to actually have access to the system...

I am re-writing pages, and will submit them from time to time.
Message posted by nspies on 2001/02/11 03:39:42
One other thing, you must have done something to fix your site, because now
Netscape is able to display generated pages (such as when logging on) without
user intervention.

However, Internet Explorer still refuses to display anything but an error

(Note: I am using V 56)
Message posted by maybe Hubert Tonneau on 2001/02/11 12:21:18
About your slow Internet connection under Linux, did you try the following:

echo 0 >/proc/sys/net/ipv4/tcp_timestamps