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

Indices for bound variables are wrong in the local environment #53

Open
inariksit opened this issue Jun 2, 2020 · 0 comments
Open

Indices for bound variables are wrong in the local environment #53

inariksit opened this issue Jun 2, 2020 · 0 comments

Comments

@inariksit
Copy link
Member

The problem

I was poking around Compute.ConcreteNew.hs trying to fix #52, and I noticed that the indices for bound variables (VGen Int [Value]) are not correct. You can even see this in #52: the offending piece of code is this

    x + "foo" => ss (x + "bar")

and the error is this.

unsupported token gluing: str + "bar"

My attempts

I added more printouts for the error message for unsupported token gluing, as follows:

in error . render $
   ppL loc (hang ("unsupported token gluing: "
                 ++ "(" ++ show v1 ++ ", " ++ show v2 ++ ")\n"
                 ++ show (local env) ++ "\n") 4
                  (Glue (vt v1) (vt v2)))

With this change, I can cause an error (unsupported token gluing in my case, both appropriate and inappropriate), and then I can see the variables I have in the local environment, and how vt prints out the wrong variable name for the index i in the VGen i xs.

I tried to remove the call to reverse in value2term but the indices were just differently wrong.

I don't dare touch this further, because this seems like a fundamental thing in the GF compiler. Originally I just wanted to add another case in the glue function to match the tokens that were erroneously covered by "unsupported token gluing".

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

No branches or pull requests

1 participant