[1274] in Coldmud discussion meeting

root meeting help first first in chain previous in chain previous next last

Re: [COLD] Parser instability

daemon@ATHENA.MIT.EDU (Mon Apr 7 13:00:38 1997 )

Date: Mon, 7 Apr 1997 10:55:42 -0600 (MDT)
From: Brandon Gillespie <brandon@cold.org>
To: Jeff Kesselman <jeffk@tenetwork.com>
cc: coldstuff@cold.org
In-Reply-To: <3.0.32.19970407000444.0072c698@mail.tenetwork.com>

On Mon, 7 Apr 1997, Jeff Kesselman wrote:
> I've foudn a number of places in my debuygging where code of teh form
> 
> if (expression)
>    statement;
> 
> Fails and
> 
> if (expression) {
>   statement;
> }

fails?  how does it fail?  I know there is a bug in line counting, but it
hasn't been a big deal.  The problem is there are two seperate
decompilers--one which builds text and one which pretends to buildtext,
but actually just counts when it would have a newline.  The second one is
where the 'bug' exists--if this is what you are referring to.

Specific instances that I know cause mis-counting are:

  if (blah)
      ;

(i.e. null stmt) and:

   case
     single-stmt;
   with
     single-stmt;

(i.e. where it doesn't bracket the case and handler)

> This however reinforces a beleif of mien that the entire parser aught to be
> re-written.  At the same time the issues of <cr> not being a proper white
> space character in the outer-syntax could also be addressed...

Umm.. I don't see why this implies the compiler should be rewritten :) 

However, I do agree, I want to rewrite it.  As for newlines--thats
actually an enforced rule in the compiler (that newlines are not
whitespace _when in strings_), not just a side effect.

> If someone wanted to write a BNF, and write the action routines, ild be
> willing to do a parser in PCCTS.  This has the additional advanatge of,
> since PCCTS is LL(k) as oppsoed to ACC being LALR, of meanign it woudl
> generate more intelligent syntax error messages.

yacc is just fine, imho--and its standard.  You can get yacc to do
intelligent error messages without problem (starting from that sort of
compiler in the beginning).  The current model doesn't do it, but thats
just because of the way it was written (at one point I had the compiler
torn to pieces in a partial rewrite to support better messages--but I
decided it would be better just to start from scratch). 

-Brandon Gillespie