View mode: basic / threaded / horizontal-split · Log in · Help
March 28, 2011
Complete D grammar
Didn't someone here have a complete D grammar? I vaguely remember that there is at least a D1 one buried somewhere.
March 28, 2011
Re: Complete D grammar
Trass3r Wrote:

> Didn't someone here have a complete D grammar? I vaguely remember that there is at least a D1 one buried somewhere.

huh?
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.announce&article_id=20299
March 28, 2011
Re: Complete D grammar
On 3/28/11 5:17 PM, Kagamin wrote:
> Trass3r Wrote:
>
>> Didn't someone here have a complete D grammar? I vaguely remember that there is at least a D1 one buried somewhere.
>
> huh?
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.announce&article_id=20299

Nope, Trass3r is talking about a grammar for the D language itself, 
whereas Goldie is a parser generator for D (which generates parsers for 
a given grammar).

Unfortunately, I only remember someone working on one (and filing some 
related bugs), I lost the details as well…

David
March 28, 2011
Re: Complete D grammar
A complete D grammar is one of the objectives of my GSOC 2011 ANTLR
proposal, if I got accepted you will have one :)

On 3/28/11, David Nadlinger <see@klickverbot.at> wrote:
> On 3/28/11 5:17 PM, Kagamin wrote:
>> Trass3r Wrote:
>>
>>> Didn't someone here have a complete D grammar? I vaguely remember that
>>> there is at least a D1 one buried somewhere.
>>
>> huh?
>> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.announce&article_id=20299
>
> Nope, Trass3r is talking about a grammar for the D language itself,
> whereas Goldie is a parser generator for D (which generates parsers for
> a given grammar).
>
> Unfortunately, I only remember someone working on one (and filing some
> related bugs), I lost the details as well…
>
> David
>
March 28, 2011
Re: Complete D grammar
> huh?
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.announce&article_id=20299

The grammar offered there is lexing-only.
March 28, 2011
Re: Complete D grammar
David Nadlinger Wrote:
> Nope, Trass3r is talking about a grammar for the D language itself, 

Exactly, I'm pretty sure that some guy once stated on IRC or somewhere he had a complete D1 grammar.
March 28, 2011
Re: Complete D grammar
You can find an ANTLR grammar for D v1 at
http://www.dsource.org/projects/antlrd/browser/toys/v3d/parsed.g (by
Ellery Newcomer)

The syntax is similar to EBNF, check the ANTLR documentation for details.

I hope this might help you.


Luca Boasso

On 3/28/11, Trass3r <un@known.com> wrote:
> David Nadlinger Wrote:
>> Nope, Trass3r is talking about a grammar for the D language itself,
>
> Exactly, I'm pretty sure that some guy once stated on IRC or somewhere he
> had a complete D1 grammar.
>
March 28, 2011
Re: Complete D grammar
On 3/28/2011 9:02 AM, Luca Boasso wrote:
> A complete D grammar is one of the objectives of my GSOC 2011 ANTLR
> proposal, if I got accepted you will have one :)

The complete grammar should be part of the D spec. Please post any errors/fixes 
to the existing one to bugzilla!
March 28, 2011
Re: Complete D grammar
On 3/28/11, Walter Bright <newshound2@digitalmars.com> wrote:
> On 3/28/2011 9:02 AM, Luca Boasso wrote:
>> A complete D grammar is one of the objectives of my GSOC 2011 ANTLR
>> proposal, if I got accepted you will have one :)
>
> The complete grammar should be part of the D spec. Please post any
> errors/fixes
> to the existing one to bugzilla!
>

Sorry for the inaccuracy, I meant a complete grammar up-to-date with
the current D spec. that can be used by the ANTLR parser generator.
March 28, 2011
Re: Complete D grammar
"David Nadlinger" <see@klickverbot.at> wrote in message 
news:imq92m$1ru0$1@digitalmars.com...
> On 3/28/11 5:17 PM, Kagamin wrote:
>> Trass3r Wrote:
>>
>>> Didn't someone here have a complete D grammar? I vaguely remember that 
>>> there is at least a D1 one buried somewhere.
>>
>> huh?
>> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.announce&article_id=20299
>

Like Trass3r said, that's lexing-only right now.

> Nope, Trass3r is talking about a grammar for the D language itself, 
> whereas Goldie is a parser generator for D (which generates parsers for a 
> given grammar).
>

Technically speaking, Goldie doesn't actually generate parsers, it has one 
grammar-independent parser that it uses for all grammars (fairly 
characteristic for LALR(1), AIUI). Although, in the static-style it does 
make a slight custom modification to the parser and lexer so that each token 
emitted is properly typed. Which I suppose amounts to six-of-one, 
half-dozen-of-the-other...

> Unfortunately, I only remember someone working on one (and filing some 
> related bugs), I lost the details as well.
>

Yea, I remember that too. Someone took all the BNF sections from D's docs on 
digitalmars.com, put them together, and filled in some missing/erroneous 
parts. Maybe it's on wiki4d?
« First   ‹ Prev
1 2 3 4
Top | Discussion index | About this forum | D home