www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - parser generator in d

reply llee <llee goucher.edu> writes:
Does any one know of any parser generators for D? I'm linking against c files
generated using bison, and while this works, It would be better if D had
support for complex parsing tasks.
Jul 02 2008
next sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"llee" <llee goucher.edu> wrote in message 
news:g4gp9o$2042$1 digitalmars.com...
 Does any one know of any parser generators for D? I'm linking against c 
 files generated using bison, and while this works, It would be better if D 
 had support for complex parsing tasks.

There's Enki: http://www.dsource.org/projects/ddl/wiki/Enki I've never used it, so I can't say how complete/powerful it is.
Jul 02 2008
prev sibling next sibling parent BCS <ao pathlink.com> writes:
Reply to llee,

 Does any one know of any parser generators for D? I'm linking against
 c files generated using bison, and while this works, It would be
 better if D had support for complex parsing tasks.
 

Antlr is supposed to have D support but I havn't even tried to use it. (I found antler to be hard to work with in general) http://www.antlr.org/ there's also my project dparser. Not vary mature and not well tested but it doesn't requirer anything but DMD to build. http://www.dsource.org/projects/scrapple/browser/trunk/dparser/dparse.d APaGeD - Attributed Parser Generator for D http://www.digitalmars.com/d/archives/digitalmars/D/announce/Parser_Generator_APaGeD_0.3_beta_release_9653.html http://apaged.mainia.de
Jul 02 2008
prev sibling next sibling parent reply Robert Fraser <fraserofthenight gmail.com> writes:
llee Wrote:

 Does any one know of any parser generators for D? I'm linking against c files
generated using bison, and while this works, It would be better if D had
support for complex parsing tasks.

Besides the ones already mentioned, there's also this marvel of CTFE/template meta-programming that doesn't require any separate generation step (you put the BNF grammar right into your source file): http://www.dsource.org/projects/scrapple/browser/trunk/dparser IMO, it's the coolest ting I've seen in D, but it'll bloat your compile-times to a few minutes if you use a complex grammar.
Jul 02 2008
parent reply llee <llee goucher.edu> writes:
Robert Fraser Wrote:

 llee Wrote:
 
 Does any one know of any parser generators for D? I'm linking against c files
generated using bison, and while this works, It would be better if D had
support for complex parsing tasks.

Besides the ones already mentioned, there's also this marvel of CTFE/template meta-programming that doesn't require any separate generation step (you put the BNF grammar right into your source file): http://www.dsource.org/projects/scrapple/browser/trunk/dparser IMO, it's the coolest ting I've seen in D, but it'll bloat your compile-times to a few minutes if you use a complex grammar.

do you have any documentation for it? If so I'll probably put it to use.
Jul 02 2008
parent BCS <ao pathlink.com> writes:
Reply to llee,

 Robert Fraser Wrote:
 
 llee Wrote:
 
 Does any one know of any parser generators for D? I'm linking
 against c files generated using bison, and while this works, It
 would be better if D had support for complex parsing tasks.
 

CTFE/template meta-programming that doesn't require any separate generation step (you put the BNF grammar right into your source file): http://www.dsource.org/projects/scrapple/browser/trunk/dparser IMO, it's the coolest ting I've seen in D, but it'll bloat your compile-times to a few minutes if you use a complex grammar.

use.

If you are planning on doing anything serious, be warned I have some major braking changes coming but I have no clue when. The current implementation forces the user to do gobs of down casts and I think I have figured out how to avoid that. However it is going to change the call signature on just about everything. The documentation is at the top of the file. I have a revamp of that as well, but it's for the new version and again, pot luck on when it will get done. This thing isn't alpha, it prototype, if that.
Jul 02 2008
prev sibling next sibling parent Moritz Warning <moritzwarning web.de> writes:
On Wed, 02 Jul 2008 16:43:36 -0400, llee wrote:

 Does any one know of any parser generators for D? I'm linking against c
 files generated using bison, and while this works, It would be better if
 D had support for complex parsing tasks.

There is http://apaged.mainia.de for example.
Jul 02 2008
prev sibling next sibling parent reply sambeau <sambeau-nospam mac.com> writes:
llee Wrote:

 Does any one know of any parser generators for D? I'm linking against c files
generated using bison, and while this works, It would be better if D had
support for complex parsing tasks.

I'm a bit surprised that no-one has mentioned that the (kinda) new industry standard hasn't been mentioned here.. Ragel: http://research.cs.queensu.ca/~thurston/ragel/ it generates C, C++, Objective-C, ****D****, Java or Ruby code with no dependencies. And a) generates very fast code, and b) is (frankly) very cool.
Jul 02 2008
next sibling parent llee <llee goucher.edu> writes:
sambeau Wrote:

 llee Wrote:
 
 Does any one know of any parser generators for D? I'm linking against c files
generated using bison, and while this works, It would be better if D had
support for complex parsing tasks.

I'm a bit surprised that no-one has mentioned that the (kinda) new industry standard hasn't been mentioned here.. Ragel: http://research.cs.queensu.ca/~thurston/ragel/ it generates C, C++, Objective-C, ****D****, Java or Ruby code with no dependencies. And a) generates very fast code, and b) is (frankly) very cool.

Jul 03 2008
prev sibling next sibling parent llee <llee goucher.edu> writes:
sambeau Wrote:

 llee Wrote:
 
 Does any one know of any parser generators for D? I'm linking against c files
generated using bison, and while this works, It would be better if D had
support for complex parsing tasks.

I'm a bit surprised that no-one has mentioned that the (kinda) new industry standard hasn't been mentioned here.. Ragel: http://research.cs.queensu.ca/~thurston/ragel/ it generates C, C++, Objective-C, ****D****, Java or Ruby code with no dependencies. And a) generates very fast code, and b) is (frankly) very cool.

Jul 03 2008
prev sibling parent Don <nospam nospam.com.au> writes:
sambeau wrote:
 llee Wrote:
 
 Does any one know of any parser generators for D? I'm linking against c files
generated using bison, and while this works, It would be better if D had
support for complex parsing tasks.

I'm a bit surprised that no-one has mentioned that the (kinda) new industry standard hasn't been mentioned here.. Ragel: http://research.cs.queensu.ca/~thurston/ragel/ it generates C, C++, Objective-C, ****D****, Java or Ruby code with no dependencies. And a) generates very fast code, and b) is (frankly) very cool.

That is very cool. Deserves a link on the D website, I reckon. The number of quality tools with native support for D is quite limited, and we should promote them as much as possible.
Jul 03 2008
prev sibling next sibling parent llee <llee goucher.edu> writes:
llee Wrote:

 Does any one know of any parser generators for D? I'm linking against c files
generated using bison, and while this works, It would be better if D had
support for complex parsing tasks.

I looked at ragel and I will probably end up using it. Does anyone know where I can find examples or further documentation for using it with d.
Jul 03 2008
prev sibling next sibling parent "Nick Sabalausky" <a a.a> writes:
"llee" <llee goucher.edu> wrote in message 
news:g4gp9o$2042$1 digitalmars.com...
 Does any one know of any parser generators for D? I'm linking against c 
 files generated using bison, and while this works, It would be better if D 
 had support for complex parsing tasks.

I'm working on one right now as a side project, but it's nowhere near being in any usable form yet.
Jul 03 2008
prev sibling parent "Manfred_Nowak" <svv1999 hotmail.com> writes:
llee wrote:

 parser generators for D

GOLD (http://www.devincook.com/goldparser/) is a forever free tool for visual aiding the definition of LALR(1)-grammars for a given language. It has an import feature for yacc grammars and can generate parsers and scanners in D. The generation process is guided by user definable macros. A macro collection for D is available (author: Matthias Piepkorn) http://www.devincook.com/goldparser/engine/d/index.htm I have setup a macro collection too, which seems to be twice as fast as Matthias'. My collection is unpublished but I am willing to share on a personal basis. -manfred
Jul 04 2008