[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scm-discuss] building scm

From: Aubrey Jaffer
Subject: Re: [Scm-discuss] building scm
Date: Mon, 18 Oct 2010 20:40:22 -0400 (EDT)

 | Date: Mon, 18 Oct 2010 22:26:06 +0200
 | From: Philipp Klaus Krause <address@hidden>
 | Am 18.10.2010 05:36, schrieb Aubrey Jaffer:
 | >  | It creates identifier names that contain characters not required to
 | >  | be valid in C identifiers, such as 'รค' (and I do not know of any C
 | >  | compiler allowing these in identifiers).
 | > 
 | > Codepoints other than ASCII are not accepted in C identifiers; but
 | > they are in SCM.  Do the identifiers in your Scheme program include
 | > non-ASCII characters?
 | > 
 | Yes, I would have expected hobbit to mangle them.

Hobbit has some restrictions on identifiers:

  3. Variables are renamed to avoid name clashes, so that any local
     variable may have a whole procedure as its scope.  This renaming
     also converts let-s to let*-s.  Variables which do not introduce
     potential name clashes are not renamed.  For example,

          (define (foo x y)
             (let ((x y)
                   (z x))
               (let* ((x (+ z x)))

     is converted to

          (define foo
            (lambda (x y)
              (let* ((x__1 y)
                     (z x)
                     (x__2 (+ z x__1)))

In "hobbit.scm":

;;; NB! Your scheme file must not contain symbols which end with the
;;;     third elements of the following defines appended with an
;;;     integer.  The same holds for the case where "-" is written
;;;     instead of "_".  In case your scheme file contains any
;;;     offending symbols, replace them either in your file or replace
;;;     the offending strings in the following defines.
;;;     E.g. it is not allowed to have symbols like: my__12,
;;;     spec-tmp-var3, foo-inst1, foo_inst5, bar-aux2.
;;;     E.g. it is allowed to have symbols like: my__x, spec_tmp_var,
;;;     foo-inst1x, foo_inst_5, bar-aux-spec.

But non-Latin encodings were not considered.

We could modify "hobbit.scm" so that all C identifiers have numbered
names, eg. hv_932252.  This has the disadvantage of making the
generated C code much harder to read and debug.  A compromise would be
to use numbered names for only the non-ASCII identifiers.

What encoding does your Scheme source use?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]