unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: guile-devel@gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: [PATCH] module: Add some docstrings to (system base compile).
Date: Thu,  9 Nov 2023 22:45:11 -0500	[thread overview]
Message-ID: <20231110034516.30872-1-maxim.cournoyer@gmail.com> (raw)

* module/system/base/compile.scm (next-pass): Add doc.
(compute-compiler, read-and-compile, compile): Likewise.
---

 module/system/base/compile.scm | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/module/system/base/compile.scm b/module/system/base/compile.scm
index a33d012bd..f5915401e 100644
--- a/module/system/base/compile.scm
+++ b/module/system/base/compile.scm
@@ -232,6 +232,9 @@
     (proc (proc optimization-level opts))))
 
 (define (next-pass from lang to optimization-level opts)
+  "Return a pair containing the next target language name and its
+associated compilation procedure (pass) required to compile LANG from
+FROM to TO."
   (if (eq? lang to)
       #f ;; Done.
       (match (language-compilers lang)
@@ -248,6 +251,11 @@
               (cons (lookup-language name) pass))))))))
 
 (define (compute-compiler from to optimization-level warning-level opts)
+  "Return a procedure accepting an EXP and ENV arguments that lookup and
+invoke the necessary compiler(s) to compile EXP from FROM to TO.  The
+returned procedure returns the compiled expression (exp), the
+environment (env) as well as a continuation environment (cenv) as
+multiple values."
   (let ((from (ensure-language from))
         (to (ensure-language to)))
     (let lp ((lang from))
@@ -302,6 +310,8 @@
                            (optimization-level (default-optimization-level))
                            (warning-level (default-warning-level))
                            (opts '()))
+  "Return the compiled bytevector (or the format of the chosen TO target
+language) of the source read from PORT."
   (let* ((from (ensure-language from))
          (to (ensure-language to))
          (joint (find-language-joint from to optimization-level opts)))
@@ -346,6 +356,7 @@
                   (optimization-level (default-optimization-level))
                   (warning-level (default-warning-level))
                   (opts '()))
+  "Return the compiled bytecode of X, an expression."
   (validate-options opts)
   (let ((compile1 (compute-compiler from to optimization-level
                                     warning-level opts)))

base-commit: 75cd95060fb1ea7586f0e4b9081694c6d61f1d3b
-- 
2.41.0




                 reply	other threads:[~2023-11-10  3:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231110034516.30872-1-maxim.cournoyer@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).