July 19, 2013
Status update:

My parser is at a point where it can parse all of phobos (well, excluding c-style array declarations, which I'm convinced are broken and should be removed from the language).

I've been updating the grammar definition as I worked on the parser. An HTML version is available for download here: https://raw.github.com/Hackerpilot/DGrammar/master/grammar.html

Lexer, parser, and AST code is available here: https://github.com/Hackerpilot/Dscanner/tree/range-based-lexer/std/d. Bug reports and pull requests are welcome.
July 19, 2013
On Friday, 19 July 2013 at 20:49:27 UTC, Brian Schott wrote:
> Status update:
>
> My parser is at a point where it can parse all of phobos (well, excluding c-style array declarations, which I'm convinced are broken and should be removed from the language).
>
> I've been updating the grammar definition as I worked on the parser. An HTML version is available for download here: https://raw.github.com/Hackerpilot/DGrammar/master/grammar.html
>
> Lexer, parser, and AST code is available here: https://github.com/Hackerpilot/Dscanner/tree/range-based-lexer/std/d. Bug reports and pull requests are welcome.

https://rawgithub.com/Hackerpilot/DGrammar/master/grammar.html
;)
July 19, 2013
On Friday, 19 July 2013 at 20:52:33 UTC, Mr. Anonymous wrote:
> https://rawgithub.com/Hackerpilot/DGrammar/master/grammar.html
> ;)

I learn something new every day.

July 19, 2013
On Fri, Jul 19, 2013 at 10:49:25PM +0200, Brian Schott wrote:
> Status update:
> 
> My parser is at a point where it can parse all of phobos (well, excluding c-style array declarations, which I'm convinced are broken and should be removed from the language).

Really? Those still exist in Phobos? Shouldn't they be rewritten to the "native" style?


> I've been updating the grammar definition as I worked on the parser. An HTML version is available for download here: https://raw.github.com/Hackerpilot/DGrammar/master/grammar.html
> 
> Lexer, parser, and AST code is available here: https://github.com/Hackerpilot/Dscanner/tree/range-based-lexer/std/d. Bug reports and pull requests are welcome.

Wonderful! I'll have to look into this sometime. I've been dreaming about writing a D pretty-printer, and this may be just the thing I need to get it going.  :)

(Well actually, I *wrote* a D pretty-printer, but I only got as far as lexing, with some token-matching rules for the pretty-printing. Needless to say, the results were rather underwhelming, since I didn't have an AST to work with.)


T

-- 
Written on the window of a clothing store: No shirt, no shoes, no service.
July 19, 2013
On Friday, 19 July 2013 at 20:57:14 UTC, H. S. Teoh wrote:
> Really? Those still exist in Phobos? Shouldn't they be rewritten to the
> "native" style?

Yes.

https://github.com/D-Programming-Language/phobos/pull/1412/files
July 19, 2013
Am Fri, 19 Jul 2013 22:49:25 +0200
schrieb "Brian Schott" <briancschott@gmail.com>:

> Status update:
> 
> My parser is at a point where it can parse all of phobos (well, excluding c-style array declarations, which I'm convinced are broken and should be removed from the language).
> 
> I've been updating the grammar definition as I worked on the parser. An HTML version is available for download here: https://raw.github.com/Hackerpilot/DGrammar/master/grammar.html
> 
> Lexer, parser, and AST code is available here: https://github.com/Hackerpilot/Dscanner/tree/range-based-lexer/std/d. Bug reports and pull requests are welcome.

Nice work!

I guess you already tried druntime but did you also run your lexer and or parser against the dmd test suite? The test suite probably has quite some old legacy stuff like c-style array declarations so it might be a pita to run those tests but it might show some real problems as well.

If you wanted to do more testing you could also run it on some well-maintained big D projects (GTKd, derelict3, ...) http://wiki.dlang.org/Libraries_and_Frameworks http://wiki.dlang.org/Open_Source_Projects

It's also nice that we may finally get a correct and complete grammar.

BTW: I think it might be a good idea to start a new thread for this update. This stuff is quite important for D/phobos and usually old threads tend to be ignored or get less attention.
July 20, 2013
On 2013-07-19 22:49, Brian Schott wrote:
> Status update:
>
> My parser is at a point where it can parse all of phobos (well,
> excluding c-style array declarations, which I'm convinced are broken and
> should be removed from the language).
>
> I've been updating the grammar definition as I worked on the parser. An
> HTML version is available for download here:
> https://raw.github.com/Hackerpilot/DGrammar/master/grammar.html
>
> Lexer, parser, and AST code is available here:
> https://github.com/Hackerpilot/Dscanner/tree/range-based-lexer/std/d.
> Bug reports and pull requests are welcome.

Now for the million dollar question: does it work during compile time?

-- 
/Jacob Carlborg
July 20, 2013
On Friday, 19 July 2013 at 20:49:27 UTC, Brian Schott wrote:
> Status update:
> excluding c-style array declarations, which I'm convinced are broken and should be removed from the language
+1

I found for myself that "native" style arrays are more natural.
1 2 3 4 5
Next ›   Last »