EFF: icfp01-pre

Please download to get full document.

View again

of 12
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Categories
Published
Macros as Multi-Stage Computations: Type-Safe, Generative, Binding Macros in MacroML Steve Ganz  Amr Sabryy Walid Tahaz Computer Science Department Indiana University Computer Science Department Indiana University Department of Computer Science Yale University sganz@cs.indiana.edu sabry@cs.indiana.edu taha@cs.yale.edu ABSTRACT Ma ros have traditionally been viewed as operations on syntax trees or even on plain strings. This view makes ma ros seem ad ho , and is at odds with two desirab
  Macros as Multi-Stage Computations:Type-Safe, Generative, Binding Macros in MacroML Steve Ganz £  Computer ScienceDepartmentIndiana University sganz@cs.indiana.eduAmr Sabry Ý  Computer ScienceDepartmentIndiana University sabry@cs.indiana.eduWalid Taha Þ  Department of ComputerScienceYale University taha@cs.yale.edu ABSTRACT ÅÖÓ×ÚØÖØÓÒÐÐÝÒÚÛ×ÓÔÖØÓÒ×ÓÒ×ÝÒ¹ ØÜØÖ×ÓÖÚÒÓÒÔÐÒ×ØÖÒ׺Ì×ÚÛÑ×ÑÖÓ× ×Ñ  Ó  ¸Ò×ØÓ×ÛØØÛÓ×ÖÐØÙÖ×Ó ÓÒØÑÔÓÖÖÝØÝÔÙÒØÓÒÐÐÒÙ××ØØØÝÔÒÒ ×ØØ×ÓÔÒºØÔÖÐÚиØÖ×ÒÓÖ×ÑÔÐ¸ Ù×Ð×ÑÒØ×ÓÖÑÖÓ׺Ì×ÔÔÖÖÙ×ØØØ× ÔÖÓÐÑ×ÒÖ××ÝÓÖÑÐÐÝÚÛÒÑÖÓ×× ÑÙÐØ¹×ØÓÑÔÙØØÓÒ׺Ì×ÚÛÐÑÒØ×ØÒÓÖ ×Ù×ÔÓÙ×Ö×Ò××ÓÒØÓÒ×ÒØ×Ø×ÓÒÚÖÐÒÑ׸ ÒÔÖÓÚ×ÓÑÔÓ×ØÓÒÐÒØÖÔÖØØÓÒØØÒ×ÖÚ ×××ÓÖ×ÒÒ×ÓÙÒØÝÔ×Ý×ØÑÓÖÐÒÙ× ×ÙÔÔÓÖØÒÑÖÓ׸ÓÖÚÒÓÖÓÑÔÐØÓÒº ÌÓÐÐÙ×ØÖØØÔÖÓÔÓ×ÔÔÖÓ¸ÛÚÐÓÔÒÔÖ×ÒØ ÅÖÓÅĸÒÜØÒ×ÓÒÓÅÄØØ×ÙÔÔÓÖØ×ÒÐÒÒ¸ÖÙÖ¹ ×ÚÑÖÓ׸ÒØ¬ÒØÓÒÓÒÛÒÒÓÒ×ØÖÙØ׺ ÌÐØØÖ××ÙØÐ¸Ò×ØÑÓ×ØÒÓÚÐØÓÒÒ ×ØØÐÐÝØÝÔ×ØØÒºÌ×ÑÒØ×ÓÓÖ×Ù×Ø ÓÅÖÓÅÄ×ÚÒÝÒÒØÖÔÖØØÓÒÒØÓÅØÅĸ ×ØØÐÐݹØÝÔÑÙÐØ¹×ØÔÖÓÖÑÑÒÐÒÙºÁØ× ØÒ×ÝØÓ×ÓÛØØÅÖÓÅÄ××Ø¹ÒØÝÔ¹× ÑÖÓÜÔÒ×ÓÒÓ×ÒÓØÔÒÓÒÖÙÒ¹ØÑÚÐÙØÓÒ¸ ÒÒØÖÓ×ÛÖÓÒÒØÙ×ÙÐ×Ò×º  1. INTRODUCTION ÅÓ×ØÖÐÔÖÓÖÑÑÒÐÒÙ  ÑÔÐÑÒØØÓÒ×  ÔÖÓÚ ÑÖÓÐØÝØØÒÙ×ØÓÑÔÖÓÚØÖÔÖÓÖ¹ ÑÒÓÖÜÔÖ××ÚÒ×׸ÓÖÓØºÁÒØ¬Ö×Ø×¸ÑÖÓ× ÖÙ×ÙÐÐÝÙ×ÓÖÒÐÒÒÓÖÙÒÓÐÒÔÖØÙÐÖÙÒ¹ ØÓÒÐÐ׺ÁÒØ×ÓÒ×¸ÑÖÓ×ÖÙ×ÙÐÐÝÙ×  £  Ì×ÛÓÖÛ××ÙÔÔÓÖØÒÔÖØÝØØÓÒÐËÒ ÓÙÒØÓÒÙÒÖÖÒØ¹¿½¾½º  Ý  Ì×ÑØÖÐ××ÙÔÓÒÛÓÖ×ÙÔÔÓÖØÝØ¹ ØÓÒÐËÒÓÙÒØÓÒÙÒÖÖÒØÓºʹ¼½¼¿º  Þ  ÙÒÝ×ÙÓÒØÖØ½½¹½ÖÓÑÂÓÒ×ÀÓÔÒ× ÍÒÚÖ×ØÝÙÒÖËÖÑÒØÖÒØÁ¹¿¼º ØÓ¬ÒÒÛÐÒÙÓÒ×ØÖÙØ×ÓÖ×ÓÖØÒ׺ÅÒÝ Ø××ÒÚÙ×Ò×ÙÑÖÓ×Ý×ØÑ׸ÒÐÙ¹ ÒÓÒØÓÒÐÓÑÔÐØÓÒ¸ÓÒ¬ÙÖØÓÒÓÔÔÐØÓÒ×ØÓ ÔÖØÙÐÖÒÚÖÓÒÑÒØ׸ØÑÔÐØ×ÓÖÔÖÑØÖÞÓѹ ÔÙØØÓÒ׸ÒÚÒØÑÔÐÑÒØØÓÒÓÓÑÒ¹×Ô¬ ÐÒÙ׺ØÑÖÓ×ÖÒÓØÔÖØÓØ×ØÒÖ×ÓÖ ØÑÒ×ØÖÑ×ØØÐÐݹØÝÔÙÒØÓÒÐÐÒÙ××Ù ×ÅÄÒÀ×Ðк ËÓ¸ÛÝÖØÝÒÓÖ ÇØÒ¸ÑÖÓ×ÖÓÒ×ÖØÓØÖÒÑÔÐÑÒØ¹ ØÓÒØдÒØÖÓÖÒÓØÒØÖ×ØÒµÓÖ¸ÓÖÑÓÐ Ñ´ÒØÖÓÖ×ÓÙÐÔØØݵºÓØØ× ×ØÒ×ÖÙÒÓÙÒºÖ×ظØ×Ñ×ØØÓÚÑÖÓ× ´ÓÖÚÒÒÐÒÒÔÖÑ×µØ×ØØÙ×ÓÓÑÔÐÖÖØÚ ØØØÑÔÐÑÒØØÓÒÑÝÓÖÑÝÒÓØØÒØÓÓÙÒØ ÑÖÓ×«ØØ×ÑÒØ×ÓÔÖÓÖÑ×´×ËØÓÒ¾µºË¹ ÓÒ¸Ø×ÒÓÑÖÓÐØÝÐÑÓ×ØÒÚÖÐÝÓÖ× ÔÖÓÖÑÑÖ×ØÓÖ×ÓÖØØÓ  Ó  ×ÓÐÙØÓÒ×ØÓÚØ ×ÑÙÒØÓÒÐØݺ ÌÖÖÐ×ÓØÒÐÆÙÐØ×ÑÖÓ×ÖÖØÓ×Ô¹ ÝÖÓѬÖ×ØÔÖÒÔÐ׺ÅÖÓ×ÒÖ×ÓØÒ¬ÒØѹ ×ÐÚ×ÓÖØÓ×ÖÑÖÓ×ØØÐÚÐÓÔÖÓÖÑØÜØ ÓÖ×ÝÒØÜØÖ׸ÒØÓÖ××ØÒÚØÐÝÒÔÖÓ¹ ÐÑ×Ò×ÓÔÒÔÖÓÐÑ×Ù×Ò  Ò×ÝÑ  ´ÓÖÖ×Ò××ÓÒ¹ ØÓÒ×µÒÑÒÝÙÒÒØÙØÚÕÙÐØÝÒÒÕÙÐØÝØ×Ø× ÓÒÚÖÐ×ÒÑ×½℄ºÓØÓÒÐÝÖ×ÙÐÓÛ¹ÐÚÐ×Ô¹ ¬ØÓÒ×ÖØÓÓÑÑÙÒØ´ÑÒÑÖÓ×ÕÙÖ  Ø ÔÔÖÒ  ÓÒÙÒ×Ý×ØÑØµ¸ØÝÖÐ×ÓØÓ× ÛØ×ØØØÝÔÒÚÖÐÒÑ×ÒØÖÒÒÖ¹ ÐØÓÒ×Ô×ÖÒÓØÒÓÛÒÙÒØР ØÖ  ÑÖÓÜÔÒ×ÓÒ¸Ø ÓÑ×Ö´ÒÓØÑÔÓ××ÐµØÓØÝÔ¹ÑÖÓ×¹ ÓÖÜÔÒ×ÓÒÒÚÐÙØÓÒ×ØÖغ Ì×ÔÔÖÖÙ×ØØÑÖÓ×Ý×ØÑ×ÒÚÛÓÖ¹ ÑÐÐÝÒÙ×ÙÐÐÝ×ÑÙÐØ¹×ØÓÑÔÙØØÓÒ׺ÅÙÐØ¹×Ø ÔÖÓÖÑÑÒÐÒÙ×´ÒÐÙÒØÛÓ¹ÐÚÐÐÒÙ×¾¸ ½℄¸ÑÙÐØ¹ÐÚÐÐÒÙ×½¿¸½¸½¸¸℄¸ÒÅØÅÄ ½¸¿¸℄µÚÒÚÐÓÔÔÖ×ÐÝØÓÔÖÓÚÔÖ× ÒÙ×ÐÑÓÐ×Ó×ÙÓÑÔÙØØÓÒ×ØØÓÙÖÒÑÙй ØÔÐ×ØÒØ×Ø׺ÇÚÖØÐ×ØÛÝÖ׸Ø×ØÙÝÓ ÅØÅÄÒÖÐØ×Ý×ØÑ××ÒÓØÓÒÐÝÖ×ÙÐØÒÓÓ ÙÒÖ×ØÒÒÓØØÝÔ×Ò×ÑÒØ×ÓÑÙÐØ¹×Ø×Ý×¹ ØÑ׸ÙØ×Ð×Ó×ÓÐÚ¸ÓÒÒÓÖÐи×ÓÑÓØÖ ÔÖÓÐÑ×´Ö×Ò××ÓÒØÓÒ׸ØÝÔÒµÒÑÖÓ×Ý×ØÑ׺   ÓÖÑÐÞÒÑÖÓ××ÑÙÐØ¹×ØÓÑÔÙØØÓÒ×Ð×Óѹ Ô×Þ×ØØØØÒÐÔÖÓÐÑ×××ÓØÛØÑÖÓ× ÖÒÙÒ×ÔÝÒØÒÓØØÓÒÐ×ÑÒØ×ÓÑÖÓ× ÒÚÓÐÚ×Ø×ÑÚÒØÓÓÐ××ØÒÓØØÓÒÐ×¹ ÑÒØ×ÓÖØÛÓ¹ÐÚиÑÙÐØ¹ÐÚиÒÑÙÐØ¹×ØÐÒÙ× ´×Ù×ÙÒØÓÖ¹ØÓÖ×ÓÖØÓÔÓ¾¸¾¸℄µºÒÓØ¹ ØÓÒÐ×ÑÒØ××ÔÖØÙÐÖÖÐÚÒØÓÖÐ×ØÓÑÔй Ö׸ÛÒÚÖÐÝÒÚÓÐÚØÖÒ×ÐØÓÒÔ×ºÓѹ ÔÓ×ØÓÒдÒÓØØÓÒе×ÑÒØ××ÒÖÐÐÝÓÒÓØ ÑÓ×ØÐÔÙÐÒ×Ó×ÑÒØ×ÒÚÐÓÔÒÒÚÖÝÒ ×ÙÓÑÔÐÖ×¿¼℄º ÏÐØ×ÔÔÖÑÓÒ×ØÖØ×ØØÅØÅÄ×ÓÓÑØ¹ ÐÒÙÓÖ  ¬ÒÒ  ÑÖÓ׸ÅØÅÄ×ÒÓØØÐÐÒ¹ ÙÓÖ  ÛÖØÒ  ÑÖÓ×ØÓ×ÒÓØÚ×ÙÔÔÓÖØÓÖ¬Ò¹ ÒÒÛÒÒÓÒ×ØÖÙØ׺ÁÒØÓÒØÓØØÒÒ ÓÒØÖÓÐÐÒÒÐÒÒ¸ÑÖÓ×ÖÓØÒÙ×ØÓ×ØÖØÓѹ ÑÓÒ×ÝÒØØÔØØÖÒ×ÒÔÖÓÖÑ׺ÁÒÐÒÙÛØ Ö¹ÓÖÖÔÖÓÙÖ׸×ÔÐÐÝÐÞÝÐÒÙ¸×ÓÑÓ Ø××ØÖØÓÒ×ÒÜÔÖ××´ÑÝÛØÐÓ××Ó ÆÒݵÙ×ÒÙÒØÓÒ׺ÙØÑÒÝÓØ×ÝÒØØÔع ØÖÒ×ÓÚÖÛÓÒÛÒØ×ØÓ×ØÖØÛÓÙÐÒØÓÒ ÚÖÐ׺ÓÒ×ØÖÙØ×ØØÒÚÖÐ×ÖÒÓØÖØÐÝ ÜÔÖ××ÐÙ×ÒÙÒØÓÒ׺ÓÖÜÑÔÐ¸ÓÚÖÐÓÒÒܹ ×ØÒÒÒÓÒ×ØÖÙØ×Ù×Ø  Ó  ¹ÒÓØØÓÒÓÀ×ÐРØÓÐÐÓÛÖÙÖ×ÚÒÒ×ÒÒÓØÜÔÖ××Ù×ÒÙÒ¹ ØÓÒ׸ÒÖÕÙÖ×ÒØÓØÓÑÔÐÖ½¼℄º  ÅÖÓÅÄ  Ì×ÔÔÖÔÖ×ÒØ×ÒÜÔÖ××Ú¸ØÝÔÐÒ¹ ÙØØ×ÙÔÔÓÖØ×ÒÖØÚÑÖÓ׺Ì×ÐÒÙ¸Ðй ÅÖÓÅĸ×¬ÒÝÒÒØÖÔÖØØÓÒÒØÓÅØÅĸ ÒÒÜÔÖ××´ÓØ×ÑÔÐÒÖÙÖ×ÚµÒÐÒÒÒ Ø¬ÒØÓÒÓÒÛÒÒÓÒ×ØÖÙØ׺Ý×ÒÓРÓÖÅÖÓÅÄ×ØØØ  ÓÒ×ÖÚØÚÜØÒ×ÓÒ  ½½℄Ó ÅĺÌ×ÑÔÐ×ØØØ×ØÝÔ×Ý×ØÑ×ÓÙÐÒÐÙÐРÛÐйØÝÔÅÄÔÖÓÖÑ׺ÁØ×ÓÙÐÐ×ÓÒÓØÖØÖ¹ ×ÓÒÒÔÖÒÔÐ×ÓÖÅÄÔÖÓÖÑ׸×Ù×  «  Ò  ¬  Ú  ÓÒ¹ ÚÖ×ÓÒºÏÐ×ÓÛÒØØÐÒÙØÓÖÑÒ×ØØÐÐÝ ØÝÔÐºÚÒØØÓÙÖÓÐ×ÓÒ×ÖÚØÚÜØÒ×ÓÒÓ ÅĸØÖÖ×ÓÑÒÓØÐÔÓÒØ×ÓÙØÛØÅÖÓÅÄ× ×Ò  ÒÓØ  ØÓÓ  ¯  ÅÖÓÅÄÓ×ÒÓØÐÙÖØ×ØÒØÓÒØÛÒÔÖÓ¹ ÖÑ×ÒØºÐØÓÙÑÒÝÔÔÐØÓÒ×ÒØÙ¹ ÖÐÐÝÚÛÔÖÓÖÑ××Ø¸ØÖ×ÙÒÑÒØР×ØÒØÓÒØÛÒØØÛÓºÏÐÓØÔÖÓÖÑ× ÒØÒÖÔÖ×ÒØ´Ù×Ò¸  ºº  ¸ÒØÙÖÐÒÙѹ Ö׸  Ë  ¹ÜÔÖ××ÓÒ×µ¸  ØÒÓØÓÒ×ÓÕÙÐØÝ××ÓØ ÛØÓÒ´×ÝÒØØÒ×ÑÒØÕÙÐØݸÖ×Ô¹ ØÚÐݵÒÒÓØÒ×ÓÙÐÒÓØÑÜ  ºÙÖØÖÑÓÖ¸ ÒØÖÒÐÞÒØØÛÓÒÓØÓÒ×ÒØÓÐÒÙ¸ÛÐ ×ØÐÐÒÓÖÒØ×ØÒØÓÒØÛÒØØÛÓ×ÒÓÒ¹ ØÖÚÐ¾¾¸¸¿℄ºÓÖØØÖÓÖÛÓÖ×¸Ø×ÖÐØÚÐÝ ×ÝØÓÔÓÒ  ÓÖ  ØÓØÖ¸ØØ׸ØÓØÖÚ ×ÝÒØØÕÙÐØÝÓÖ×ÑÒØÕÙÐØÝÚÖÝÛÖºÁÒ ÅÖÓÅĸÛÓÓ×ØÓÐÐÓÛÓÒÐÝ×ÑÒØÕÙÐØÝÒ ØÐÒÙÒÛÚÓÒØÖÓÙÒ×ÝÒØØÕÙй ØÝ´ÓÒÔÖÓÖÑ×µÝÒÓØÒØÖÓÙÒ  ÒÝ  Ö-ØÚÓÖ Ó¹Ò×ÔØÓÒÔÐØ×ÒØÓØÐÒÙº  ¯  ÅÖÓÅÄÓ×ÒÓØÒØÖÓÙÒØÐÝÒÑ×ÓÔ¹ ÒÒ»ÓÖÚÖÐÔØÙÖºÌ×ÔÖÓÐÑ×ÒÖ¹ ÐÐÝÖ×ÖÓÑÒÓÚÖÐÝ×ÑÔÐ×ØÚÛÓÔÖÓÖÑ× ×Ø¸×Ù×ÒÖÐÝÄÁËÈ×Ý×ØÑ×ÓÖÒºÌ ËÑÓÑÑÙÒØÝ××Ù×ØÒØÐÖÓÐÒÖ¹ ÓÒÞÒÒÖ××ÒØ×ÔÖÓÐÑÒÔÖÓÑÓØÒ ØÒÓØÓÒÓÝÒÑÖÓÜÔÒ×ÓÒ½¸℄ºÅÓÖ ÖÒØÐݸØÖÚÒÑÓÖ×ÓÔ×ØØÔÖÓÔÓ×¹ Ð׸ÐÖ¹ÓÖÖ×ØÖØ×ÝÒØÜ´ÀÇ˵¿¿¸¾½¸ ½¸½¾℄¸ÒÖ×ÅÄ¿℄ºÌÝÓÒØÖÙØÓÒÓÐРØ×ÔÖÓÔÓ×Ð××ØÓÔÖÓÚÑÒ×ØÓÜÔÖ××Ø ØØØÔÖÓÖÑ×ÖÒÓØ   Ù×Ø  Øº  ¯  ÅÖÓÅÄÓ×ÒÓØÐÐÓÛÑÖÓ×ØØÒ×ÔØÓÖØ ÔÖØÓ´  ºº  ¸  ÒÐÝØÑÖÓ×  µºÌ×Ö×ØÖØÓÒ ×Ñ×Ò××ÖÝØÓÑÒØÒ×ØØØÝÔÒºÁÒ×ØÐРÑÖÓ×ÒÅÖÓÅÄÖÐÑØØÓÓÒ×ØÖÙØÒÒÛ ÓÒÓÑÒÒÓÖÑÒØ×´  ºº  ¸  ÒÖØÚ ÑÖÓ×  µºÌ×ÔÔÖÔÖ×ÒØ×ÒÙÑÖÓÜÑÔÐ× ØØ×Ù×ØØØÑÒÝÙ×ÙÐØ××ÒÓѹ ÔÐ×Ù×Ò×Ù×ØØÐÐÝØÝÔÒÖØÚÑÖÓ׺ ×ÔÐÐÝØ¬Ö×ØÔÓÒØ×Ò×ÔÖÝÑÙÐØ¹×ØÐÒÙ¸ ÙØØÓÒÜØÒظ×ÓÖØÓØÖØÛÓºÝ××ÙØØÖ×× ÒØÔÖ×ÒÓÑÖÓ×ØØ¬ÒÒÛÒÒÓÒ×ØÖÙØ× ×ØÒÐÒÓ  «  ÓÒÚÖ×ÓÒºÏÐØ×ÒÓØÐÖÓÛØ× ÔÖÓÐÑÒÖ××ÒØÙÒØÝÔ×ØØÒ¸Ø×Ð×Ó Ö××ÝØØÝÔ×Ý×ØѺ××ÙÅÖÓÅÄØÖ×ØÓ ÚÐÒØÛÒÒÒÜÔÖ××ÚÑÖÓ×Ý×ØÑ ÒÒÑÖÓ×Ý×ØÑØØÛÒÖ×ÓÒÓÙغ  ÇÖÒÞØÓÒ  ËØÓÒ¾ÒØÖÓÙ×ÅÖÓÅÄÝ×Ö×Ó ÑÓØÚØÒÜÑÔÐ׸Ò×Ù×××Ø××ÙÓÐÔÕÙÚ¹ ÐÒÒØÔÖ×ÒÓÑÖÓ×ØØÒ¬ÒÒÛÒ¹ ÒÓÒ×ØÖÙØ׺ËØÓÒ¿ÖÚÛ×ØÅØÅÄ×ÝÒØܸØÝÔ ×Ý×ØѸÒ×ÑÒØ׺ËØÓÒÔÖ×ÒØ×ØÑÒØ¹ ÒÐÓÒØÖÙØÓÒÓÑÔÓ×ØÓÒÐÒØÖÔÖØØÓÒÓÓÖ ÅÖÓÅÄÒØÓÅØÅÄØØÔÖÓÚ××ÑÒØ×ØØ× ÓØÜÙØÐÒÖ×ÓÒÐÝ×ÝØÓÓÑÑÙÒØº¹ ØÖØÅÖÓÅÄÐÒÙÒÓÖØØÖÒ×ÐØÓÒÙ×ÒÝÓÔ¹ ÖØÓÒ×ÒÓÖ×¹ÓÒØÓÒ×ØÓÒÖØÖ×ÒÑ׺ÁÒ¹ ×ØØ××ÖÐØØÓØ×ÑÒØ×ÓØØÖØÐÒÙ ÓØØÖÒ×ÐØÓÒºÌØÖØÐÒÙØ×Ð¸ÅØÅĸ× ÒÓÔÖØÓÒÐ×ÑÒØ×¬ÒÙ×ÒÒÓØÒÙØØ×ØÒ¹ ÖÒÓØÓÒÓ×Ù×ØØÙØÓÒºÌØÖÒ×ÐØÓÒ××ÓÛÒØÓ ÔÖÓÙÓÒÐÝÛÐйØÝÔÅØÅÄØÖÑ×ØÙ×ÔÖÓÚÒ ØÝÔ×ØÝÖ×ÙÐØÓÖÅÖÓÅĺËØÓÒÓÒ×Ö××ÚÖРÜØÒ×ÓÒ×ØÓÓÖÅÖÓÅÄÒ×Ù×××ÑÔÐÑÒØØÓÒ ××Ù׺ËØÓÒ×Ò×Ù××ÖÐØÛÓÖÒÓÒÐÙº  2. MACROML BY EXAMPLE ÁÒØ××ØÓÒ¸ÛÙ××ÕÙÒÓÜÑÔÐ×ØÓÒØÖÓ¹ ÙØ×××Ù×ÑÓØÚØÒÒÓÚÖÒÒÓÙÖ×Ò ÓÅÖÓÅĺÜÑÔÐ×ÓÐÐÓÛÝ×ÙÑÑÖÝÓØ ××ÑÒØÓÒÖÒ×ØØØÖ×׺  2.1 Simple Inlining: A First Attempt ÓÒ×ÖØÓÐÐÓÛÒÓÜÖÔظÛÖØÙÒØÓÒ×  ØÖØ  Ò  ×ØÐØ  ÚØÜÔØÑÒÒ  ÐØÚÐÛÓÖ×Þ ÒºººØÖØ×ØÐØÛÓÖ×ÞºººÒ  ÀÖ¸  ÛÓÖ×Þ  ×Ù×ÔÙÖÐÝÓÖÖ×ÓÒ×ÓÐÖØÝÒ ÑÒØÒÐØÝÒØ×ÓÙÖÓ¸ÒÑÓ×ØÑÔÐÑÒØ¹   ØÓÒ×ÖÐÐÝØÓÒÐÒØÔÖÓÙÒ  ºººØÖØ×ØÐØººº  ÙØÒÒÖÐ×ØÙØÓÒÛÖ  ÛÓÖ×Þ  ×ÓÙÒØÓ ÑÓÖÓÑÔÐØÜÔÖ××ÓÒÐ  Ü·  ÓÖÒÜÔÖ××ÓÒÛÓ× ÚÐÙØÓÒÑØÚ×¹«Ø×Ð  ½»Ü  ¸Ø×ØÙØÓÒ× ÑÓÖÐØºËÓÑÓÑÔÐÖ×ÑØÒÐÒ  Ü·  Ò×ÓÑ ÑØÒÓغÒÒÓÓÑÔÐÖ×ØÐÖØÝØÓÒÐÒÜÔÖ××ÓÒ× ÛØ«Ø×Ø××ÐÖÒÐÒÙÐÅĸÙØØ×Ð×Ó Ø×ÒÔÙÖÐÒÙ×ÐÀ×ÐÐÛÖÓÑÔÐÖ× ÑÙ×ØÖ×ØÖØÒÐÒÒÛÒÐÒÛØÙÐعÒÑÓÒ «Ø×¿¸½℄ºÓÑÔÐÖ×Ð×ÓÒÒÓØÐØØÓÒÐÒÓÖÒÓØ ÒÐÒØÛÐÐÛÒÛÖÓÙØÖ×ÓÙÖÚÓÖ¾℄º ËÒÒÐÒÒ«Ø×ÒÓØÓÒÐÝØÔÖÓÖÑÒÙØÐ×ÓØ ×ÑÒØ×ÓÅÄÔÖÓÖÑ׸ÛÐÚØØØÓÙÐÐÐÒÙ ÓÒ×ØÖÙØÛØÓÒÖØ×ÝÒØܸØÝÔÒÖÙÐ׸ÒÓÖÑÐ×¹ ÑÒØ׺ÁÒÅÖÓÅĸÔÖÓÖÑÑÖ×Ò  ÖÕÙÖ  ÒÐÒÒÓ ÒÜÔÖ××ÓÒÙ×ÒÒÛÚÖÒØÓ  ÐØ  ¹ÜÔÖ××ÓÒ×ÐÐ  ÐØÑ  ºÓÖÜÑÔÐ¸ØÖÑÒØ  ÐØÑÛÓÖ×ÞÖ×ÍÒÒÓÛÒ×Þ ÒºººØÖØ×ØÐØÛÓÖ×ÞºººÒ  ØØ×ØظÚÒØÓÙ  Ö×ÍÒÒÓÛÒ×Þ  ×ÒÓØÒ ÅÄÚÐÙ¸ÛÛÒØØÒÐÒ¸ÔÖÓÙÒ  ºººØÖØ×ØÐØ´Ö×ÍÒÒÓÛÒ×Þµººº  ËÑÒØ×  Ì×ÑÒØ×ÓØ×ÒÓÒÐÒÒ××ÑÔÐÝ Ø×ØÒÖÔØÙÖ¹ÚÓÒ×Ù×ØØÙØÓÒÓÚÖÐÝ ÒÜÔÖ××ÓÒ¸¾℄ºÍÒÓÖØÙÒØÐݸÛÐØ××ÓÓ ÜÑÔÐÓØ××ÒÓÒÐÒÒ¸ÒØÖÓÙÒÒÐÒÒÒ Ø××ÓÒ´ØÖÓÙØÑÖÓÙÖÖÒÓÚÖÐµÒ ÒØÖÖÛØ×ØÐ×Ö×ÓÒÒÔÖÒÔÐ×ÓÖÐйݹ ÚÐÙ´εÐÒÙ׺ÓÖÜÑÔÐ¸Ò×ØÒÖΠÐÙÐÙ×¿℄¸  ÃÜ  ×Ó×ÖÚØÓÒÐÐÝÕÙÚÐÒØØÓ    ×Ò ÚÖÐ×ÖÚÐÙ׺ÙØÒØÓÒØÜØ  ÐØÑÜÖ×ÖÖÓÖÒºººÒ  Ø×ØÛÓØÖÑ×Ú«ÖÒØÐݸÙ×¸ÓÒØÖÖÝØÓ ØÙ×ÙÐ××ÙÑÔØÓÒÓÙØÎÚÖÐ׸  Ü  ×ÖÔÐ ÝÒÓÒ¹ÚÐÙºÌÓÖØÒØ×ØÐ×Ö×ÓÒÒÔÖÒ¹ ÔÐ×ÓÎÐÒÙ׸ÛÖ×ØÖØÐÐÙ××ÓÑÖÓ×Ò ÅÖÓÅÄØÓ×ÝÒØØÐÐÝÒÓÒ¹ÚÐÙ×´  ºº  ¸ÔÔÐØÓÒ׸  ÐØ  ¹ÜÔÖ××ÓÒ׸Øµº  2.2 Functional Inlining ÅÖÓ×ØØØÖÙÑÒØ×ÖÙ×Ø×Ù×ÙÐÒÓØÑÓÖ Ù×ÙÐØÒ×ÑÔÐÒÐÒÒºÌÖÓÖÑ´×ÔÔÐØÓÒ×µÐ×Ó ÔÖÓÚ×ØÚÒØØØØÝÓÒÓØÒØÖÖÛØ Ø×ØÐ××ÑÒØ×ÓÎÐÒÙ׺ÓÒ×Ö  Ñ°ÒÜ Ñ´µ  ÌÐÖÓÔÖØÓÖ×  °  Ò    ¸ÖÐÝÒÓÖ¸ Ö×ÔØÚÐݸÑÔÐÑÒØ×ÑÔÐÚÖÒØÓÇ×³×ÔÖÓ¹ ÔÓ×ÐÓÖ×Ù×ÔÒ×ÓÒ×¾℄ºÌÖÖØÛÓÒÓØÐØÙÖ× ÓÙØØ×ÜÑÔÐºÖ×ظÛÒÒÓØ¬Ò  °  ×ÙÒØÓÒ ×ÒØÚÐÙØÓÒÓ  °³  ×ÓÙÐÒÓØÐÐÓÛØÔÖÑØÙÖ ÚÐÙØÓÒÓ  ³  ºÌÙ׸Ø××ÒÙÒÐÝÙ×ÙÐÔÔÐØÓÒ ÓÑÖÓ×Ý×ØѺËÓÒ¸ÑÖÓÜÔÒ×ÓÒ×ÓÙÐÒÓØй ÐÓÛØÒÒÓÙÖÖÒÓ  Ü  ÒØÑÖÓ¬ÒØÓÒØÓ ÒØÐÝÔØÙÖÖÓÙÖÖÒ×Ó  Ü  ÒÑÖÓÖÙÑÒØ׺  ËÑÒØ×  Ì×ÑÒØ×ÓÙÒØÓÒÐÒÐÒÒÒÚÓÐÚ×ØÛÓ ×Ù×ØØÙØÓÒ׺Ö×ظØÖÙÑÒØÓØÑÖÓÔÔÐØÓÒ ××Ù×ØØÙØÒØÓØÓݺÚÒØØÛÖÙ×ÒØ ×ØÒÖÒÓØÓÒÓ×Ù×ØØÙØÓÒ¸ØÚÖÐ  Ü  ÒØÓÚ ÜÑÔÐÒÒÓØÓÙÖÒØÜÔÖ××ÓÒÓÙÒØÓØÚÖ¹ Ð    ºËÓÒ¸ØÖ×ÙÐØÒÑÖÓÓÝ××Ù×ØØÙØ ÒØÓØÓÒØÜØÓÔÔÐØÓÒ¸ÒÙ×ÒØ×ØÒ¹ ÖÒÓØÓÒÓ×Ù×ØØÙØÓÒºÁÒÓÙÖÜÑÔÐ¸ØÜÔÖ×¹ ×ÓÒ  ÒÜ°´ØÐܵ  ÜÔÒ×ØÓ  ÒÜÒܳØÐÜ  ÛÖ  ܳ  ×Ö×ÐÝÒÖØÒÑ´ÛØ×ÒÑ  Ü  ÓÒÐÝØÓÒØØÓØ××ÓÙÖµº Ì×ÜÑÔÐÑÓÒ×ØÖØ×ÒÓØÖÝØÙÖÓÑÖÓ ×Ý×ØÑ×Ù×ÑÖÓÐÐ×ÒÓÙÖÙÒÖÒÖ׸Ø ×ÑÒØ×  ÖÕÙÖ×  ÚÐÙØÓÒÙÒÖÒÖ׺Ì×××Ò¹ ÒØÙ×ÚÐÙØÓÒÙÒÖÒÖÒÖÐÐÝÒÚÓÐÚ× ÑÒÔÙÐØÒ  ÓÔÒÓ  Û××Ò¬ÒØÐÝÑÓÖÓÑÔÐ¹ Ø½¸¾¸¿℄ØÒØÖ×ØÖØÓÒØÓÐÒÛØÓÒÐÝ ÐÓ×ØÖÑ×ÑÔÓ×ÝÑÓ×Ø×ÑÒØ×Ô¬ØÓÒ×Ò ÑÔÐÑÒØØÓÒ×ÓÐÒÙ×´ÛØÖθ¸ÓÖÐй ݹÒµº  2.3 Recursive Macros ÏØÛÛ×ØÓÔÖÓÖÑÑÓÖÓÑÔÙØØÓÒ×ÙÖÒÑÖÓ ÜÔÒ×ÓÒÓÒ×ÖØÐ××ÔÓÛÖÙÒØÓÒ  ÔÓÛ    ÐØÙÒÔÓÛÒÜ Ò¼ØÒ½Ð×ܶ´ÔÓÛ´Ò¹½µÜµ ÒÔÓÛ´¾¶¿µ´·µÒ  ÁÛÖÔÐØ  ÙÒ  ÝÛÓÖÝ  Ñ  ¸ÑÖÓÜÔÒ×ÓÒ Ó×ÒØÓÒÒ¬ÒØÐÓÓÔ¸Û×ÔÖÓÐÝÒÓØØ¹ ×ÖÚÓÖºÏØÔÔÒ×ÁÒØÙØÚÐݸØÑÖÓÐР ÔÓÛ´¾¶¿µ´·µ  ÜÔÒ×ÒØÓ  ¾¶¿¼ØÒ½Ð×´·µ¶´ÔÓÛ´¾¶¿¹½µ´·µµ  ÛØ×ÐÜÔÒ×ÒØÓ  ¾¶¿¼ØÒ½ Ð×´·µ¶´´¾¶¿¹½µ¼ØÒ½ Ð×´·µ¶´ÔÓÛ´´¾¶¿¹½µ¹½µ´·µµµ  ÒØÜÔÒ×ÓÒÓ×ÓÒÒ¬ÒØÐݺÅÖÓÜÔÒ×ÓÒ ÒÓÒÐÝØÖÑÒØØ    ¹ÜÔÖ××ÓÒ×ÚÐÙØ  ÙÖ¹ Ò  ÜÔÒ×ÓÒ¸ÒÒÓØÖÓÒ×ØÖÙØ×ÔÖØÓØÖ×ÙÐغ ÌÓÖÕÙÖØÜÙØÓÒÓØ    ÜÔÖ××ÓÒÙÖÒÑÖÓ ÜÔÒ×ÓÒ¸ÛÑÙ×ØÜÔÐØÐÝÒØØØ  Ò  ×Ò  ÖÐÝ  Ô¹ ÖÑØÖ¸ÖØÖØÒÖÙÐÖÑÖÓÔÖÑØÖ´ÛÛ   ÐР ÐØ  µ¸ÒÒÒÓØØØØÖÑØÓ×ØÒÙ×ÑÓÒÖÐÝ ÒÐØÓÑÔÙØØÓÒ׺ÌÒØÒ  ÔÓÛ  ÑÖÓÒÒÓÛ ÛÖØØÒ×  ÐØÑÔÓÛÒÜ ´Ò¼ØÒ½Ð×ܶ´ÔÓÛ´Ò¹½µÜµµ ÒÔÓÛ´¾¶¿µ´·µÒ  ÌØÛÓÓÒ×ØÖÙØ×  ×Ô      Ò  ÖØ×        ÖÓÖÖÓÛ ÖØÐÝÖÓÑÅØÅĸÒÛÓÖ×ÓÐÐÓÛ×Ø¬Ö×ØÓÒ¹ ×ØÖÙØ×Ô×ÖÓÑØÑÖÓÜÔÒ×ÓÒÑÓØÓÖ¹ ÙÐÖÅÄÚÐÙØÓÒØÓÔÖÓÖÑÓÑÔÙØØÓÒØ×ÓÒ ÓÒ×ØÖÙØÒØÖÖÙÔØ×ÖÙÐÖÚÐÙØÓÒØÓÖØÙÖÒÖ×ÙÐØØÓ ØÑÖÓÜÔÒ×ÓÒÑÓºÌÜÔÒ×ÓÒÓØÑÖÓ ÐÐÓÚÒÓÛÝÐ×  ´·µ¶´·µ¶´·µ¶´·µ¶´·µ¶´·µ¶½  ËÑÒØ×  ÌÒÓÖÒØÖÓÙÒØÖØ×Ò×¹ ÔÓÒ×ØÖÙØ××ÖØÐÝÖÐØØÓØÒØÓÚ ÛÐй×Ô¬ÓÖÖÓÖÚÐÙØÒÚÖÓÙ××Ù¹ÜÔÖ××ÓÒ׺ ÁÒÔÖØÙÐÖ¸ÛØÖÙÖ×ÓÒ¸ØÓÑ×ÐÖØØØÖ ÖØÛÓ«ÖÒØÒ×ÓÓÑÔÙØØÓÒ×ÖÐÝÓÒ×ÒÐØ ÓÒ׺ÌÒØÓÒØÖÑÜØ×ØÛÓÒ×ÓÓÑÔÙØØÓÒ ×ÛØÖÕÙÖ×ÑÓÖ×Ù×ØÒØÐØÝÔ×Ý×ØÑØÒÙ×Ùк ÁÒÔÖØÙÐÖ¸ÛÑÙ×ØÒÓÖÛØ×ÐÐ  ÓÒÖÙÒ  Ò ØÔÖØÐÚÐÙØÓÒÐØÖØÙÖÛÐйÓÖÑÑÙÐØ¹×Ø ÓÑÔÙØØÓÒ×ÓÙÐÒÓØÓÒØÒÒÖÐÝÓÑÔÙØØÓÒØØ ÔÒ×ÓÒØÖ×ÙÐØÓÐØÓÑÔÙØØÓÒ½℄º×ÑÔÐ ÜÑÔÐÓØÒÓÔÖÓÖÑØØØØÝÔ×Ý×ØÑ×ØÓ ÖØ×  ÐØÑÒ´¼ØÒÒÐ×Ò·½µ ÒÒÒÑÑÒ  ÌÑÖÓÖÙÑÒØ    ×ÒÙÖÒÑÖÓÜÔÒ×ÓÒ ÙظÒÖÙÒ¹ØÑÚÖÐ¸Ø×ÙÒÓÙÒØØØØÑº  2.4 Defining New Binding Constructs ÏÒÓÛÓÑØÓÓÒÓØÑÓ×ØÒÓÚÐØÙÖ×ÓÅÖÓÅÄ ØÐØÝØÓ¬ÒÒÛÒÒÓÒ×ØÖÙØ×ÒØØÝÔ ×ØØÒºÄØÙ××ÝØØÛÖÙ×ÒØÑÖÓ×  °  Ò    ÓÖ ×Ù×ÔÒ×ÓÒ×ØÓÑÔÐÑÒØÒÓØÓÒÓÓÑÔÙØØÓÒ¾¿℄º Ï¬Ò×ÙØÐÑÓÒ¹  ÐØ  ÓÖØ××ØØÒ×ÓÐÐÓÛ×  Ñ´ÐØ×ÕÜ½Ò¾Òµ °´ÐØÚÐÜ½Ò¾Òµ  Ì¬ÒØÓÒÒØÖÓÙ×ÒÛÒÒÓÒ×ØÖÙØ  ÐØ×Õ  ÛÜÔÒ×ØÓØÓÖÒÒÓÒ×ØÖÙØ  ÐØÚР ºÓÖ ÜÑÔÐ¸  ÐØ×ÕÝ°ÒÝÒ  ÜÔÒ×ØÓ  °´ÐØÚÐÜ´°µÒ´ܵÒµ  ËÑÒØ×  ÝÒ×ØÒØ××ÔØÓÓÙÖÔÖÓÔÓ×Р×ØÓÐÐÓÛØÙ×ÖØÓÓÒÐÝ¬ÒÒÛÒÒÓÒ×ØÖÙØ× ØØÓÐÐÓÛØÔØØÖÒ×ÓÜ×ØÒÒÒÓÒ×ØÖÙØ׸×Ù ×ÐÑ×ØÖØÓÒ׸ÚÐÙÐÖØÓÒ׸ÒÖÙÖ×Ú ÐÖØÓÒ׺  ÁÒØ×ÒÒÓÒ×ØÖÙØ×ÚÖÝÓÙÖÖÒÓ ÚÖÐÒÑÑØÐÝÒØ¬×ØÖÒÒ ÓÙÖÖÒÓÖÓÙÒÓÙÖÖÒº  Ì×ÑÒØ×ÓÓÙÖ ÔÖÓÔÓ×Ð××ÒØÓÖ-ØØ××ØÒØÓÒºÙØÚÒ ÛÒØ××ØÒØÓÒ×ØÒÒØÓÓÙÒظ  «  ÕÙÚÐÒ ××ØÐÐ×ÙØÐºÓÖÜÑÔÐ¸Ø¬ÒØÓÒÓÚÒÒÓØ ÛÖØØÒÒØÓ  Ñ´ÐØ×ÕÜ½Ò¾Òµ °´ÐØÚÐÝ½Ò¾Òµ  ÛØØÙ×Ø¬ØÓÒØØ  Ý  ×ÒÒÓÙÖÖÒ¸Ò ØÓ×ÒÓØÓÙÖÒØÓÝ  ¾  ºÌÔÖÓÐÑÖ× ØØØÖÖÒØØÛÓ«ÖÒØÒÒÓÙÖÖÒ×Ó ØÚÖÐ  Ü  ¸ÒÓÒÓØÑ×Ó«ÖÒØÒØÙÖº ÁÒ××Ò¸Ø¬Ö×ØÓÒ´ÒØÔÖÑØÖÓØÑÖÓµ ×Ý×ØØØÖ×ÚÖÐ¸Ðس×ÐÐØ  Ü  ¸ÛÒÓÙÖ ÖÒØÜÔÖ××ÓÒÓÙÒØÓ  ¾  ºÙ×ÓØ׸Ø Ù×ÓØÚÖÐÒÑ  Ü  ÒØ×ÓÒÐÖØÓÒÒÓÛ ××ÔÐÑÒÒºÁÒ××Ò¸Ø×ÓÒÐÖØÓÒÒÓÛ ×Ý×Ù×  Ü  ÐÓÐÐÝ×ÒÓÖÑÐÐÝÚÖÐÒÑ¸ÙØÑ ×ÙÖØØØ×ØÖØÒØÓÙØÔÙØÓØÑÖÓ×Ø ÒÒÓÙÖÖÒÓÖØ  Ü  Ò  ¾  º ÌØÝÔ×Ý×ØÑÓÖÅÖÓÅÄÖ×××Ø×××ÙØÖÓÙ ØÛÓÑÒ×Ñ×¬Ö×ظ×ÔÐØÝÔÒÚÖÓÒÑÒØ×ÖÙ× ØÓÔØÖÓØÐÖØÓÒ×ÓÑÖÓÔÖÑØÖ׸Ò ÑÓ×ØÑÔÓÖØÒØÐݸØ  Ò  ÔÖÑØÖ×Ð  ¾  ÓÚºË¹ ÓÒØØÝÔÓØ×ÒÔÖÑØÖ×ÛÐÐÜÔÐØÐÝÖÖÝ ÖÓÙÒØÒÑÓØ  ÒÖ  ÔÖÑØÖ  Ü  ¸ÛÓÑ× ÖÓÑØ¬Ö×ØÐÖØÓÒÓ  Ü  ºÌ×ÓÒÐÖØÓÒÓ  Ü  Ø×Ð×ÒØÓÑÔÐØÐÝÒÓÖÑÐÐÖØÓÒºÏØ Ø×ØÝÔÒÒÓÖÑØÓÒ¸Ø×ÔÓ××ÐÝØÓÖØØÐÓÐÖ¹ ÔÐÑÒØÓ  Ü  ÒØÓ  Ý  ×ÓÚºÁØ×ÑÔÓÖØÒØØÓÒÓØØ «ÖÒØÛÒØ×ÑÒ×ÑÒØÐ××Ò¹ ØÐÝÒÑ×ÓÔÒ  ØÔÒÒÝÓÒÖÚÖÐ ×Ö-ØÜÔÐØÐÝÒØØÝÔ  º××ÒØÐÐÝØ×ÑÔÖÒ¹ ÔÐÙÒÖÐ×ØÖÒØÔÖÓÔÓ×ÐÓÖÑÔÐØÔÖÑØÖ×¾¼℄º ÏÒÓÛØØØØÝÔ×Ý×ØÑÔÖÓÚ×ÒÕÙØ×ÓÐÙØÓÒ ØÓØÔÖÓÐÑÓ  «  ÓÒÚÖ×ÓÒÒØ×ÓÙÖÔÖÓÖÑ¹ Ù×ØØÝÔ×Ý×ØÑÙÖÒØ×ØØÛÐйØÝÔÅÖÓÅÄ ÔÖÓÖÑ×ÒØÖÒ×ÐØØÓÅØÅÄÔÖÓÖÑ׸ÒÒ ØÐØØÖ¸  «  ÖÒÑÒ×ÓÑÔÐØÐÝ×ØÒÖ¸ÚÒÒØ ÙÒØÝÔ×ØØÒº ØØ×ÔÓÒظØÖÖÑÝÛÓÒÖÓÛÖÚÖÐ× Ô××ÖÓÙÒÒÅÖÓÅÄÏÖØÙÖÒ×ÓÖØÐÝØÓØ×ÕÙ×¹ ØÓÒÒËØÓÒº  3. MULTI-STAGE LANGUAGES ÅÖÓ×Ý×ØÑ×ÒØÖÓÙ×ØÓÓÑÔÙØØÓÒØØ×ÓÙÐ ÔÔÒÓÖØØÖØÓÒÐ×ØÓÔÖÓÖÑÜÙØÓÒº ÖÐÝÓÑÔÙØØÓÒ×ÙÖÒØ×ÒÛ×ØÒÐÙÑÖÓ ÜÔÒ×ÓÒ×ÛÐÐ×ÚÖÓÙ×ÓØÖØÖØÓÒÐÓÑÔÙØØÓÒ× ´  ºº  ¸ÓÒØÓÒÐ׸ÔÔÐØÓÒ׸Øµº ×ÑÒØÓÒÒØÒØÖÓÙØÓÒ¸ÑÙÐØ¹ÐÚÐÐÒÙ×Ú ÒÚÐÓÔØÓÑÓÐ×ÙÒ×Ó×ØÓÑÔÙØØÓÒº 
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks