Open akeep opened 7 years ago
How to workaround that problem?
If you wan this syntax, there really isn't a work around for this. You can always add a keyword in the language:
(define-language Lsrc
(terminals
(symbol (s)))
(Expr (e)
s
(list e* ...)))
For instance, will produce the expected language form in all cases:
> (with-output-language (Lsrc Expr) `(list a b c))
#[#{Lsrc:list:Expr.6 dykr8jd2wmthrm6w7m6embc8t-26} 2 (a b c)]
> (with-output-language (Lsrc Expr) `(list))
#[#{Lsrc:list:Expr.6 dykr8jd2wmthrm6w7m6embc8t-26} 2 ()]
@LeifAndersen reported that a nanopass language with a simple list of expressions does not handle creating a list with no elements in it, even though this should be handled without a problem.
@LeifAndersen has a solution in the nanopass/nanopass-framework-racket, however, things have drifted enough that I'll need to adapt the solution a bit.
Here is the example:
But should produce an
Expr
with an empty list in it.