mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-24 20:30:28 +02:00
Tried compiling more code; augmented the doc.
* module/language/Makefile.am: New. * module/language/scheme/Makefile.am: New. * configure.in: Produce these two new Makefiles. * doc/guile-vm.texi: Documented `compile-file', `compiled-file-name', and `compile-in'. * module/system/base/compile.scm: Cosmetic changes. * module/system/base/language.scm: Likewise. * module/system/il/Makefile.am: Tried (and failed) to compile more things. * module/system/vm/Makefile.am: All source files in here can now be compiled without harming further compilation. * module/system/vm/assemble.scm: Select only specific bindings from `(system vm core)'. (dump-object!): Show a more meaningful error message. * module/system/vm/conv.scm: Select only specific bindings from `(system vm core)'. * module/system/vm/debug.scm: Likewise. * module/system/vm/frame.scm: Changed the header. Use a renamer for `(system vm core)'. * src/guilec.in: Added options, via `getopt-long'. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-6
This commit is contained in:
parent
b6368dbbb9
commit
884d46de23
15 changed files with 220 additions and 66 deletions
|
@ -766,13 +766,32 @@ The use of two separate intermediate languages eases the
|
|||
implementation of front-ends since the gap between high-level
|
||||
languages like Scheme and GHIL is relatively small.
|
||||
|
||||
@findex compile-file
|
||||
@vindex guilec
|
||||
From an end-user viewpoint, compiling a Guile program into bytecode
|
||||
can be done either by using the @command{guilec} command-line tool, or
|
||||
by using the @code{compile-file} procedure exported by the
|
||||
@code{(system base compile)} module.
|
||||
|
||||
@deffn @scmproc{} compile-file file . opts
|
||||
Compile Scheme source code from file @var{file} using compilation
|
||||
options @var{opts}. The resulting file, a Guile object file, will be
|
||||
name according the application of the @code{compiled-file-name}
|
||||
procedure to @var{file}. The possible values for @var{opts} are the
|
||||
same as for the @code{compile-in} procedure (see below, @pxref{The Language
|
||||
Front-Ends}).
|
||||
@end deffn
|
||||
|
||||
@deffn @scmproc{} compiled-file-name file
|
||||
Given source file name @var{file} (a string), return a string that
|
||||
denotes the name of the Guile object file corresponding to
|
||||
@var{file}. By default, the file name returned is @var{file} minus
|
||||
its extension and plus the @code{.go} file extension.
|
||||
@end deffn
|
||||
|
||||
@cindex self-hosting
|
||||
It is worth noting, as you might have already guessed, that Guile-VM's
|
||||
compiler is written in Guile Scheme and is @dfn{self-hosted}: it can
|
||||
compile itself.
|
||||
|
||||
@node The Language Front-Ends, GHIL, Overview, The Compiler
|
||||
@section The Language Front-Ends
|
||||
|
@ -804,6 +823,34 @@ this procedure assumes that language @var{symbol} exists if there
|
|||
exist a @code{(language @var{symbol} spec)} module.
|
||||
@end deffn
|
||||
|
||||
The @code{(system base compile)} module defines a procedure similar to
|
||||
@code{compile-file} but that is not limited to the Scheme language:
|
||||
|
||||
@deffn @scmproc{} compile-in expr env lang . opts
|
||||
Compile expression @var{expr}, which is written in language @var{lang}
|
||||
(a @code{<language>} object), using compilation options @var{opts},
|
||||
and return bytecode as produced by the assembler (@pxref{The
|
||||
Assembler}).
|
||||
|
||||
Options @var{opts} may contain the following keywords:
|
||||
|
||||
@table @code
|
||||
@item :e
|
||||
compilation will stop after the code expansion phase.
|
||||
@item :t
|
||||
compilation will stop after the code translation phase, i.e. after
|
||||
code in the source language @var{lang} has been translated into GHIL
|
||||
(@pxref{GHIL}).
|
||||
@item :c
|
||||
compilation will stop after the compilation phase and before the
|
||||
assembly phase, i.e. once GHIL has been translated into GLIL
|
||||
(@pxref{GLIL}).
|
||||
@end table
|
||||
|
||||
Additionally, @var{opts} may contain any option understood by the
|
||||
GHIL-to-GLIL compiler described in @xref{GLIL}.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node GHIL, GLIL, The Language Front-Ends, The Compiler
|
||||
@section Guile's High-Level Intermediate Language
|
||||
|
@ -874,6 +921,10 @@ instruction sequence. The option list @var{opts} may be either the
|
|||
empty list or a list containing the @code{:O} keyword in which case
|
||||
@code{compile} will first go through an optimization stage of
|
||||
@var{ghil}.
|
||||
|
||||
Note that the @code{:O} option may be passed at a higher-level to the
|
||||
@code{compile-file} and @code{compile-in} procedures (@pxref{The
|
||||
Language Front-Ends}).
|
||||
@end deffn
|
||||
|
||||
@deffn @scmproc{} pprint-glil glil . port
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue