-
Notifications
You must be signed in to change notification settings - Fork 9
nanopass-case #15
Comments
What is you're language definition? If you don't have a (let (x M) M* ...) in LCS Term, it having trouble finding a match, and hence trying to interpret it as a different production. -andy:) As far as a mailing list, up until now, it has only been a handful of people using this (and I work with most of them). I'm happy to have the need to setup a list, and I'll try to do so this weekend. On July 2, 2015 at 4:04:24 PM, Jens Axel Søgaard ([email protected]) wrote: This may or may not be a bug in nanopass-case. This works: (let ([M (parse '((λ (x) x) 4))]) But this (let ([M (parse '(let (y 5) 6))]) gives the error: define-pass: quoted terminals currently unsupported in match patterns in: (quote let) The problem is that let is defined as a non-terminal of Term in the language LCS. Am I using nanopass-case in the wrong way, or is there a bug? The entire program is here: https://gist.github.com/soegaard/b52cb97f65c608251d60 — |
The language definition is here: https://gist.github.com/soegaard/b52cb97f65c608251d60 2015-07-02 22:26 GMT+02:00 Andy Keep [email protected]:
Jens Axel Søgaard |
Yes, so your language definition does not match your pass, so the nanopass-framework is trying to figure out the best thing to do. You have the productions: (let (x M1) M2) and (M M1 …) and you are trying to use the pattern: (let (,x ,M1) ,M …) This doesn’t match the (let (x M1) M2), because in the production you are expecting only one Term in the body, and in the pattern you are telling it you have a list of Term in the body. Since that doesn’t work, it tries to look for other productions that might work, and it finds (M M1 …) and starts trying to see if this will match, but when it tries to parse the (let (,x ,M1) ,M …) it realizes it needs to process the let as a quoted constant in a pattern, and this is what results in the error you are seeing (because this is not allowed). Probably this is another thing that could use a better error message—possibly by special casing the error where the first field in the pattern might (or might not) be a keyword, and looking to see if there is already a production with this keyword. -andy:)
|
The example was:
For some reason I fixated on the pattern ,M1 ... should the 6 I forgot that parse turns the expression into nanopass-structures The error message I got
in: (quote let) was not that helpful though. If it were worded to suggest that there was I see now that the let error comes from trying to interpret the pattern Thanks for the explanation, |
Yeah, I definitely agree the error message should be better. When Kent (my advisor) and I were first recoding Chez Scheme with the nanopass framework we tried to be careful about fixing error messages when we encountered bad ones, but clearly more of that needs to happen, which is why I appreciate the bug reports! I'll try to get some more fixes in for bad error messages today, if I get some time to work on it. -andy:) The example was: (let ([M (parse '(let (y 5) 6))]) For some reason I fixated on the pattern ,M1 ... should the 6 I forgot that parse turns the expression into nanopass-structures The error message I got define-pass: quoted terminals currently unsupported in match patterns was not that helpful though. If it were worded to suggest that there was I see now that the let error comes from trying to interpret the pattern Thanks for the explanation, |
Initial issue is fixed by fix to #9, however, the issue with the define language is not yet fixed, so this is really a new error. |
Should this be closed? |
This may or may not be a bug in
nanopass-case
.If there were a nanopass-mailing list I would tried there before filing an issue.
This works:
But this
gives the error:
The problem is that
let
is defined as a non-terminal of Term in the language LCS.I.e. it is not a quoted terminal.
Am I using
nanopass-case
in the wrong way, or is there a bug?The entire program is here:
https://gist.github.com/soegaard/b52cb97f65c608251d60
The text was updated successfully, but these errors were encountered: