https://github.com/mu-semtech/sparql-parser contains an EBNF parser for SPARQL, an LL(1) language. You might be able to borrow code, not sure how well it translates to scheme. GitHub asked me to log in to see the gist so I’d have to have a peek later.
sparql-ast folder contains the relevant bits regarding the parsing.
I write my notes in org-mode. It’s supported in many editors in a basic form, letting you add code snippets etc in an unobtrusive way. Using a well thought out format helps you in the long run.
I use this in Emacs, through which it lets me refer to emails, execute code snippets, attach related files, fetch content on/from remote servers, send off the debug session as an html email, … Support will depend on your editor but even as raw text it works.
I don’t use something specific to make non-code repeatable as you suggest here, but you could embed a test language in an org code block.
The syntax is straight-forward and exports to multiple external formats exist (eg: html).