guile-devel
[Top][All Lists]
Advanced

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

how to implement mutual recursive parsers in syntax-parse


From: Stefan Israelsson Tampe
Subject: how to implement mutual recursive parsers in syntax-parse
Date: Mon, 14 May 2012 21:13:11 +0200

I do have a cludgy fix for this but are in search for a better solution.

consider the problem:

(define-syntax-class a (pattern (1 x:b)) (pattern ()))
(define-syntax-class b (pattern (2 x:a)) (pattern ()))

the syntax class definitions above would expand to something like

(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.

/Stefan


reply via email to

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