"Scheme is a simple language", I recite to myself as I begin reading a macro expander implementation that is 3k lines long.
Conversation
Notices
-
Embed this notice
dave (dthompson@toot.cat)'s status on Tuesday, 03-Dec-2024 11:37:30 JST dave - David Wilson repeated this.
-
Embed this notice
Panicz Maciej Godek (paniczgodek@functional.cafe)'s status on Wednesday, 04-Dec-2024 16:23:01 JST Panicz Maciej Godek @dthompson FWIW I wrote a simple macro-expander for Scheme in about 500 lines (with explanations/derivation) in my master thesis:
https://github.com/panicz/master-thesis/blob/master/chapters/C.tex
It operates on s-expressions rather than syntax objects, but it supports a pattern language akin to 'macro-by-example' with some extensions, and it also tracks the derivation, so that the expanded code can be 'impanded' back (this feature isn't implemented in the above code, but I had it running on my laptop, and in my bitbucket repo that atlassian decided to kill)