Commit Graph

133 Commits

Author SHA1 Message Date
Abdulaziz Ghuloum 858198b886 fixed a bug in using a precompiled variable transformers. 2009-10-16 09:54:14 +03:00
Abdulaziz Ghuloum 4df1dcb25a attempting to reference/modify unexportable bindings was crashing
the expander instead of raising a proper error.  fixed.
2009-08-01 22:18:26 +03:00
Abdulaziz Ghuloum cdea4e0942 added define-fluid-syntax and fixed fluid-let-syntax. 2009-07-28 22:12:48 +03:00
Abdulaziz Ghuloum acbd00c356 fixed a bug in expanding macros in definition context where the
scope would get messed up when the macro call appears inside
let/letrec-syntax.  Basically, in the following example,

(let-syntax ([id-macro (syntax-rules () [(_ x) x])])
  (let () 
    (define (foo) (display "not ok\n")) 
    (let-syntax ([foo (syntax-rules () [(_) (display "ok\n")])])
      (id-macro (foo)))))

the call to (id-macro) would make (foo) refer to the foo in the
internal-definition context (the not ok one) instead of the
let-syntax one.

On the plus side, macro expansion is now half a second faster!
2009-07-06 12:14:08 +03:00
Abdulaziz Ghuloum 471921fcc7 NEW: ikarus --r6rs-repl <script-name>
runs the script according to the R6RS semantics, then starts a
  repl in an interaction environment made of everything visible
  (imported and defined) in the script.

  Use cases include:
  * debugging a script.
  * starting ikarus in some predefined environment, e.g., 
       $ ikarus --r6rs-repl rnrs.ss
    where rnrs.ss contains (import (rnrs))

  Also, interaction-environment is made a parameter with an initial
  value set prior to entering the repl.
2009-05-31 13:32:33 +03:00
Abdulaziz Ghuloum f13876d385 - removed include and include-into from (ikarus) library
- moved include and include/lexical-context to their own 
  (ikarus include) library (source only, not in boot image).
2009-05-30 08:14:09 +03:00
Abdulaziz Ghuloum 2653cedee1 expand changed:
- it now takes an optional environment (it was required)
  - it no longer returns a second value (list of libraries)
  - it's output is "pretty".

the old expand is now called core-expand.
2009-05-30 05:16:04 +03:00
Abdulaziz Ghuloum 24ece86772 - Added stale-when:
syntax:  (stale-when guard-expr e* ...)   ;; in definition context
            (stale-when guard-expr e e* ...) ;; in expression context

   semantics:
     When a stale-when form is encountered while expanding any code
     (expressions, macros, macros in macros, etc.) in a library
     body, the guard-expr is expanded (but not evaluated) and
     serialized along with the library.  When the library is later
     reloaded from fasl and before it is installed, the guard-expr
     is evaluated.  If guard-expr returns true, the fasl content is
     ignored and the library is recompiled afresh from source.
2009-05-28 09:02:47 +03:00
Abdulaziz Ghuloum ec76547da0 - procedures made with defun-style definitions now have proper
source annotation (pointing to the identifier that's the name of
  the procedure, instead of the define keyword itself).
2009-05-24 12:34:39 +03:00
Abdulaziz Ghuloum a489f169ee - added trace-let 2009-05-18 11:14:17 +03:00
Abdulaziz Ghuloum fda2817a73 - ikarus interpreter (in lab directory) is now capable of
bootstrapping ikarus
2009-05-14 10:18:45 +03:00
Abdulaziz Ghuloum 3207e14fca - psyntax now produces
`(annotated-call ,annotation ,rator ,rands ...)
   form for cases when there is an annotation attached to the procedure
   call.  The compiler just stripps it out and makes no use of it.
2009-05-14 09:52:05 +03:00
Abdulaziz Ghuloum 5b2fca49e6 fixed bug in expansion of expressions in interaction environment
where id->label was prematurely interning identifiers in the
environment.  Now, there is id->label/intern that does that and it's
only used when an identifier's type is resolved and not at other
times (like in free-id=? and bount-id=?).
2009-04-27 09:59:23 +03:00
Abdulaziz Ghuloum bcff57fa52 fixed a bug in internal definitions of with-syntax (again). 2009-04-07 02:33:09 +03:00
Abdulaziz Ghuloum 65dc2bc40d trace-define now does not raise an error when given a non-procedure 2009-04-06 17:21:56 +03:00
Abdulaziz Ghuloum 0c96321f20 fixed definitions of last clauses in cond and case macros. 2009-04-06 16:36:07 +03:00
Abdulaziz Ghuloum af46220d64 fixed definition of with-syntax to allow internal definitions. 2009-04-06 16:30:23 +03:00
Abdulaziz Ghuloum 7b60ec46a9 Non-system procedures now print with source-position. E.g.,
you now get #<procedure foo [nnn of file.ss]> or
#<procedure [nnn of file.ss]>  instead of plain #<procedure foo>
or #<procedure>.
2009-03-30 12:28:30 +03:00
Abdulaziz Ghuloum 5946459630 fixed bug in guard (now allowing definitions and expressions in <body>) 2009-01-02 17:55:01 -05:00
Abdulaziz Ghuloum ce4dc64e0d made public source-position conditions and load-r6rs-script. 2008-12-27 00:36:13 -05:00
Abdulaziz Ghuloum 2be7d93637 - Added (syntax-transpose syntax-object base-id new-id-object).
It returns syntax-object wrapped with the marks and substitutions
  that have been added to new-id since its introduction as base-id.
  The new-id and base-id should be free-identifier=? and new-id
  should have the same (or more) marks as base-id.
2008-12-25 16:33:50 -05:00
Abdulaziz Ghuloum fda6a1a2a6 - fixed printer of syntax annotations which was printing
source info as #<syntax --- (char --- of ---)> instead
  of             #<syntax --- [char --- of ---]>.
2008-11-15 13:26:23 -05:00
Abdulaziz Ghuloum fc80aaae37 - added the ability to inject arbitrary compile time values using:
(define-syntax foo (make-compile-time-value <expr>))
  The value can be retrieved using curried macro transformers.
  E.g.,
     (let-syntax ([idval
                   (lambda (x)
                     (syntax-case x ()
                       [(_ id)
                        (lambda (rho)
                          (with-syntax ([val (datum->syntax #'here (rho #'id))])
                            #''val))]))])
       (let-syntax ([ctval (make-compile-time-value 'foo)])
         (list (idval ctval) (idval others))))
     ;=> (foo #f)
2008-11-14 04:32:08 -05:00
Abdulaziz Ghuloum c7d68432e3 - implemented uninstall-library. 2008-11-11 14:47:35 -05:00
Abdulaziz Ghuloum 359aa1d2c9 - fixed errors where multiple internal definitions were silently
allowed if typed in the repl.
- added some tests for the interaction environment.
2008-10-31 16:22:25 -04:00
Abdulaziz Ghuloum f570ea8c2a - interface between write/display and custom struct writers is
changed in order to allow large structures (e.g., libraries,
  syntax objects, etc.) to print efficiently.  This is done by only
  traversing the parts of the structure that will actually be
  printed, rather than traversing the whole data structure (which is
  what write/display used to do).  Pretty-print should be fixed in a
  similar manner (TODO).
2008-10-15 07:44:06 -04:00
Abdulaziz Ghuloum afa61cc1a7 - synching scheme/psyntax.*.ss from the psyntax distribution. 2008-10-13 17:33:25 -04:00
Abdulaziz Ghuloum 06fd988a17 C callbacks now reach the C point where they should make the call
back into Scheme land.
2008-09-20 01:58:57 -04:00
Abdulaziz Ghuloum 30cd6a2de8 made environment-symbols work on the interaction-environment. 2008-09-10 11:02:42 -07:00
Abdulaziz Ghuloum 0b017898a8 - minor change to how export (with renaming) is parsed. When you
rename from-name to to-name, the from-name is now treated as an
  identifier while the to-name is treated as a symbol.
2008-09-10 08:17:18 -07:00
Abdulaziz Ghuloum fcef21c693 - Added (environment-symbols <env>) which returns a list of symbols
exported by the environment.  Try 
  > (environment-symbols (environment '(rnrs)))

- Added an internal export mechanism so that identifiers can be
  exported from within a library.  The syntax is the same:
    (export export-spec* ...) 
  when appears in a library's top level, adds the export specs to
  the set of exported identifiers.  So, one can do:
    (library (A) 
      (export)
      (import (ikarus))
      (export a)
      (define a 17))
  When appearing in non-library definition context, the export form
  is ignored.
2008-09-10 06:35:18 -07:00
Abdulaziz Ghuloum 814c797633 - removed bset/h instruction from the compiler (it was rarely used
and not implemented 100% correctly)
- fixed parameterize to allow (parameterize () def ... exp exp ...)
2008-09-06 04:17:20 -07:00
Abdulaziz Ghuloum b9085e15da - more work on trig functions
- mkstx now checks that double wraps are not merged incorrectly
2008-08-12 01:17:04 -07:00
Abdulaziz Ghuloum 2b4e89bcf0 - fixed a minor import subversion bug.
- added 2-argument version of fllog.
2008-08-04 16:44:24 -07:00
Abdulaziz Ghuloum 0da4e99a12 simplified when, unless, and case macros and added better handler
for (if (not e) e e).
2008-08-02 11:09:22 -07:00
Abdulaziz Ghuloum 39e84d1395 simplified parameterize macro. 2008-08-02 10:11:04 -07:00
Abdulaziz Ghuloum 959082d12d assert now gives source information when available. 2008-07-29 11:04:52 -07:00
Abdulaziz Ghuloum 4ee88498a9 fixes quasisyntax bugs, making them more conforming to the r6rs test
suite.
2008-07-26 14:11:22 -07:00
Abdulaziz Ghuloum 3b80d4f321 fixed a bug in quotient and div when given (least-fixnum) and -1. 2008-07-26 12:28:51 -07:00
Abdulaziz Ghuloum 7db56cf76e - bytevector-ieee-[single|double]-[ref|set!] now accept unaligned
indices (r6rs requirement).
- file-options are now represented as enum-sets (r6rs requirement)
- odd?, even?, lcm, remainder, etc., now accept inexact integers.
2008-07-24 18:58:53 -07:00
Abdulaziz Ghuloum 59b9d28001 guard expressions now re-raise unhandled conditions using
raise-continuable (as per the R6RS errata page, part 7.1)
2008-07-20 02:51:14 -07:00
Abdulaziz Ghuloum a9657c4642 define-record-type now understands parent-rtd (used to ignore it). 2008-07-13 11:25:46 -07:00
Abdulaziz Ghuloum eccca7f4ea - Added trace-let-syntax, trace-letrec-syntax, as well as fixed
trace-define-syntax to handle variable transformers.

- added primops for fx comparison functions.
2008-07-11 22:31:40 -07:00
Abdulaziz Ghuloum 2c8cb7dda2 fixed a bug in matching library subversion in psyntax. 2008-06-28 03:16:21 -07:00
Abdulaziz Ghuloum 45346ef865 - Added cp0! including:
- (optimize-level [0,1,2])  and  ikarus -O[0,1,2]
       where -O0 = no optimizations
             -O1 = using old optimizer
             -O2 = using the new cp0 optimizer
       defaults to -O1 for now.
   - (cp0-size-limit n) which is the limit of the residual size for
     each inlining attempt
   - (cp0-effort-limit n) which is the limit on the effort expended 
     for each inlining attempt
   
- Rewrote the syntax-match macro to make use of the same technology
  used in syntax-case itself resulting in reduced code size.

- Added (system-value <symbol>) which returns the system value.
  E.g., (system-value 'car) => #<procedure car>
  This is pretty much the same as 
    (eval <symbol> (environment '(ikarus)))
  except that it does not involve compiling the expression or 
  consulting the library/expander systems.

- Fixed the fasl loader to make it understand complex numbers.
2008-06-28 02:25:44 -07:00
Abdulaziz Ghuloum 0939370a07 suppressing printing of file names during bootstrap. 2008-06-10 13:21:00 -07:00
Abdulaziz Ghuloum fe1f7077ff fixed minor bug in syntax-case where the wraps and marks of
top-marked wrapped syntax objects were incorrectly combined.
E.g., it used to be that:

  (syntax-case (datum->syntax #'foo #'(x y)) ()
    [(x y) 'shouldntmatch] [_ 'ok])

yields shouldntmatch; it's now ok.
2008-06-10 12:35:56 -07:00
Abdulaziz Ghuloum 6741ac2817 better error message when a library file "foo.ss" does not contain
the expected library name (foo).
2008-06-05 00:58:04 -07:00
Abdulaziz Ghuloum 71640d11bf Fixed a problem with forward references in the repl which used to
get a location different from the one assigned when the variable is
defined.
2008-05-15 06:40:07 -07:00
Abdulaziz Ghuloum f8b0e949d9 - syntax-case now raises a syntax violation when _ appears in the
literals
- syntax-rules points to the invalid literal when raising an
  exception.
2008-05-10 19:05:40 -04:00