Thread overview
Announce DGrammar
Nov 28, 2004
Sjoerd van Leent
Nov 28, 2004
Holger Sebert
Nov 28, 2004
Sjoerd van Leent
Nov 29, 2004
Holger Sebert
Nov 29, 2004
HN
Nov 29, 2004
Sjoerd van Leent
Nov 29, 2004
Sjoerd van Leent
November 28, 2004
Hi all,

Experimenting with D learned that there was no such thing as a grammar compiler (or compiler-compiler). Therefor I made my own grammar compiler which looks a little bit like YACC.

You can find the project at dsource.org, thus:

http://dsource.org/projects/dgrammar/

There is a compiled version for Linux (I compiled it on Fedora Core 3), but it should be possible to compile it on other platforms as well. For compilation you need a lexer (probably flex) and a YACC implementation (probably bison).
There is a simple SConstruct script available, but if you like Make more, it shouldn't be that difficult to build up a makefile out of the SConstruct file.
It comes with a GPL license (version 2), so go ahead changing it the way you like. (Although I appreciate to know what you changed, for a better DGrammar).

Key differences:
- YACC needs a lexer, DGrammar has inline regular expression support
- YACC's C(++) code is inline, code of DGrammar is extern
- DGrammar uses the DMD/DMC regular expression library
- DGrammar is OOP, it makes classes out of grammars
- Syntactically different from YACC in many cases

Currently I am working on a documentation set, so that it is more easy to work with DGrammar.

Regards,
Sjoerd
November 28, 2004
Great,

now *that* was the remaining piece towards full-scale D usage!!

I'll try it at once!!!

Holger

Sjoerd van Leent wrote:
> Hi all,
> 
> Experimenting with D learned that there was no such thing as a grammar compiler (or compiler-compiler). Therefor I made my own grammar compiler which looks a little bit like YACC.
> 
> You can find the project at dsource.org, thus:
> 
> http://dsource.org/projects/dgrammar/
> 
> There is a compiled version for Linux (I compiled it on Fedora Core 3), but it should be possible to compile it on other platforms as well. For compilation you need a lexer (probably flex) and a YACC implementation (probably bison).
> There is a simple SConstruct script available, but if you like Make more, it shouldn't be that difficult to build up a makefile out of the SConstruct file.
> It comes with a GPL license (version 2), so go ahead changing it the way you like. (Although I appreciate to know what you changed, for a better DGrammar).
> 
> Key differences:
> - YACC needs a lexer, DGrammar has inline regular expression support
> - YACC's C(++) code is inline, code of DGrammar is extern
> - DGrammar uses the DMD/DMC regular expression library
> - DGrammar is OOP, it makes classes out of grammars
> - Syntactically different from YACC in many cases
> 
> Currently I am working on a documentation set, so that it is more easy to work with DGrammar.
> 
> Regards,
> Sjoerd
November 28, 2004
I appreciate your message, this inspires me to continue development, and not leaving it to version 0.2 :-)

Regards,
Sjoerd

Holger Sebert wrote:
> Great,
> 
> now *that* was the remaining piece towards full-scale D usage!!
> 
> I'll try it at once!!!
> 
> Holger
> 
> Sjoerd van Leent wrote:
> 
>> Hi all,
>>
>> Experimenting with D learned that there was no such thing as a grammar compiler (or compiler-compiler). Therefor I made my own grammar compiler which looks a little bit like YACC.
>>
>> You can find the project at dsource.org, thus:
>>
>> http://dsource.org/projects/dgrammar/
>>
>> There is a compiled version for Linux (I compiled it on Fedora Core 3), but it should be possible to compile it on other platforms as well. For compilation you need a lexer (probably flex) and a YACC implementation (probably bison).
>> There is a simple SConstruct script available, but if you like Make more, it shouldn't be that difficult to build up a makefile out of the SConstruct file.
>> It comes with a GPL license (version 2), so go ahead changing it the way you like. (Although I appreciate to know what you changed, for a better DGrammar).
>>
>> Key differences:
>> - YACC needs a lexer, DGrammar has inline regular expression support
>> - YACC's C(++) code is inline, code of DGrammar is extern
>> - DGrammar uses the DMD/DMC regular expression library
>> - DGrammar is OOP, it makes classes out of grammars
>> - Syntactically different from YACC in many cases
>>
>> Currently I am working on a documentation set, so that it is more easy to work with DGrammar.
>>
>> Regards,
>> Sjoerd
November 29, 2004
Hi,

oh yes! I think a good parser generator belongs to *every* modern programming language.

In my C++ projects I use ANTLR, but this tool has a *huge* run-time lib coming with it, which makes it look like an A-Bomb when using it for medium scale script parsers (where lex and yacc would be the tools of choice---but at the same time totally useless due to their non-existent OO support).

Another thing that's annoying when using ANTLR is the embedded code that pollutes the grammar.

So I am really looking forward using DGrammar.

Unfortunately, the executable provided by your link does not run on my distro (slackware 10.0, libstdc++.so.5) and I didn't found the source anywhere (or am I blind?)

If there's something I could do to support you with your project (although I am not experienced in building compiler-compilers ...), I would be glad doing it!!

Greets,
Holger


Sjoerd van Leent wrote:
> I appreciate your message, this inspires me to continue development, and not leaving it to version 0.2 :-)
> 
> Regards,
> Sjoerd
> 
> Holger Sebert wrote:
> 
>> Great,
>>
>> now *that* was the remaining piece towards full-scale D usage!!
>>
>> I'll try it at once!!!
>>
>> Holger
>>
>> Sjoerd van Leent wrote:
>>
>>> Hi all,
>>>
>>> Experimenting with D learned that there was no such thing as a grammar compiler (or compiler-compiler). Therefor I made my own grammar compiler which looks a little bit like YACC.
>>>
>>> You can find the project at dsource.org, thus:
>>>
>>> http://dsource.org/projects/dgrammar/
>>>
>>> There is a compiled version for Linux (I compiled it on Fedora Core 3), but it should be possible to compile it on other platforms as well. For compilation you need a lexer (probably flex) and a YACC implementation (probably bison).
>>> There is a simple SConstruct script available, but if you like Make more, it shouldn't be that difficult to build up a makefile out of the SConstruct file.
>>> It comes with a GPL license (version 2), so go ahead changing it the way you like. (Although I appreciate to know what you changed, for a better DGrammar).
>>>
>>> Key differences:
>>> - YACC needs a lexer, DGrammar has inline regular expression support
>>> - YACC's C(++) code is inline, code of DGrammar is extern
>>> - DGrammar uses the DMD/DMC regular expression library
>>> - DGrammar is OOP, it makes classes out of grammars
>>> - Syntactically different from YACC in many cases
>>>
>>> Currently I am working on a documentation set, so that it is more easy to work with DGrammar.
>>>
>>> Regards,
>>> Sjoerd
November 29, 2004
"Holger Sebert" <holger.sebert@ruhr-uni-bochum.de> wrote in message news:codv2p$16a9$1@digitaldaemon.com...
> Hi,
>
> oh yes! I think a good parser generator belongs to *every* modern programming language.
>
> In my C++ projects I use ANTLR, but this tool has a *huge* run-time lib coming with it, which makes it look like an A-Bomb when using it for medium scale script parsers (where lex and yacc would be the tools of choice---but at the same time totally useless due to their non-existent OO support).
>
> Another thing that's annoying when using ANTLR is the embedded code that pollutes the grammar.

Personally, I prefer LL(k) parser generators like ANTLR over LALR(1)
parser generators like YACC. I used ANTLR for more projects and my opionion
about it is very good.


November 29, 2004
HN wrote:
> "Holger Sebert" <holger.sebert@ruhr-uni-bochum.de> wrote in message
> news:codv2p$16a9$1@digitaldaemon.com...
> 
>>Hi,
>>
>>oh yes! I think a good parser generator belongs to *every* modern
>>programming language.
>>
>>In my C++ projects I use ANTLR, but this tool has a *huge* run-time lib
>>coming with it, which makes it look like an A-Bomb when using it for
>>medium scale script parsers (where lex and yacc would be the tools of
>>choice---but at the same time totally useless due to their non-existent
>>OO support).
>>
>>Another thing that's annoying when using ANTLR is the embedded code that
>>pollutes the grammar.
> 
> 
> Personally, I prefer LL(k) parser generators like ANTLR over LALR(1)
> parser generators like YACC. I used ANTLR for more projects and my opionion
> about it is very good.
> 
> 

If you have any suggestion of making it better, please post it on the dsource forum, I'd really appreciate it. As to ANTLR, I don't have much experience, but I've got experience with parser-combinators and YACC. If their is anything which seems to be incomplete, or could be better, post it!

Regards,
Sjoerd
November 29, 2004
Holger Sebert wrote:
> Hi,
> 
> oh yes! I think a good parser generator belongs to *every* modern programming language.
> 
> In my C++ projects I use ANTLR, but this tool has a *huge* run-time lib coming with it, which makes it look like an A-Bomb when using it for medium scale script parsers (where lex and yacc would be the tools of choice---but at the same time totally useless due to their non-existent OO support).

Well the lack of OO-support was one of the reasons to do it differently.
> 
> Another thing that's annoying when using ANTLR is the embedded code that pollutes the grammar.

That is also true for YACC, to some point

> So I am really looking forward using DGrammar.
> 
> Unfortunately, the executable provided by your link does not run on my distro (slackware 10.0, libstdc++.so.5) and I didn't found the source anywhere (or am I blind?)
> 

Probably, the source is in the /trunk directory on SVN.

http://svn.dsource.org/svn/projects/dgrammar/trunk/

> If there's something I could do to support you with your project (although I am not experienced in building compiler-compilers ...), I would be glad doing it!!
> 

You're welcome, please post a message on the forum

> Greets,
> Holger
>