I'm bumbling through my first attempts at creating a language in Racket and 
am currently stuck debugging an error in expansion. I have a macro in my 
expander that works fine until I try to run the language.

Here's what the macro stepper in DrRacket gives me:
 
[Error]


line: bad syntax
(line (offset 0) (type (string8 "string")) (test (strtest "MZ")))


while executing macro transformer in:
(module magic-mod "expander.rkt"
  (#%module-begin
   (module configure-runtime '#%kernel
     (#%module-begin (#%require racket/runtime-config) (#%app configure '
#f)))
   (#%app call-with-values (lambda () (quote #f)) print-values)
   (#%app call-with-values (lambda () (quote #f)) print-values)
   (#%app
    call-with-values
    (lambda ()
      (#%app
       (line (offset 0) (type (string8 "string")) (test (strtest "MZ")))
       (level
        (line
         (offset 24)
         (type (numeric "leshort"))
         (test (numtest "<" 64))
         (message "MZ executable (MS-DOS)"))
        (line (offset 24) (type (numeric "leshort")) (test (numtest ">" 63
)))
        (level
         (line
          (offset (indoff 60 (size (lelong ".l"))))
          (type (string8 "string"))
          (test (strtest "PE\\0\\0"))
          (message "PE executable (MS-Windows)"))
         (line
          (offset (indoff 60 (size (lelong ".l"))))
          (type (string8 "string"))
          (test (strtest "LX\\0\\0"))
          (message "LX executable (OS/2)"))))))
    print-values)))



The macro line should expand to:

(magic-test (offset 0) (type '(string8 "string") '(strtest "MZ")) (compare 
'(strtest 
"MZ")))

And this works fine when run it from my expander.rkt.

Here's the file I'm actually executing when I get the error:
#lang reader "reader.rkt"


# MS Windows executables are also valid MS-DOS executables
0           string  MZ
>0x18       leshort <0x40   MZ executable (MS-DOS)
#>>(4.s*512) leshort 0x014c  COFF executable (MS-DOS, DJGPP)
#>>(4.s*512) leshort !0x014c MZ executable (MS-DOS)
# skip the whole block below if it is not an extended executable
>0x18       leshort >0x3f
>>(0x3c.l)  string  PE\0\0  PE executable (MS-Windows)
>>(0x3c.l)  string  LX\0\0  LX executable (OS/2)

I know that the procedure application will eventually fail because 
magic-test doesn't return a function. This code is a work in progress. I 
just want to know if the reading/expansion is working properly. I feel like 
I'm probably just missing something basic.

Thanks for any help,
-- Jonathan

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to