23. Bigloo -- User Extensions

Browsing
Home: | Bigloo A ``practical Scheme compiler'' User manual for version 2.6b December 2003
Previous chapter: | Compiler description
Next chapter: | Bigloo Development Environment
User Extensions
23.1 | User pass
Chapters
| Acknowledgements
1. | Table of contents
2. | Overview of Bigloo
3. | Modules
4. | Core Language
5. | Standard Library
6. | Pattern Matching
7. | Object System
8. | Threads
9. | Regular parsing
10. | Lalr(1) parsing
11. | Errors and Assertions
12. | Eval and code interpretation
13. | Macro expansion
14. | Command Line Parsing
15. | Explicit typing
16. | The C interface
17. | The Java interface
18. | Bigloo Libraries
19. | Extending the Runtime System
20. | SRFIs
21. | DSSSL support
22. | Compiler description
23. | User Extensions
24. | Bigloo Development Environment
25. | Global Index
26. | Library Index
| Bibliography
| The extension package system allows the language compiled by Bigloo to be extended and this is achieved by associating an extension file with a suffix. The extension file is loaded at the beginning of a compilation and it can do three things: call extern programs (unix programs); define macros; modify the values of some of the compiler's variables (for example, the list of the libraries to be linked with). The Bigloo's initializing procedure is the following: If it exists, Bigloo loads the runtime-command file, see Section Compiler Description. It then parses the command line to find the source file to compile. It extracts the source file suffix and looks it up in its `*auto-mode*` variable. If the suffix is found, the associated file is loaded. This file could contain a function named `*extend-entry*` which must accept a list as argument. It is invoked with the Bigloo's unparsed arguments. The result of the `*extend-entry*` application has to be a regular list of arguments and these are parsed by Bigloo. For now, two extension packages exist: the Meroon package which is a native version of the Christian Queinnec object language; the Camloo [SerranoWeis94] package which is a front end compiler for the Caml language [Caml-light] Furthermore, Bigloo supports the `-extend` option which forces the usage of an extension file. When Bigloo encounters this option, it immediately loads the extension file, invoking the function `*extend-entry*` with the list of arguments which have not been parsed yet. The extension files are always sought in the directory containing the Bigloo's libraries.
23.1 User pass
Bigloo allows the user to add a special pass to the regular compilation, this pass taking place before macro expansion. There are two ways to add a user pass. Add a compiled pass: The module `user_user` (in the ``comptime/User/user.scm'' file) is the user entry pass point. To add a compiled pass, put the code of the pass in this directory, import your new modules in `user_user` and modify the `user-walk` function. Add an interpreted pass: Set the value of `*user-pass*`, which has to be a unary function, in your `.bigloorc` file and Bigloo will invoke it with the code as argument.

This Scribe page has been generated by `scribeinfo`.
Last update Tue Dec 16 13:46:41 2003