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

Add examples and test for type signatures on parametrized productions #147

Open
harpocrates opened this issue Sep 3, 2019 · 0 comments
Open

Comments

@harpocrates
Copy link
Contributor

The current user manual (for version 1.19.12) has this to say about parametrized productions

A drawback of the current implementation is that it does not support type signatures for the parameterized productions, that depend on the types of the parameters. We plan to implement that in the future---the current workaround is to omit the type signatures for such rules.

This is flat out wrong. Parametrized productions have (for at least several versions) supported type signatures. Examples:

many(a) :: { [a] }
  :                        { [] }
  | some_rev(a)            { reverse $1 }

some_rev(a) :: { [a] }
  :  a                     { [$1] }
  | some_rev(a) a          { $2 : $1 }

then(a, b) :: { (a,b) }
  : a b                    { ($1, $2) }

To fix:

  • add a regression test case to make sure this is not broken in future versions
  • add an example to examples for this
  • update the user manual

This is somewhat important since there is also bad advice floating about the internet suggesting people use _ to work around this (see #141 for instance).

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