Reader module for reading multiple lines

hello,

i want to modify the reader (read file) to be able read difinitions , modify them to generate racket code and evaluate expressions .

starting from this code:

https://docs.racket-lang.org/guide/hash-lang_reader.html
the difference is that i do not want to deal with a single string but a lot of lines with CR as separation and generate for each line one expression until EOF

how can i do that?

Damien

1 Like

starting to have a beginning of solution:

#lang racket
(require syntax/strip-context)
 
(provide (rename-out [literal-read read]
                     [literal-read-syntax read-syntax]))


(define (literal-read in)
  (syntax->datum
   (literal-read-syntax #f in)))
 
(define (literal-read-syntax src in)
  (define lst0 '(1 2 3 4 5 6 7))
  (define str0 (port->string in))
  (with-syntax ([str str0]
		;;[lst (syntax->list (syntax (1 2 3 4 5)))])
		[lst lst0])
		(strip-context
		 #'(module anything racket
			   'str))))
			   ;;'lst))))