[Top][All Lists]

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

Re: how to implement mutual recursive parsers in syntax-parse

From: Stefan Israelsson Tampe
Subject: Re: how to implement mutual recursive parsers in syntax-parse
Date: Sat, 19 May 2012 00:05:43 +0200

Another clue,

Put this into a file and load it

 (define (f x) (c))
 (define-syntax c (lambda (x) (pk 'c) #t))

,x f shows

   0    (assert-nargs-ee/locals 1)      ;; 1 arg, 0 locals
   2    (toplevel-ref 1)                ;; #<syntax-transformer c>
   4    (tail-call 0)                                         at examples/mutual.scm:9:14

and (f 1) yields

scheme@(guile-user) [4]> (f 1)
ERROR: In procedure #<syntax-transformer c>:
ERROR: Wrong type to apply: #<syntax-transformer c>

This is confusing!!


On Tue, May 15, 2012 at 8:38 PM, Andy Wingo <address@hidden> wrote:
On Mon 14 May 2012 21:13, Stefan Israelsson Tampe <address@hidden> writes:

> (begin
>    (define parser-a code-a ...)
>    (define-syntax a spec-a))
> (begin
>    (define parser-b code-b ...)
>    (define-syntax b spec-b))
> In racket they manage to evaluate the define-syntax forms before the define-forms cause in the expansion
> of code-a amd code-b they need the spec's spec-a and spec-b.
> Do you have any ideas how solve this. I do have a fix for problem but it is not easy to use.

Have you tried master?  If I understand you correctly I think it should
work there.


reply via email to

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