bug-mit-scheme
[Top][All Lists]
Advanced

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

[Bug-mit-scheme] [bug #55200] 9.2 -> 10.1.3/10.1.90 breaks `define-state


From: Arthur A. Gleckler
Subject: [Bug-mit-scheme] [bug #55200] 9.2 -> 10.1.3/10.1.90 breaks `define-state-machine' macro
Date: Mon, 10 Dec 2018 23:13:40 -0500 (EST)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36

URL:
  <https://savannah.gnu.org/bugs/?55200>

                 Summary: 9.2 -> 10.1.3/10.1.90 breaks `define-state-machine'
macro
                 Project: MIT/GNU Scheme
            Submitted by: aag
            Submitted on: Tue 11 Dec 2018 04:13:39 AM UTC
                Category: runtime
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect behavior
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                Keywords: 

    _______________________________________________________

Details:

When I upgraded to 10.1.3, my ancient `define-state-machine` macro broke.  I
get this error when I try to compile the file that defines it:
```
;The object #[syntactic-closure 176 #[syntactic-closure 177 eof]], passed as
an argument to lookup-identifier, is not the correct type.
```
I've pared down the macro and a trivial example of its use as much as possible
to produce a relatively simple reproducible test case.  I've removed lots of
clauses that don't fire, but I get the same result.  Here's the pared-down
code:
```
(define-syntax define-state-machine
  (syntax-rules ()
    ((_ machine
        (end-state ...)
        (start-state . start-transitions)
        (state . transitions)
        ...)
     (define machine
       (letrec-syntax
           ((transform-non-eof-transitions
             (syntax-rules (eof)
               ((_ input ())
                (error condition-type:state-machine-error
                       'message "Unexpected character read."))
               ((_ input ((eof destination) . xitions))
                (_ input xitions))
               ((_ input ((edge destination) . xitions))
                (if (char-set-member? char-set:alphabetic input)
                    (begin
                      (write-char input)
                      (read-char)
                      (destination))
                    (_ input xitions)))))
            (transform-transitions
             (syntax-rules (eof)
               ((_ input xitions ())
                (if (eof-object? input)
                    (error condition-type:state-machine-error
                           'message "Unexpected end of file.")
                    (transform-non-eof-transitions input xitions)))
               ((_ input xitions ((eof destination) . remaining))
                (if (eof-object? input)
                    (destination)
                    (transform-non-eof-transitions input xitions)))
               ((_ input xitions ((edge destination . action) . remaining))
                (_ input xitions remaining)))))
         (letrec ((start-state
                   (lambda ()
                     (let ((input (peek-char)))
                       (transform-transitions input
                                              start-transitions
                                              start-transitions))))
                  (state
                   (lambda ()
                     (let ((input (peek-char)))
                       (transform-transitions input
                                              transitions
                                              transitions))))
                  ...
                  (end-state (lambda () 'end-state))
                  ...)
           start-state))))))

(define-state-machine test-machine (end)
  (start (alphabetic continue))
  (continue (alphabetic continue)
            (eof end)))
```
I've just built at commit `e3e8ca0cb`, and I get the same result.




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55200>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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