#LyX 1.3 created this file. For more info see http://www.lyx.org/ \lyxformat 221 \textclass article \language english \inputencoding auto \fontscheme palatino \graphics default \paperfontsize default \spacing single \papersize a4paper \paperpackage widemarginsa4 \use_geometry 0 \use_amsmath 0 \use_natbib 0 \use_numerical_citations 0 \paperorientation portrait \secnumdepth 3 \tocdepth 3 \paragraph_separation indent \defskip medskip \quotes_language english \quotes_times 2 \papercolumns 2 \papersides 1 \paperpagestyle default \layout Title Implementing syntax-case and macromod \newline (we want it now!) \layout Author Tony Garnock-Jones \layout Abstract Goals: understand syntax-case, implement in a non-bootstrapped manner (i.e. make no use of syntax-case in the implementation), ignore efficiency for clarity-of-implementation, second/alternative portable implementation, accumulate a library of useful syntactic-manipulation primitives, build Matthew Flatt's module system on top. \layout Itemize started with the simple system in the paper, with eager mark/subst propagation; then implemented lazy mark/subst propagation \layout Itemize strongly-typed separation between input syntax-objects (regular values + wrapped values) and output parsed-expressions - important \layout Itemize use a trivial naive evaluator for RHS of macro definitions; lowest common denominator, can easily be improved upon \layout Itemize subtlety in marking substitutions \layout Itemize algorithmic refinements \layout Itemize use of SRFI-1 \layout Itemize non-use of syntax-case \layout Standard Roughly 1000 lines of Scheme code for the syntax-case part - not a particularly complex program. Test-cases another 1000 lines. Once correctness achieved, adding better error-checking and features such as ellipsis-escaping and identifier-macros was very simple. \layout Standard Test-driven development a major benefit - without the test suite, development would have been several times slower. Having other implementations for cross-checking obviously also invaluable. psyntax in both sisc and chicken, mzscheme too; hosting this implementation in mzscheme and chicken provided for better testing that using a single underlying scheme implementation. \layout Standard Since syntax-case and syntax are both sugar for constructing syntax-objects, other useful constructs are a good idea: eg syntax->list from mzscheme, raw access to the b&p used by the expander itself, syntax-pair?, syntax-null?, ellipsis? etc etc. \the_end