January 16, 2013
On 1/15/2013 4:56 PM, Andrej Mitrovic wrote:
> This isn't such a bad idea considering the amount of work necessary to
> actually parse D code in the first place.


It isn't just the comments. Suppose you have the value in source code:

   0x100

and then in the json code, it's

   256u

This kind of thing is way beyond what json is intended for. json is there to extract semantic content, not syntactic.

January 16, 2013
On 1/15/2013 5:24 PM, Andrej Mitrovic wrote:
> I'm pretty sure Walter specifically wants this written in D. C/C++
> solutions already exist, but a D implementation could be a good way to
> show how much work is required to write a code formatter in D and
> could e.g. be presented in DConf. String processing should be D's
> powerful side, after all.

It's also an excellent way to prove the value of the nascent lexer & parser being written in D.

January 16, 2013
On 2013-01-16 00:50, Walter Bright wrote:
> Continuing in the vein of the Exceptional coding style thread, D needs
> (and has needed for a long time) a utility that will reformat source code.
>
> One use of it would be to run as a filter on all of the Druntime and
> Phobos source code before checkin.
>
> This could make great use of the current projects to implement a D lexer
> and parser in D.
>
> It'd make for a nice boon to the D community.
>
> Any champions for this?

Now where's that lexer/parser ...

-- 
/Jacob Carlborg
January 16, 2013
On Wednesday, 16 January 2013 at 07:40:24 UTC, Jacob Carlborg wrote:
> On 2013-01-16 00:50, Walter Bright wrote:
>> Continuing in the vein of the Exceptional coding style thread, D needs
>> (and has needed for a long time) a utility that will reformat source code.
>>
>> One use of it would be to run as a filter on all of the Druntime and
>> Phobos source code before checkin.
>>
>> This could make great use of the current projects to implement a D lexer
>> and parser in D.
>>
>> It'd make for a nice boon to the D community.
>>
>> Any champions for this?
>
> Now where's that lexer/parser ...

I think Dil would be a good starting point. It claims 99% of lexer/parser done.

https://github.com/azizk/dil
January 16, 2013
On 2013-01-16 08:54, qznc wrote:

> I think Dil would be a good starting point. It claims 99% of
> lexer/parser done.
>
> https://github.com/azizk/dil

I always forget about that one. Do we have a list of lexers/parsers available?

-- 
/Jacob Carlborg
January 16, 2013
> * Martin Nowak put these gists on the D newsgroup:
>     - https://gist.github.com/1255439 - lexer generator
>     - https://gist.github.com/1262321 - complete and fast D lexer

New link:

https://github.com/dawgfoto/lexer
January 16, 2013
On Wed, Jan 16, 2013 at 11:33 AM, Jacob Carlborg <doob@me.com> wrote:
> On 2013-01-16 08:54, qznc wrote:
>
>> I think Dil would be a good starting point. It claims 99% of lexer/parser done.
>>
>> https://github.com/azizk/dil
>
>
> I always forget about that one. Do we have a list of lexers/parsers available?

I have a small (woefully incomplete) list in my Pegged parser
generator project README:

Parser generators:

* Hisayuki Mima's [CTPG](https://github.com/youkei/ctpg), very
similar, also done in D. Have a look!

* Nick Sabalausky's [Goldie](http://www.dsource.org/projects/goldie).

Parsers:

* Benjamin Shropshire's
[dparser](http://dsource.org/projects/scrapple/browser/trunk/dparser).

* Martin Nowak put these gists on the D newsgroup:
    - https://gist.github.com/1255439 - lexer generator
    - https://gist.github.com/1262321 - complete and fast D lexer


I should also add the parser from Dil and the one from SDC (At least,
I suppose there is one in SDC)
Jacob, do you have a link to your parser?

Also, Timon seems to have a parser, and JM Davis was working on a D lexer.
January 16, 2013
On Wednesday, 16 January 2013 at 10:52:39 UTC, Philippe Sigaud wrote:
>> * Martin Nowak put these gists on the D newsgroup:
>>     - https://gist.github.com/1255439 - lexer generator
>>     - https://gist.github.com/1262321 - complete and fast D lexer
>
> New link:
>
> https://github.com/dawgfoto/lexer

If it is going public, can we use a naming convention that make sense for tokens types ?
January 16, 2013
On 2013-01-16 11:50, Philippe Sigaud wrote:

> I have a small (woefully incomplete) list in my Pegged parser
> generator project README:
>
> Parser generators:
>
> * Hisayuki Mima's [CTPG](https://github.com/youkei/ctpg), very
> similar, also done in D. Have a look!
>
> * Nick Sabalausky's [Goldie](http://www.dsource.org/projects/goldie).
>
> Parsers:
>
> * Benjamin Shropshire's
> [dparser](http://dsource.org/projects/scrapple/browser/trunk/dparser).
>
> * Martin Nowak put these gists on the D newsgroup:
>      - https://gist.github.com/1255439 - lexer generator
>      - https://gist.github.com/1262321 - complete and fast D lexer
>
>
> I should also add the parser from Dil and the one from SDC (At least,
> I suppose there is one in SDC)

That's a good start. We should put these on the wiki.

> Jacob, do you have a link to your parser?

I don't have a parser. That's why I'm complaining all the time that we should have a lexer and parser for D written in D :)

> Also, Timon seems to have a parser, and JM Davis was working on a D lexer.
>


-- 
/Jacob Carlborg
January 16, 2013
On Wed, Jan 16, 2013 at 1:11 PM, Jacob Carlborg <doob@me.com> wrote:
> That's a good start. We should put these on the wiki.

OK, I'll do that tonight. That will become a reflex ;)

>> Jacob, do you have a link to your parser?
>
>
> I don't have a parser. That's why I'm complaining all the time that we should have a lexer and parser for D written in D :)

Drat.