r7rs documentation with typing information and search / navigation Arvydas Silanskas (12 Jan 2022 16:47 UTC)
Re: r7rs documentation with typing information and search / navigation Ciprian Craciun (13 Jan 2022 08:39 UTC)

Re: r7rs documentation with typing information and search / navigation Ciprian Craciun 13 Jan 2022 08:38 UTC

On Wed, Jan 12, 2022 at 6:47 PM Arvydas Silanskas
<xxxxxx@gmail.com> wrote:
> And so my question is -- are you aware of any efforts have been done already towards this direction, in particular the type annotations? I'd like to avoid sour duplication of work.

I've done something similar some time ago, that is manually annotating
all r7rs constructs with typing information (plus converting the
textual specification into CommonMark), as part of my own Scheme
interpreter implemented in Rust.

You can find the source of my work at the following link:
=> https://github.com/volution/vonuvoli-scheme/blob/development/documentation/libraries-r7rs.ss

For example `vector-ref` looks like this:
~~~~
(vector-ref
    (type accessor)
    (export scheme:base)
    (signature
        ((vector-not-empty range-offset) -> any))
    (description
        #<<<

            ````
            (vector-ref vector k)
            ````
[...]
~~~~

(The `#<<< >>>#` is an extension syntax that allows me to embed text
in s-expressions, similar to Python's `"""..."""`.)

All these are then ingested, parsed and the outcome looks like this
(first an HTML, second a CommonMark for GitHub):
=> https://vonuvoli.volution.ro/documentation/libraries-html/r7rs/definitions/vector-ref.html#definition__r7rs__vector-ref
=> https://github.com/volution/vonuvoli-scheme/blob/development/documentation/libraries/r7rs/definitions/vector-ref.md#definition__r7rs__vector-ref

You can click on the types and it shows you what other functions take
or output such types, etc.

Unfortunately it's not quite "standard", however there have been quite
some discussions on the mailing list about 3 years ago on the subject.
Also unfortunately I haven't followed up on those developments.

If you are interested in reusing my annotations, let me know and I
could try to export it into something more standard (say standard
S-expressions or JSON.)

Ciprian.