LIPS-scheme / lips

Scheme based powerful lisp interpreter in JavaScript
https://lips.js.org
Other
423 stars 35 forks source link

Parsing of recursive array literals #375

Open jcubic opened 2 months ago

jcubic commented 2 months ago

This code:

(write '(1 2 #0=#(1 2 #0#)))

Prints:

(1 2 #(1 2 #<DatumReference>))

On the first type it threw an error about expecting parenthesis but #<eof> found. I was not able to repeat this error.

DatumReference is an internal value of the parser, and it should never be exposed.

jcubic commented 2 months ago

This is problematic, because the parser need to mutate the array in order to add self reference. But the & and # syntax extensions use freeze on the array/object to prevent mutation.