Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion compiler/compactc.ss
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ The following flags, if present, affect the compiler's behavior as follows:

--trace-passes causes the compiler to print tracing information that is
generally useful only to compiler developers.

--run-hook <pathname> loads the Scheme file at <pathname> and calls the
procedure it defines under the name `hook` after every compiler pass, with
the pass's name (a symbol), its unparser, its pretty formats, and the
pass's output values. The file is loaded into the interaction
environment, where the compiler's own libraries, for example (langs) and
(vm), can be imported, so a hook can process the compiler's intermediate
languages in ways the printed representation does not support. The hook
runs in process and sees internal, unversioned compiler structures: a
hook written for one compiler version can need changes for the next.
"))

(usage "<flag> ... <source-pathname> <target-directory-pathname>")
Expand All @@ -100,6 +110,7 @@ The following flags, if present, affect the compiler's behavior as follows:
[(--compact-path) (string search-list)]
[(--trace-search)]
[(--trace-passes)]
[(--run-hook) (string hook-pathname)]
[(--feature-zkir-v3)])
(string source-pathname)
(string target-directory-pathname))
Expand All @@ -113,7 +124,15 @@ The following flags, if present, affect the compiler's behavior as follows:
[trace-search ?--trace-search])
(when source-root (register-source-root! source-root))
(handle-exceptions ?--vscode
(generate-everything source-pathname target-directory-pathname)))]
(generate-everything source-pathname target-directory-pathname
#f
(and ?--run-hook
(begin
(load hook-pathname)
(let ([h (eval 'hook (interaction-environment))])
(unless (procedure? h)
(external-errorf "the file loaded by --run-hook must define a procedure named hook"))
h))))))]
[((flags [(--help) $ (begin (print-help) (exit))]
[(--version) $ (begin (print-compiler-version) (exit))]
[(--language-version) $ (begin (print-language-version) (exit))]
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
(compile-program "obj/compiler/compactc.ss" "obj/compiler/compactc.so")
(compile-program "obj/compiler/format-compact.ss" "obj/compiler/format-compact.so")
(compile-program "obj/compiler/fixup-compact.ss" "obj/compiler/fixup-compact.so")
(compile-whole-program "obj/compiler/compactc.wpo" "obj/compactc")
(compile-whole-program "obj/compiler/compactc.wpo" "obj/compactc" #t)
(compile-whole-program "obj/compiler/format-compact.wpo" "obj/format-compact")
(compile-whole-program "obj/compiler/fixup-compact.wpo" "obj/fixup-compact")
END
Expand Down
Loading