March 04, 2015 Re: dfmt 0.1.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot Attachments:
| On Wed, 2015-03-04 at 14:21 +0000, Dicebot via Digitalmars-d-announce wrote: […] > > No. https://github.com/Hackerpilot/libdparse Well this a bit not efficient, one D parser written in D for the compiler and a separate D parser written in D for the code formatter. What can go wrong. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder |
March 04, 2015 Re: dfmt 0.1.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russel Winder | On Wednesday, 4 March 2015 at 14:53:22 UTC, Russel Winder wrote:
> On Wed, 2015-03-04 at 14:21 +0000, Dicebot via Digitalmars-d-announce
> wrote:
> […]
>>
>> No. https://github.com/Hackerpilot/libdparse
>
> Well this a bit not efficient, one D parser written in D for the
> compiler and a separate D parser written in D for the code formatter.
> What can go wrong.
All Brian tools use the same libdparse. Those include DCD, DScanner, dfix, dfmt and probably some others I am not aware of. It was also proposed for inclusion into Phobos a while ago but review pressure was too high.
I hope it will eventually replace the legacy lexer/parser converted from DMD C sources - it is much more pleasant to work with.
(there is no such thing as "one D parser written in D for the compiler")
|
March 04, 2015 Re: dfmt 0.1.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot Attachments:
| On Wed, 2015-03-04 at 15:04 +0000, Dicebot via Digitalmars-d-announce wrote: […] > All Brian tools use the same libdparse. Those include DCD, DScanner, dfix, dfmt and probably some others I am not aware of. It was also proposed for inclusion into Phobos a while ago but review pressure was too high. I try to use DCD when working with Emacs for D code, but I keep forgetting to start the server :-( I would certainly be happy to commit to using dfmt just as I use gofmt in Emacs. As long as the variation from my preferred style is not to much I can live with a "One True Style" (*). > I hope it will eventually replace the legacy lexer/parser converted from DMD C sources - it is much more pleasant to work with. > > (there is no such thing as "one D parser written in D for the compiler") There ought to be for the compiler/formatter toolchain otherwise there will be problems. And if there is a D parser as library and it works why would anyone want another parser? (*) The exception is of course Phobos style which I find so annoying I can't read code formatted that way. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder |
March 04, 2015 Re: dfmt 0.1.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russel Winder | On Wednesday, 4 March 2015 at 15:26:51 UTC, Russel Winder wrote: > I try to use DCD when working with Emacs for D code, but I keep > forgetting to start the server :-( I would certainly be happy to commit > to using dfmt just as I use gofmt in Emacs. As long as the variation > from my preferred style is not to much I can live with a "One True > Style" (*). That means that the Emacs plugin needs to start it automatically. > There ought to be for the compiler/formatter toolchain otherwise there > will be problems. And if there is a D parser as library and it works why > would anyone want another parser? Implementing a separate parser based on the language spec has helped to find problems with the language spec. Having "One True Implementation" can lead to problems as well. https://issues.dlang.org/show_bug.cgi?id=10233 > (*) The exception is of course Phobos style which I find so annoying I > can't read code formatted that way. By default dfmt tries to output Phobos style code. There is an option to use a different brace style and another one to use tabs. |
March 05, 2015 Re: dfmt 0.1.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russel Winder | On 2015-03-04 16:26, Russel Winder via Digitalmars-d-announce wrote: > There ought to be for the compiler/formatter toolchain otherwise there > will be problems. And if there is a D parser as library and it works why > would anyone want another parser? The DMD front end is not really designed to be used as a library for tooling. -- /Jacob Carlborg |
March 05, 2015 Re: dfmt 0.1.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brian Schott Attachments:
| On Wed, 2015-03-04 at 21:22 +0000, Brian Schott via Digitalmars-d-announce wrote: > […] > > That means that the Emacs plugin needs to start it automatically. Is this something on your todo list, or do you need a pull request? > Implementing a separate parser based on the language spec has helped to find problems with the language spec. Having "One True Implementation" can lead to problems as well. > > https://issues.dlang.org/show_bug.cgi?id=10233 I just wonder if it is wise to have a single two chain with two distinct parsers which have separate lifecycles? > > (*) The exception is of course Phobos style which I find so > > annoying I > > can't read code formatted that way. > > By default dfmt tries to output Phobos style code. There is an option to use a different brace style and another one to use tabs. Since using Go and working on a couple of fairly old C++ codebases, all of which use tab for indent, I have come to rather like it. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder |
March 05, 2015 Re: dfmt 0.1.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg Attachments:
| On Thu, 2015-03-05 at 08:17 +0100, Jacob Carlborg via Digitalmars-d-announce wrote: > On 2015-03-04 16:26, Russel Winder via Digitalmars-d-announce wrote: > > > There ought to be for the compiler/formatter toolchain otherwise there will be problems. And if there is a D parser as library and it works why would anyone want another parser? > > The DMD front end is not really designed to be used as a library for tooling. It would be good if the D implemented D parser were though. Parsing to create an AST is needed for many things. If each tool in the tool chain implements it's own… it just seems wrong. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder |
March 05, 2015 Re: dfmt 0.1.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | "Jacob Carlborg" wrote in message news:md8vu6$hc1$1@digitalmars.com... > The DMD front end is not really designed to be used as a library for tooling. It isn't, but it's slowly getting better. eg You can now build the lexer as a library without pulling everything else in. It's quite possible that in a couple of years it will be in a state where it's reasonable to build tools on top of it. |
March 06, 2015 Re: dfmt 0.1.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russel Winder | On Thursday, 5 March 2015 at 09:02:25 UTC, Russel Winder wrote:
> Since using Go and working on a couple of fairly old C++ codebases,
> all of which use tab for indent, I have come to rather like it.
You probably feel that way because tabs are better. dfmt only defaults to spaces because that's what's in the Phobos style guide.
|
March 06, 2015 Re: dfmt 0.1.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy | On 2015-03-05 13:10, Daniel Murphy wrote: > It isn't, but it's slowly getting better. eg You can now build the > lexer as a library without pulling everything else in. Yes, that is absolute fantastic as a first step. > It's quite possible that in a couple of years it will be in a state where it's > reasonable to build tools on top of it. That would be awesome. You're doing a great job, keep it up. -- /Jacob Carlborg |
Copyright © 1999-2021 by the D Language Foundation