Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Custom language in Chez Scheme

105 views
Skip to first unread message

Michał Pociecha-Łoś

unread,
Oct 4, 2023, 12:14:03 PM10/4/23
to chez-scheme
I'm using Chez Scheme to implement a new language with non-scheme syntax, and I'd like to configure Scheme to use a different `read` procedure when loading a code in that language. It does not seem to be possible at this moment.

What would work for me is a special thread parameter, which would allow me to pick a custom `read` procedure based on file extension. Is it possible to implement such behaviour in Chez Scheme?

Best,
Michał

Jamie Taylor

unread,
Oct 4, 2023, 6:45:44 PM10/4/23
to Michał Pociecha-Łoś, chez-scheme
read is for reading scheme data (i.e., s-expressions plus the extensions that chez scheme has added to reader syntax).  load is for loading scheme files.  If you want to implement a new language then don't use those.

For an interpreter for a new language, just define different functions (or define your own versions with those names that work however you want).

If you are asking about how to implement a compiler for a new language and want to integrate with all of Chez Scheme's fancy automatic compilation on import, etc., then you want the compile-library-handler and compile-program-handler thread parameters.

Jamie

--
You received this message because you are subscribed to the Google Groups "chez-scheme" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chez-scheme...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chez-scheme/de97803e-6a81-4268-8d60-401e1148ce79n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages