Compiling DMD parser?

Koroskin Denis 2korden+dmd at gmail.com
Sun Jul 13 15:41:34 PDT 2008


On Sun, 13 Jul 2008 08:33:54 +0400, Markus Koskimies  
<markus at reaaliaika.net> wrote:

> Hi,
>
> I thought that I could play around a little bit with DMD parser. I have
> DMD 1.030 parser sources, and I made a simple makefile for just compiling
> those sources (with gcc 4.3.1).
>
> ---
> Some questions:
>
> - These are C++ sources, not C sources, although the suffix is .c and .h,
> right? A little bit sad, I thought that I could wrap the parser to D :( I
> have not much interest playing with C++ at freetime...
>
> - Are these files meant to be compiled alone without making modifications
> to files? For example:
>
> - In "attrib.c", if linux is defined, it tries to include mem.h from "../
> root"; why not the one in the src/ directory?
>
> - There is no such file that "id.h", which probably contains  
> class/struct/
> enum "Id"
>
> - init.h does not include "hdrgen.h", while uses HdrGenState
>
> ---
> How these parser codes are meant to be used? Am I missing something?

I'm working on something that could be of interest to you.
I have a working DMD to D bridge via C abi. It's not complete but most  
important data structures are available from D, i.e. you can pass some .d  
files to it and get an AST back. I've written a small source-code analyzer  
as a proof-of-concept with it.

Think of it as a DParser (http://www.dsource.org/projects/dparser) but  
with official implementation. A huge plus is that almost no maintaining  
effort needed.

Bridge is written from scratch with a mix of C++ and D1 and is not based  
on DMDFE (http://www.dsource.org/projects/dmdfe). I haven't released the  
sources yet, so contact me if you would like to look at the them.



More information about the Digitalmars-d mailing list