-
Notifications
You must be signed in to change notification settings - Fork 1
Cst rewrite #4
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
Cst rewrite #4
Conversation
Hey thanks a lot for your pull request. Could you keep a summary in the first post of what you are changing? Right now it's a lot of changes and i'm not sure what to look for. |
hi @flip111, I have changed types to the types from purescript-cst all types from there are added but not all are printed (e.g. 1, 2) the tests are working https://travis-ci.org/github/srghma/purescript-ps-ast/builds/685609928#L3307 in readme you can find
the only difference from purescript-cst is the newlines are added between all declarations except of I'm not using I think everything that I need is implemented and I'm going to test how it works in https://github.com/srghma/purescript-fernet |
the functions in this is cool feature, maybe in future we will re-add it |
Looks great so far, give us a notice when you think it's finished and we can do a proper review.
Do you mean there is no printer code the stringify some types? I know the purescript compiler doesn't have a full pretty printer. There is this project https://gitlab.com/joneshf/purty which has a pretty printer, but i'm not sure how much it is compatible with the code from the purescript compiler.
What is the change in the comments field? I think to be able to print comments would be very useful because in case not all typescript definition information (this repo is supposed to work together with purescript-dts later) can be transformed into purescript, it can then be put in some comments at least. |
@srghma Thanks a lot for your huge contribution. I'm not sure if it is the best place to ask but we have decided that it would be really cool if you join our independent purescript-codegen org team, so I can assure you that you are very welcome :-)
This is huge!
From my perspective it is really good choice. I think that it is better to preserve consistency with the original library than to reach for fancier API in this case.
I'm not sure when I find time but I want to cleanup read-dts once again and rewrite codegen for MUI as well using this new API of yours. |
yes sorry, wrong links, updated 1, 2
I have added comments for now only to the declarations, but in purescript-cst every element can have comments, before or after the element e.g. SourceToken contains comment |
yes, of course! finally)
yes, ok, will do
👍 |
I don't know if this makes sense in this context. But i once wrote an AST that had a terminal type that had support for the piece of source code + a comment. That way i didn't need to implement the comment for each type separately. |
@flip111 terminal type? could you make an example? I dont think it makes sense to add comments for every type yes, it could be useful to be able to write someday foo = bar {- COMMENT1 -} {- COMMENT2 -} foo {- COMMENT3 -} but I dont need this for now for now I need comments only at |
@paluh @flip111 @jvliwanag I think it's ready, could you please make a review? should we make another repo called |
In the grammer you have non-terminal rules, and terminal rules (tokens). Your tokens can be a String or so. But you can also make it a record of String for the token and a Maybe String for a comment.
We can merge here and then rename in to purescript-ps-cst IMO |
@srghma Do you think we can do the following: Generate random AST with quickcheck |
that's basically Haskell types, with
we don't have parser implemented in purescript |
@srghma this is great! Please give me "a moment" - I hope to do the review on the next few days... I'm just not sure if I'm able to add anything valuable to this PR ;-) |
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.
@srghma your PR is so huge that I'm not really able to make valuable review. I'm not sure if there is a place for style related comments etc.
You have implemented also so extensive test suite which proofs that this library works nicely. I really can't wait to test it soon in a real life setting :-)
I hope that you are not disappointed about my approach. I'm leaving few minor review comments for the beginning of your PR.
And once again: Thanks a lot!
src/Language/PS/AST.purs
Outdated
@@ -1,6 +1,5 @@ | |||
module Language.PS.AST |
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.
Should we consider migration to the original namespace: Language.PureScript.CST
? What do you think Guys?
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.
done Guys)
@paluh thanks for kind words, did as for myself review notes are resolved) |
WIP
#1