Search code examples
lispcommon-lispsbcl

"illegal terminating character after a colon: #\" in portacle, though no colons in code


I've recently set up Portacle 1.3 for learning common lisp on Win 7. However, whenever I run my code I get the error, even if there is no code. Running individual lines works fine, however. The error only shows when I run the whole file.

I tried putting some code in an EVAL function, but I believe that only accepts one argument at a time, so I couldn't run a whole program in it.

I've found a similar error in this stackoverflow page, but their code contains colons and that's where their error lies.

I think it might be an error in the code that runs mine, seeing as I get the error even if I compile with no code, however I know nothing.

The full error:

main.lisp:1:1:
  read-error: 
    READ error during COMPILE-FILE:

      illegal terminating character after a colon: #\

        Line: 1, Column: 13, File-Position: 12

        Stream: #<SB-INT:FORM-TRACKING-STREAM for "file [path to file]\\main.lisp" {1005F5F0D3}>

Compilation failed.

Solution

  • Portacle is a standalone Emacs packaged with everything needed for Common Lisp development and which uses SBCL as the Common Lisp implementation.

    I believe what you do when you say 'compile the whole file' is call slime-compile-and-load-file which is bound to the key sequence C-c C-k by default. There are a lot of moving components here:

    • Emacs is the text editor here. It also takes care of launching all the necessary components for Common Lisp development.
    • Slime is one such component. It serves as interface between Emacs and your Common Lisp implementation (SBCL in this case, but supports any Lisp in theory). Basically it sends the code you wrote in Emacs to your Lisp for evaluation.
    • SBCL is the Common Lisp implementation. In this case it is a compiler. This is what evaluates the code it receives and spews out the answers to the user interface in Emacs, through Slime. It also 'lives', in the sense that you interact with it by modifying the state of the loaded Lisp image, keeping track of defined functions, global dynamic variables and much more. This is why you can have the REPL, and why you need Slime to interact with it.

    So to debug your problem, I would try to:

    • Launch SBCL from the Windows shell and run a simple .lisp file to check that everything works. You can put for example (format t "~a" (lisp-implementation-type)) in a .lisp file and run it in SBCL from the shell by calling (load "...\\file.lisp"). It should return "SBCL".
    • Create a completely new file using Emacs (and not weird Windows programs that could mess up the files) (C-x C-f), and try to call the compile from there (C-c C-k).

    And I believe you made the right choice of IDE. Portacle is arguably the simplest tool out there if you are a total beginner in Common Lisp and do not know Emacs configuration. The keybindings are a bit daunting though.