[climacs-devel] Extra open-paren on parse stack in Common-lisp syntax

Christophe Rhodes csr21 at cam.ac.uk
Sun May 8 21:00:22 UTC 2005


Brian Mastenbrook <brian at mastenbrook.net> writes:

> I've been tracking down a problem visible in the Common-lisp
> syntax. To replicate this problem, put an empty buffer into the
> syntax, and type () - you should see the parens jump to the right one
> column. Actually, there's an extra open-paren being presented; I'm not
> sure why it doesn't show on screen, but it is taking up that leftmost
> column. The reason for this is that there's an extra open-paren on the
> parse stack at that point, as evidenced by the debug statement I put
> in display-parse-stack in cl-syntax.lisp:
>
> This parse stack's trees are (#<CLIMACS-CL-SYNTAX::PAREN-OPEN "(">
> #<CLIMACS-CL-SYNTAX::NONEMPTY-CL-TERMINALS {1004517E11}>).
>
> That nonempty-cl-terminals actually has the list-expr in it.
>
> So far I've been unable to figure out why this extra tree is on the
> parse stack. Does anybody have a good idea here?

Here is a guess: the list-expr in cl-syntax contains (as the list
items) CL-TERMINALS, which is also the target symbol of the grammar
itself.  I'm willing to believe that this confuses matters.

    (setf parser (make-instance 'parser
				:grammar *cl-grammar*
				:target 'cl-terminals))

and

(add-cl-rule (list-expr -> ((start paren-open)
  			    (items cl-terminals)
			    (end paren-close))
			:start start :items items :end end))

Robert, is this likely to be the cause of the problem?  If so, any
idea how to fix it?

Cheers,

Christophe



More information about the climacs-devel mailing list