Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Framework cannot handle languages with simple list of terminals #10

Open
akeep opened this issue Dec 26, 2016 · 2 comments
Open

Framework cannot handle languages with simple list of terminals #10

akeep opened this issue Dec 26, 2016 · 2 comments
Assignees
Labels

Comments

@akeep
Copy link
Member

akeep commented Dec 26, 2016

@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:

(define-language Lsrc 
  (terminals
    (symbol (s))) 
  (Expr (e) 
    s
    (e* ...)))
(with-output-language (Lsrc Expr) `()) => '()

But should produce an Expr with an empty list in it.

@akeep akeep self-assigned this Dec 26, 2016
@akeep akeep added the bug label Dec 26, 2016
@amirouche
Copy link

How to workaround that problem?

@akeep
Copy link
Member Author

akeep commented Jul 28, 2019

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 ()]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants