www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D Grammar in BNF Text Form?

reply Tom Browder via Digitalmars-d <digitalmars-d puremagic.com> writes:
Can anyone point me to a text version of the D grammar in some kind of
BNF or EBNF format?  The D lang web site's info is close, but it's
buried in html which I'ld rather not have to wrestle with.

My purpose is to attempt to write a D language parser in Perl using
Damian Conway's Regex::Grammars module (on CPAN).

Thanks.

Best regards,

-Tom
Jun 06 2014
parent reply "Philpax" <phillip philliplarkson.com> writes:
On Friday, 6 June 2014 at 10:30:14 UTC, Tom Browder via 
Digitalmars-d wrote:
 Can anyone point me to a text version of the D grammar in some 
 kind of
 BNF or EBNF format?  The D lang web site's info is close, but 
 it's
 buried in html which I'ld rather not have to wrestle with.

 My purpose is to attempt to write a D language parser in Perl 
 using
 Damian Conway's Regex::Grammars module (on CPAN).

 Thanks.

 Best regards,

 -Tom
Check Brian Schott's work: https://github.com/Hackerpilot/DGrammar
Jun 06 2014
parent Tom Browder via Digitalmars-d <digitalmars-d puremagic.com> writes:
On Fri, Jun 6, 2014 at 5:32 AM, Philpax via Digitalmars-d
<digitalmars-> On Friday, 6 June 2014 at 10:30:14 UTC, Tom Browder via
Digitalmars-d wrote:
 Can anyone point me to a text version of the D grammar in some kind of
 BNF or EBNF format?  The D lang web site's info is close, but it's
 buried in html which I'ld rather not have to wrestle with.
...
 Check Brian Schott's work: https://github.com/Hackerpilot/DGrammar
The file there named 'D.g4' seems to be almost exactly what I'm looking for. Thanks, Brian! Best, -Tom P.S. My work on the Perl parser (and BRL-CAD D bindings) can be seen on the BRL-CAD project site at: http://sourceforge.net/p/brlcad/code/HEAD/tree/brlcad/branches/d-binding/misc/d-bindings/
Jun 06 2014