macro compression

43 views
Skip to first unread message

shaun gilchrist

unread,
Apr 7, 2013, 11:44:33 PM4/7/13
to qil...@googlegroups.com
This weekend I have been pondering the inverse of macro expansion. Meaning - static analysis of code to detect patterns in which atoms appear to be repeated in a way which could be better abstracted by utilizing a macro. The only hit I can get on google after various searches is a reference on the interlingua/KIF mailing list http://www-ksl.stanford.edu/email-archives/interlingua.messages/364.html in which the author states:

" Macro expansion is adequate to map from a high level notation to a low-level notation. That is a simple, linear-time process. But the inverse of macro expansion is in general undecidable. "

This is believable, however it still seems that a tool could exist which would make suggestions to the author of where a macro could be advantageous (or even match against existing macros). In the world of shen how difficult would such a tool be to write I wonder? 


Mark Tarver

unread,
Apr 10, 2013, 8:34:39 AM4/10/13
to Qilang
That's interesting. Of course repeated code patterns often occur in
programs where there is a failure to provide abstraction. Do you see
this as something to be solved by macros or rather by suitable
function definitions?

Mark
Reply all
Reply to author
Forward
0 new messages