melt-umn / silver

An attribute grammar-based programming language for composable language extensions
http://melt.cs.umn.edu/silver/
GNU Lesser General Public License v3.0
58 stars 7 forks source link

Making type signatures on lambda parameters optional #813

Closed unironically closed 10 months ago

unironically commented 10 months ago

Changes

Implementing issue #555 - making type signatures on lambdas optional. This replaces the use of the ProductionRHS nonterminal with the new LambdaRHS, and ProductionRHSElem with LambdaRHSElem. Lambda syntax is defined as:

Expr ::=
  '\' LambdaRHS '->' Expr
| ...

LambdaRHS ::=
  LambdaRHSElem LambdaRHS
| 

LambdaRHSElem ::=
  Name '::' TypeExpr
| '_' '::' TypeExpr
| Name
| '_'

Suggested in #555, freshType() is invoked to produce a fresh type variable in productions where no explicit type is given.

Documentation

Doc comments included with new LambdaRHS/LambdaRHSElem productions. Also added to existing lambda_c and lambdap productions in compiler:modification:lambda_fn.

Testing

No new tests added. Existing tests such as those under silver_features cover lambda syntax.

RandomActsOfGrammar commented 10 months ago

I'm leaving reviewing your changes to Lucas. However, I noticed in your documentation notes that the documentation you added is all in the form of doc comments. As this is a user-facing change, you should also update the website to document the changes.

unironically commented 10 months ago

Have now modified the MELT website with melt-website/#56 and removed the redundant syntax Lucas mentioned.