[plt-scheme] Getting line-no for s-exps read by (read)

From: Sridhar Ratna (sridhar.ratna at gmail.com)
Date: Wed May 23 23:36:41 EDT 2007

Hi,

The ``(read)" function reads a s-exp from standard input or file. As
part of my project, I am translating the s-exp to Python byte-codes.

Despite my futile attempts, I cannot yet figure out a way to get the
line-no for each of the s-exp.

For example,

(for x in (range 10)
    (print (* x x)))

Here, the forms `(for ...)', `(range ...)', `x', ... belong to line-no
1, while `(print ...)', .. to line-no 2.

I would be much grateful if anyone could point me to a way to get the
line-no for each of the forms read by (read).

-- 
http://srid.nfshost.com/


Posted on the users mailing list.