BNF grammar for D?

Russel Winder russel at winder.org.uk
Fri Oct 12 07:41:02 PDT 2012


On Fri, 2012-10-12 at 15:11 +0200, Aziz K. wrote:
> Hi,
> 
> I can give you three options to choose from.
> 
> There's the official grammar (don't know what the form is called):
> 
> http://dlang.org/declaration.html
> 
> A Parser Expression Grammar (PEG):
> 
> https://github.com/PhilippeSigaud/Pegged/blob/master/pegged/examples/dparser.d
> 
> The source code comments in my project using a pseudo-BNF format. They  
> shouldn't be too hard to decipher, but keep in mind that they're not 100%  
> complete and exact:
> 
> http://dl.dropbox.com/u/17101773/next/2/dil/doc/dil.parser.Parser.html#Parser.parseModuleDecl

I think the official grammar rules in, let's call it K&R grammar, is the
only choice here. Rather than scrape from the website is there a file in
the Git repository with this grammar rule set?  If so then a small
program in say, Python ;-), would give a EBNF grammar representation
fairly straightforwardly – read grammar ruleset, construct tree
representing the ruleset, run visitor over tree to generate EBNF.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121012/05b228b1/attachment.pgp>


More information about the Digitalmars-d mailing list