[climacs-devel] prolog syntax

Christophe Rhodes csr21 at cam.ac.uk
Sun Mar 27 16:12:38 UTC 2005


Hi,

I've added the beginnings of a syntax for ISO Prolog.  The commit
message lists a number of problems I currently have, but I think I
should probably air them here.

The biggest, I think, is in dealing with comments, though in fact it's
not clear that the problem is restricted to that.  I believe that
there is an assumption in the display code that lexemes contain no
whitespace, and in particular contain no #\Newline characters.  This
is not really true in Prolog's case; the obvious case is the bracketed
/* */ comment, but quoted tokens likewise can contain whitespace.
(These cases are analogous, I think, to Common Lisp's #| |# comment
and |Symbol With Spaces| -- one might argue over whether the comment
is one lexeme or several -- or none -- but I think it's clear that
|Symbol With Spaces| is exactly one token).

The incremental lexer that I, erm, cut'n'pasted from html-syntax.lisp
doesn't cut it for Prolog, for related reasons: the damaged region
from deleting a quoting character is extensive.  I think I can fix
this -- it's similar to a problem I've already dealt with in my
Tabcode parser.

For a variety of reasons, I think, the incremental redisplay stuff
doesn't work.  I'm not convinced I understand why. :-/ I encourage
interested parties to have a play with Set Syntax SPC Prolog, and see
if they can characterize bugs, problems.

(There are a number of incompletenesses in the Prolog parser itself
that I'm aware of: floating point numbers, escaped quotes in quoted
tokens, underscores in tokens, [A,B] list syntax (embarrassingly), and
the like.  It is relatively capable, though: see
<http://www-jcsu.jesus.cam.ac.uk/~csr21/prolog-climacs.png>,
<http://www-jcsu.jesus.cam.ac.uk/~csr21/pretty-prolog.png> and
<http://www-jcsu.jesus.cam.ac.uk/~csr21/prolog-comments.png> for eye
candy...)

Cheers,

Christophe



More information about the climacs-devel mailing list