21. Bigloo -- DSSSL support

21. Bigloo -- DSSSL support

Browsing

Home: Bigloo
A ``practical Scheme compiler''
for Bigloo version 2.5b
September 2002

Previous chapter: SRFIs
Next chapter: Compiler description
DSSSL support

21.1 DSSSL formal argument lists
21.2 Modules and DSSSL formal argument lists
Chapters

Copyright
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
Bigloo supports extensions for the Dsssl expression language [Dsssl96]:

  • Keywords. Bigloo supports full Dsssl keywords.
  • Named constants. Bigloo implements the three Dsssl named constants: #!optional, #!rest and #!key.
  • Dsssl formal argument lists.
21.1 DSSSL formal argument lists

Dsssl formal argument lists are defined by the following grammar:

<formal-argument-list> ==> <required-formal-argument>*
  [(#!optional <optional-formal-argument>*)]
  [(#!rest <rest-formal-argument>)]
  [(#!key <key-formal-argument>*)]
<required-formal-argument> ==> <ident>
<optional-formal-argument> ==> <ident>
     | (<ident> <initializer>)
<rest-formal-argument> ==> <ident>
<key-formal-argument> ==> <ident>
     | (<ident> <initializer>)
<initializer> ==> <expr>
When a procedure is applied to a list of actual arguments, the formal and actual arguments are processed from left to right as follows:



It shall be an error for an <ident> to appear more than once in a formal-argument-list.

Example:

((lambda (x y) x) 3 4 5 6)   =>(3 4 5 6)
((lambda (x y #!rest z) z)
 3 4 5 6)                    => (5 6)
((lambda (x y #!optional z #!rest r #!key i (j 1)) 
    (list x y z i: i j: j))
 3 4 5 i: 6 i: 7)            => (3 4 5 i: 6 j: 1)
21.2 Modules and DSSSL formal argument lists

Functions using Dsssl formal argument lists can be exported or imported in the same way as all regular Bigloo functions. When exporting such a Dsssl function, the named constants must be included in the prototype of the function but the formal parameters are not required. That is, for instance, the exportation prototype for the function:

(define (foo x y #!optional z #!key i (j 1)) ...)
looks like:

(export (foo x y #!optional #!key))




This
Scribe page has been generated by scribeinfo.
Last update Fri Sep 6 09:59:09 2002