nanopass-framework-racket
nanopass-framework-racket copied to clipboard
nanopass-case producing unexpected error
(originally submitted over email to the nanopass-framework mailing list by Axel Søgaard)
The following programs compiles without errors:
lang nanopass
(define variable? symbol?)
(define-language LFE
(entry TopLevelForm)
(terminals
(variable (x xd)))
(Formals (f) x)
(TopLevelForm (t) g)
(GeneralTopLevelForm (g) e)
(Expr (e) x))
(define-language LFE2 (extends LFE) (Abstraction (ab) (+ (λ f e) => (λ f e))) (Expr (e) (+ ab)))
(define-language LANF (extends LFE2) (AExpr (ae) (+ x ab)) (CExpr (ce) (+ ae)) (Expr (e) (+ ae ce)))
However, if I add the following expression, I get an error:
(λ() (nanopass-case (LANF Expr) 43 [else 4]))
The (internal) compile time error I get is:
Dropbox/GitHub/nanopass-framework-racket/private/pass.rkt:1059:52: memf: not a proper list: '#s((nonterminal-alt #(0) alt 3) #<syntax:27:7 ae> #f #f #<syntax:21:3 AExpr>)
I know that 43 isn't an LANF Expression, but that's besides the point.
Note that if I change
(Expr (e) (+ ae ce)))
to
(Expr (e) (+ ce)))
the error disappears.
Is the language definition correct?