-
Notifications
You must be signed in to change notification settings - Fork 14
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
Implement pretty-printer #29
Comments
Hi, I started playing around with Squid after reading the paper and implemented a very simple Pretty-Printer to explore the structure a little bit. If it's of any interest I could try to make it comply with the things listed in this issue. My first stab is under this commit and I followed the structure of the |
Hello Felix, thanks for your interest in this project! You contribution is very much welcome. |
Thanks Lionel, for taking the time to look at it! I really like the project and look forward to playing around with it for some DSL work! I have addressed your comments and also added the type-arguments to method applications. Everything is a String now so I removed the Runtime-trait, too. Let me know what you think! I would open a PR and address the other things that are mentioned in this issue if you think it's okay. The link for inspiration regarding the line-breaks gets me a 404 though... |
Great! Feel free to make the PR when you're satisfied with the implementation.
Unfortunately, since the code is fully-typed and resolved, it's normal to get quite a lot of verbosity. The bright side is that I think we could factor names that are used more than once into local imports, which would make reading the code much easier! The idea would be to override
Right, sorry about that. Here is the code I was referring to (in particular, Document.scala): https://www.dropbox.com/s/rrbo60tu9ul9nln/document.zip?dl=0 EDIT: I realize that the technique described above to introduce imports would be problematic to implement, because there is no easy way to know how many times a name introduced by |
The legacy IRs implemented pretty-printing by converting the code into a Scala AST and then using the Scala pretty-printer!
Not ideal because it's slow, and because Scala's pretty-printer can be glitchy.
The new pretty-printer should:
'_'
+ counter starting from 0 (to avoid clashes);Base
), but with hooks to help print virtualized constructs such asif then else
correctly (instead of assquid.lib.IfThenElse
).The text was updated successfully, but these errors were encountered: