You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this could be a good first issue, so I'm giving a thorough explanation of what needs to be done and how to get started. Feel free to contact me if you are interested in taking this on, or if would like more help getting started.
We have added a few forms of syntactic sugar over the last couple of years. However, I know of three examples of syntactic sugar that have not been implemented in the pretty-printer:
A match-in expression, with an implicit else-branch containing never
A switch-expression, a series of match-expressions on the same variable, and ending with a never
A series of record updates (of the form {r with x = a, y = b} instead of {{r with x = a} with y = b})
Supporting these patterns would make the output from the pretty-printer more readable. I made an example file which defines MExpr string examples of the forms of syntactic sugar I mentioned above, as well as that of record projections (which is supported in the pretty-printer), and pretty-prints them. Note that record projections are represented as
match r with {x = x} then
x
else never
If we run the example file, we see that record projections are pretty-printed in the syntactic sugar form, rather than the form shown above. However, the three forms of syntactic sugar mentioned above are all printed in a more verbose format. The goal is that they should be identified and pretty-printed using their syntactic sugar form.
To get started, take a look at:
The AST nodes for match-expressions, TmMatch, and record updates, TmRecordUpdate, in stdlib/mexpr/ast.mc.
The pretty-printer implementation for MExpr, in stdlib/mexpr/pprint.mc. In particular, have a look at how record projection is implemented for match-expressions (TmMatch).
The text was updated successfully, but these errors were encountered:
I think this could be a good first issue, so I'm giving a thorough explanation of what needs to be done and how to get started. Feel free to contact me if you are interested in taking this on, or if would like more help getting started.
We have added a few forms of syntactic sugar over the last couple of years. However, I know of three examples of syntactic sugar that have not been implemented in the pretty-printer:
never
never
{r with x = a, y = b}
instead of{{r with x = a} with y = b}
)Supporting these patterns would make the output from the pretty-printer more readable. I made an example file which defines MExpr string examples of the forms of syntactic sugar I mentioned above, as well as that of record projections (which is supported in the pretty-printer), and pretty-prints them. Note that record projections are represented as
If we run the example file, we see that record projections are pretty-printed in the syntactic sugar form, rather than the form shown above. However, the three forms of syntactic sugar mentioned above are all printed in a more verbose format. The goal is that they should be identified and pretty-printed using their syntactic sugar form.
To get started, take a look at:
TmMatch
, and record updates,TmRecordUpdate
, in stdlib/mexpr/ast.mc.TmMatch
).The text was updated successfully, but these errors were encountered: