A fix for : syntax error here: ...

49 views
Skip to first unread message

Boring Coder

unread,
Oct 11, 2025, 8:33:23 AM (8 days ago) Oct 11
to Shen
First : sorry if I am polluting the group with my questions.

Right now, when there is a syntax error like a parenthesis missing, shen will report 
syntax error here:
...

it can be annoying when the file is long enough, and you don't know where the error is?
This happens because the global variable *residue* is not set anywhere, it is always empty.
one solution to the problem is to create a new compile function for bytes in reader.shen
I tested and it works, but of course maybe there is a better solution: 

(define read-file
  File -> (let Bytelist (read-file-as-bytelist File)
               S-exprs (compileBytes (/. X (<s-exprs> X)) Bytelist)
               Process (process-sexprs S-exprs)
               Process))

(define compileBytes
  F L -> (let Compile (F L)
              (cases (parse-failure? Compile) (error "parse failure~%")
                     (cons? (in-> Compile))   (print-residue (in-> Compile))
                     true (<-out Compile))))

dr.mt...@gmail.com

unread,
Oct 16, 2025, 5:28:49 AM (3 days ago) Oct 16
to Shen
Hi,

I've been away for a bit.   Yes, the syntax error report needs looking at.  It works of course, but the info
is not always helpful.

M.

dr.mt...@gmail.com

unread,
Oct 17, 2025, 5:48:52 PM (yesterday) Oct 17
to Shen
It would be good if you could supply a list of files where you feel the 
error messages are unhelpful so that I can assess what needs to be done.

M.

Reply all
Reply to author
Forward
0 new messages