* [PATCH] module: Add some docstrings to (system base compile).
@ 2023-11-10 3:45 Maxim Cournoyer
0 siblings, 0 replies; only message in thread
From: Maxim Cournoyer @ 2023-11-10 3:45 UTC (permalink / raw)
To: guile-devel; +Cc: Maxim Cournoyer
* 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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-10 3:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-10 3:45 [PATCH] module: Add some docstrings to (system base compile) Maxim Cournoyer
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).