I find: #lang racket (require redex) (define-language jk (t n (n + t) (n + n + t) (n + n + n + t)) (n number)) (redex-match? jk t 1) ; -> #t (redex-match? jk t (term (+ 1 1))) ; -> #f (redex-match? jk t (term (+ 1 1 1))) ; -> #f (redex-match? jk t (term (1 + 2))) ; ->#t This makes sense to me. Thanks again, Jos
_____ From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On Behalf Of Matthias Felleisen Sent: sábado, 25 de abril de 2015 19:38 To: Jos Koot Cc: racket-users@googlegroups.com Subject: Re: [racket-users] define-language, trouble with parentheses. Redex's term-language is about defining __abstract__ syntax not concrete syntax. For the former, the tricks of concrete syntax don't matter. So let's think, how would you generalize #lang racket (require redex) (define-language jk (t n (n + t) (n + n + t) (n + n + n + t)) (n number)) (redex-match? jk t 1) (redex-match? jk t (+ 1 1)) (redex-match? jk t (+ 1 1 1)) with the tools you have in Redex? -- Matthias On Apr 24, 2015, at 5:30 PM, Jos Koot wrote: I have trouble translating the following into a define-language form: term ::= number term ::= number + term An attempt like: (define-language my-language (term number (number + term)) does not work. It accepts (1 + (2 + 3)) and ((1 + 2) +3) but not (1 + 2 + 3). May be there already is a method to do something like: (define-language my-language (term number (number + ,@term-list)) (term-list (term))) or (define-languafe my-language (term (number + number ... ...))) where the first ... refers to + and the second one to number, alternating of course. If something like the above two above already is possible in some way, please direct me to the related parts of the docs. If not, would it be a great efffort to allow ,@ or ... ... in a language-definition-clause? If not too big an effort may be I could try to implement it, but I warn you, I would need much guidance. Thanks, Jos -- 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. -- 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. -- 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.