www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - syntax definition language

reply Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
Hi, guys!
Can anyone tell me what's the name of this syntax definition language,
used here: http://www.d-programming-language.org/lex.htm ?
Oct 23 2011
next sibling parent reply =?ISO-8859-1?Q?Alex_R=F8nne_Petersen?= <xtzgzorex gmail.com> writes:
On 23-10-2011 13:58, Gor Gyolchanyan wrote:
 Hi, guys!
 Can anyone tell me what's the name of this syntax definition language,
 used here: http://www.d-programming-language.org/lex.htm ?

A variant of EBNF (Extended Backus-Naur Form), I suppose. - Alex
Oct 23 2011
parent reply Timon Gehr <timon.gehr gmx.ch> writes:
On 10/23/2011 02:16 PM, Gor Gyolchanyan wrote:
 Yeah, i know about EBNF, but it uses completely different syntax.
 I'm really excited about having a standard D compiler front-end as a
 library solution, so i though it would be best to parse the syntax
 from the syntax definition of dpl.org

That can currently not be done. The syntax specification on dpl.org is out of date and contains many errors and inaccuracies. (at least it was that way the last time I checked)
Oct 23 2011
next sibling parent simendsjo <simendsjo gmail.com> writes:
On 23.10.2011 15:10, Gor Gyolchanyan wrote:
 Anyway, I'm writing a general-purpose parser base, so i won't need it for now.
 And when i do, I'd like to have a correct grammar definition, so i can
 feed it to my parser.
 Who should i ask to ensure it's correctness?

Do you know about Goldie? http://www.semitwist.com/goldie/
Oct 23 2011
prev sibling parent Timon Gehr <timon.gehr gmx.ch> writes:
On 10/23/2011 07:19 PM, Martin Nowak wrote:
 On Sun, 23 Oct 2011 15:10:08 +0200, Gor Gyolchanyan
 <gor.f.gyolchanyan gmail.com> wrote:

 Anyway, I'm writing a general-purpose parser base, so i won't need it
 for now.
 And when i do, I'd like to have a correct grammar definition, so i can
 feed it to my parser.
 Who should i ask to ensure it's correctness?

 Once I'm done, I'll send a pull request for something around
 "etc.dcfe" for "D compiler front end".
 It won't be perfect, of course, but it will be a start, from which the
 front-end would be gradually developed.
 I wanna at least have an AST parser by the time i make the pull request.

 On Sun, Oct 23, 2011 at 5:01 PM, Timon Gehr <timon.gehr gmx.ch> wrote:
 On 10/23/2011 02:16 PM, Gor Gyolchanyan wrote:
 Yeah, i know about EBNF, but it uses completely different syntax.
 I'm really excited about having a standard D compiler front-end as a
 library solution, so i though it would be best to parse the syntax
 from the syntax definition of dpl.org

That can currently not be done. The syntax specification on dpl.org is out of date and contains many errors and inaccuracies. (at least it was that way the last time I checked)


I've written a fast and pretty complete D lexer (https://gist.github.com/1262321). It is based on a generic lexer component which will generate efficient matching functions at compile time (https://gist.github.com/1255439). I think there are still some compiler bugs to be sorted out so you won't be able to compile it out of the box. martin

4| import lexer; // where is this file?
Oct 23 2011
prev sibling next sibling parent Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
Yeah, i know about EBNF, but it uses completely different syntax.
I'm really excited about having a standard D compiler front-end as a
library solution, so i though it would be best to parse the syntax
from the syntax definition of dpl.org

On Sun, Oct 23, 2011 at 4:05 PM, Alex R=F8nne Petersen
<xtzgzorex gmail.com> wrote:
 On 23-10-2011 13:58, Gor Gyolchanyan wrote:
 Hi, guys!
 Can anyone tell me what's the name of this syntax definition language,
 used here: http://www.d-programming-language.org/lex.htm ?

A variant of EBNF (Extended Backus-Naur Form), I suppose. - Alex

Oct 23 2011
prev sibling next sibling parent Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
Anyway, I'm writing a general-purpose parser base, so i won't need it for now.
And when i do, I'd like to have a correct grammar definition, so i can
feed it to my parser.
Who should i ask to ensure it's correctness?

Once I'm done, I'll send a pull request for something around
"etc.dcfe" for "D compiler front end".
It won't be perfect, of course, but it will be a start, from which the
front-end would be gradually developed.
I wanna at least have an AST parser by the time i make the pull request.

On Sun, Oct 23, 2011 at 5:01 PM, Timon Gehr <timon.gehr gmx.ch> wrote:
 On 10/23/2011 02:16 PM, Gor Gyolchanyan wrote:
 Yeah, i know about EBNF, but it uses completely different syntax.
 I'm really excited about having a standard D compiler front-end as a
 library solution, so i though it would be best to parse the syntax
 from the syntax definition of dpl.org

That can currently not be done. The syntax specification on dpl.org is out of date and contains many errors and inaccuracies. (at least it was that way the last time I checked)

Oct 23 2011
prev sibling next sibling parent "Martin Nowak" <dawg dawgfoto.de> writes:
On Sun, 23 Oct 2011 15:10:08 +0200, Gor Gyolchanyan  
<gor.f.gyolchanyan gmail.com> wrote:

 Anyway, I'm writing a general-purpose parser base, so i won't need it  
 for now.
 And when i do, I'd like to have a correct grammar definition, so i can
 feed it to my parser.
 Who should i ask to ensure it's correctness?

 Once I'm done, I'll send a pull request for something around
 "etc.dcfe" for "D compiler front end".
 It won't be perfect, of course, but it will be a start, from which the
 front-end would be gradually developed.
 I wanna at least have an AST parser by the time i make the pull request.

 On Sun, Oct 23, 2011 at 5:01 PM, Timon Gehr <timon.gehr gmx.ch> wrote:
 On 10/23/2011 02:16 PM, Gor Gyolchanyan wrote:
 Yeah, i know about EBNF, but it uses completely different syntax.
 I'm really excited about having a standard D compiler front-end as a
 library solution, so i though it would be best to parse the syntax
 from the syntax definition of dpl.org

That can currently not be done. The syntax specification on dpl.org is out of date and contains many errors and inaccuracies. (at least it was that way the last time I checked)


I've written a fast and pretty complete D lexer (https://gist.github.com/1262321). It is based on a generic lexer component which will generate efficient matching functions at compile time (https://gist.github.com/1255439). I think there are still some compiler bugs to be sorted out so you won't be able to compile it out of the box. martin
Oct 23 2011
prev sibling next sibling parent "Martin Nowak" <dawg dawgfoto.de> writes:
On Sun, 23 Oct 2011 23:27:12 +0200, Timon Gehr <timon.gehr gmx.ch> wrote:

 On 10/23/2011 07:19 PM, Martin Nowak wrote:
 On Sun, 23 Oct 2011 15:10:08 +0200, Gor Gyolchanyan
 <gor.f.gyolchanyan gmail.com> wrote:

 Anyway, I'm writing a general-purpose parser base, so i won't need it
 for now.
 And when i do, I'd like to have a correct grammar definition, so i can
 feed it to my parser.
 Who should i ask to ensure it's correctness?

 Once I'm done, I'll send a pull request for something around
 "etc.dcfe" for "D compiler front end".
 It won't be perfect, of course, but it will be a start, from which the
 front-end would be gradually developed.
 I wanna at least have an AST parser by the time i make the pull  
 request.

 On Sun, Oct 23, 2011 at 5:01 PM, Timon Gehr <timon.gehr gmx.ch> wrote:
 On 10/23/2011 02:16 PM, Gor Gyolchanyan wrote:
 Yeah, i know about EBNF, but it uses completely different syntax.
 I'm really excited about having a standard D compiler front-end as a
 library solution, so i though it would be best to parse the syntax
 from the syntax definition of dpl.org

That can currently not be done. The syntax specification on dpl.org is out of date and contains many errors and inaccuracies. (at least it was that way the last time I checked)


I've written a fast and pretty complete D lexer (https://gist.github.com/1262321). It is based on a generic lexer component which will generate efficient matching functions at compile time (https://gist.github.com/1255439). I think there are still some compiler bugs to be sorted out so you won't be able to compile it out of the box. martin

4| import lexer; // where is this file?

The second gist. https://gist.github.com/1255439
Oct 23 2011
prev sibling parent bcs <bcs example.com> writes:
On 10/23/2011 04:58 AM, Gor Gyolchanyan wrote:
 Hi, guys!
 Can anyone tell me what's the name of this syntax definition language,
 used here: http://www.d-programming-language.org/lex.htm ?

You might find this interesting: http://dsource.org/projects/scrapple/browser/trunk/dparser It's way out of date, I never completely finished it and it can't handle the D grammar as documented (b/c of standard left recursion problem) but ...
Oct 28 2011