guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Guile SREP 0.0


From: Keisuke Nishida
Subject: Guile SREP 0.0
Date: Sun, 11 Feb 2001 01:09:42 -0500
User-agent: Wanderlust/2.4.0 (Rio) SEMI/1.13.7 (Awazu) FLIM/1.13.2 (Kasanui) Emacs/21.0.96 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI)

Hello,

This is a demonstration release of my new Guile SREP (Smart
Read-Eval-Print loop) system.  Let's see what can you do with it.

Start the system:

  ----------------------------------------
  % guile
  guile> (use-modules (system srep))
  guile> (start-srep 'scheme)
  Guile Scheme interpreter 1.0 on Guile 1.4.1
  Copyright (C) 2001 Free Software Foundation, Inc.
  
  Enter `,help' for help.
  address@hidden> 
  ----------------------------------------

You can execute Scheme expressions as before:
(Value history is not working yet.)

  ----------------------------------------
  address@hidden> 1
  $1 = 1
  address@hidden> (define foo 2)
  address@hidden> foo
  $2 = 2
  ----------------------------------------

What's new is "meta command".  Try `,help':

  ----------------------------------------
  address@hidden> ,help
  Guile SREP 0.0 on Guile 1.4.1

  Enter `,helpdeck' to get started.

  Help Commands [shortcut]:

   ,help [TOPIC]               [,h] - Show help messages
   ,helpdesk                   [,H] - Open Helpdesk
   ,apropos REGEXP             [,a] - Find matched bindings
   ,describe OBJ               [,d] - [X] Show description/documentation
   ,option [OPTION [VALUE]]    [,o] - [X] List/show/set options
   ,quit                       [,q] - Quit the repl

  Help Topics:

   ,help all                 [,h a] - List all commands
   ,help module              [,h m] - List module commands
   ,help debug               [,h d] - List debug commands
   ,help system              [,h s] - List system commands

  address@hidden> 
  ----------------------------------------

You can abbreviate meta commands by `shortcuts':

  ----------------------------------------
  address@hidden> ,h a
  Help Commands [shortcut]:

   ,help [TOPIC]               [,h] - Show help messages
   ,helpdesk                   [,H] - Open Helpdesk
   ,apropos REGEXP             [,a] - Find matched bindings
   ,describe OBJ               [,d] - [X] Show description/documentation
   ,option [OPTION [VALUE]]    [,o] - [X] List/show/set options
   ,quit                       [,q] - Quit the repl

  Module Commands [shortcut]:

   ,module [MODULE]            [,m] - Change modules (default: user)
   ,use [MODULE ...]           [,u] - Use modules / List those in use
   ,list [PACKAGE]             [,l] - List available packages/modules
   ,find REGEXP                [,f] - Find packages/modules
   ,binding                    [,b] - [X] List current bindings

  Language Commands [shortcut]:

   ,language LANGUAGE          [,L] - [X] Change languages

  Compile Commands [shortcut]:

   ,expand FORM                     - [X] Syntax expansion
   ,translate FORM                  - [X] Translate into GCIL
   ,compile FORM                    - [X] Compile into assembly
   ,disassemble PROGRAM             - [X] Disassemble a program

  Debug Commands [shortcut]:

   ,time FORM                       - Time execution
   ,profile FORM                    - [X] Profile execution
   ,trace [-a] FORM                 - [X] Trace execution
   ,step FORM                       - [X] Step execution

  System Commands [shortcut]:

   ,gc                              - Garbage collection
   ,history                         - [X] Show value history
   ,clear                           - [X] Clear value history

  address@hidden> 
  ----------------------------------------

Meta commands allows you smart operations, such as the following
apropos command:

  ----------------------------------------
  address@hidden> ,a file.*\?
  (guile): file-is-directory?   #<procedure file-is-directory? (str)>
  (guile): file-exists? #<procedure file-exists? (str)>
  (guile): file-port?   #<primitive-procedure file-port?>
  ----------------------------------------

You can change working modules by command `module' (or `m'):

  ----------------------------------------
  address@hidden> ,m (oop goops)
  address@hidden> ,m
  address@hidden> 
  ----------------------------------------

Fortunately, `module' is smart enough to help you type less:

  ----------------------------------------
  address@hidden> ,m goo
  (oop goops)
  address@hidden> ,m file
  Possible modules:
  (slib ppfile)
  (slib tzfile)
  (slib withfile)
  address@hidden> 
  ----------------------------------------

Command `use' (or `u') can be used to use a module.
Without any argument, it lists the modules in use:

  ----------------------------------------
  address@hidden> ,u session
  (ice-9 session)
  address@hidden> ,u
  (ice-9 session)
  (oop goops goopscore)
  (oop goops util)
  (oop goops dispatch)
  (oop goops compile)
  (guile)
  ----------------------------------------

Command `find' (or `f') can be used to find modules:

  ----------------------------------------
  address@hidden> ,f file
  (slib ppfile)
  (slib tzfile)
  (slib withfile)
  ----------------------------------------

There are further commands that might be helpful:

  ----------------------------------------
  address@hidden> (define (fib n) (if (< n 2) 1 (+ (fib (- n 1)) (fib (- n 
2)))))
  address@hidden> ,time (fib 25)
  121393
  clock utime stime cutime cstime gc
  2.28  2.27  0.01  0      0      1.29
  ----------------------------------------

  ----------------------------------------
  address@hidden> ,gc
  Cumulative GC times:   45

  Current heap size:      85104 /  208896 cells
  Current malloc size:   283548 /  399015 bytes
  Cells marked/swept:   3104588 / 7119120 cells

  GC time taken:           diff / total
                    mark   0.79 / 1.03 s
                    sweep  0.84 / 1.04 s
                    total  1.63 / 2.07 s
  address@hidden> (fib 25)
  $3 = 121393
  address@hidden> ,gc
  Cumulative GC times:   68

  Current heap size:      84827 /  208896 cells
  Current malloc size:   283559 /  399015 bytes
  Cells marked/swept:   5037823 /11903672 cells

  GC time taken:           diff / total
                    mark   0.65 / 1.68 s
                    sweep  0.69 / 1.73 s
                    total  1.34 / 3.41 s
  address@hidden> 
  ----------------------------------------

That's it for now.  Want to try it?  Use the latest Guile from
the CVS repository and the following package.

  http://home.cwru.edu/~kxn30/srep-0.0.tar.gz

More stuff will come later with my Guile VM implementation.

I'd appreciate any improvement ideas.

Thanks,
Keisuke Nishida



reply via email to

[Prev in Thread] Current Thread [Next in Thread]