-
Notifications
You must be signed in to change notification settings - Fork 40
Reach reparsability of core pretty-printer #1181
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
Conversation
| lazy val externBodyTemplate: P[Template[Expr]] = | ||
| ( | ||
| (multilineString | stringLiteral) ~ | ||
| rep((`++` ~> expr) ~ (`++` ~> (multilineString | stringLiteral))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose the syntax "string" ++ (<expr> ++ "string")* for extern body template strings because it is easy to parse. Open to to other suggestions!
66fa66e to
186257b
Compare
| case _: kiama.util.StringSource => "string" | ||
| case _ => "source" | ||
| } | ||
| "<>" <+> s"@ \"$scheme://$name\":$from:$to" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: proper escaping
9b78c7d to
72eaa10
Compare
| // FIXME: There is currently a limitation in TestRenamer in that it does not rename captures. | ||
| // This means, that in this example, captures for State[Int] and State[String] are both printed as "State", | ||
| // leading to a collapse of the capture set {State_1, State_2} to just {State}. | ||
| File("examples/pos/parametrized.effekt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marzipankaiser this is what I just mentioned in person.
a1597bf to
42a74c9
Compare
42a74c9 to
9755de4
Compare
jiribenes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went over this in five minutes, see comments below. I'm fine with merging this if you need it (though it would be nice if somebody who actually knows something about core reviewed it)
Currently, it is very hard to write tests for core. There are two main reasons for this:
While a new core frontend would subsume both of these problems, it is a lot more effort than adding a re-parsable mode to the current core pretty-printer. This would allow us to compile source programs to core and pretty-print them to use them as golden output in core tests.
In particular, when developing the new normalizer (#1127), I would like to track its behavior in unit tests, but they are currently very time-consuming to write due to the fact I cannot just use pretty-printed core for comparison.