[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Document formatting in Scheme
Noel, pls read up on C#'s connection to XML. I would consider
writing a set of macros that allow me to write down HtDP contracts
in an x-expression format so that I can extract them later on
and type set them in xhtml.
So something like this might work:
(function
([name "f"])
(domain ([argument "x"]) (listof Number) (fun Number -> String))
(range (listof String))
(comment "f maps a list of numbers to a list of strings")
(contract (andmap (lambda (x) (> x 0)) x))
(effect "f also prints the numbers to stdout"))
(define (f x) ...)
For the above, you could define macros (syntax-case) and you can mix
and match real Scheme types and code so that the macro can actually
generate annotations if appropriate. Indeed, the elaborated code
could be used as an annotations by Spidey ('s successor) to compute
value flow and to check comments against code.
Part of the problem is to scale it to all of MzScheme's basic facilities,
but with modules we should be able to equip "syntax" modules with
appropriate extensions to the tag language.
You may also consider macros that generate additional user tags for
X-expressions (i.e. tags with meaning).
-- Matthias