Next: iklib reader bv, Up: iklib reader [Index]
Vicare extends Scheme’s lexical syntax (R6RS Chapter 4) in a variety of ways including:
#!eof.
#!void.
#!would-block.
#!unbound.
#!bwp.
#{gensym}.
#nn=, #nn#.
++, --.
|, which is a standalone vertical bar.
+g and -g, to allow reading
symbols starting with +greek-pi and -greek-pi.
{ ... } are read as (brace ...), brace.
The syntax extensions are made available by default on all input ports,
until the token #!r6rs is read; thus, reading the token
#!r6rs disables all extensions to the lexical syntax on the
specific port, and the token #!vicare enables them again.
When writing code that is intended to be portable across different
Scheme implementations, we should add the token #!r6rs to the top
of every script and library that we write; this allows Vicare
to alert us when using non–portable features. When writing code that’s
intended to be Vicare–specific, we should add the token
#!vicare in order to get an immediate error when the code is run
under other implementations.
The comment #!ikarus is accepted for backwards compatibility with
Ikarus Scheme.
Accept an input port as argument and return a symbol among: r6rs,
vicare. All input ports start under vicare mode and thus
accept Vicare–specific reader extensions. When the token
#!r6rs is read from a port: its mode changes to r6rs.
> (port-mode (current-input-port)) vicare > #!r6rs (port-mode (current-input-port)) r6rs > #!vicare (port-mode (current-input-port)) vicare
Modifiy the lexical syntax accepted by subsequent calls to read
on the input port. The mode is a symbol among r6rs and
vicare. The effect of setting the port mode is similar to that
of reading the token #!r6rs or #!vicare from that port.
> (set-port-mode! (current-input-port) 'r6rs) > (port-mode (current-input-port)) r6rs
Next: iklib reader bv, Up: iklib reader [Index]